Add "Sign in with another account" button in AddCloudPrintersView

There are cases where Cura and the browser fall out of sync when it
comes to accounts. In such cases, you may be logged in cura with an
account that has no cloud printers and in the browser with an account
that has printers. So when you press the "Add cloud printer" button,
you are redirected to mycloud and you see cloud printers that are not
detected by Cura (because Cura is in a different acconut). In such
cases, the user can now press the "Sign in with a different account"
link in the "Waiting for cloud response" page, which will log him/her
out in Cura AND in the browser, and then reinitiate the whole
authorization flow, to make sure the accounts are in sync.

CURA-7427
This commit is contained in:
Kostas Karmas 2020-05-11 17:47:09 +02:00
parent 5ccf8e412d
commit b717755f20
3 changed files with 58 additions and 6 deletions

View file

@ -51,11 +51,11 @@ Item
}
// Component that contains a busy indicator and a message, while it waits for Cura to discover a cloud printer
Rectangle
Item
{
id: waitingContent
width: parent.width
height: waitingIndicator.height + waitingLabel.height
height: childrenRect.height
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
BusyIndicator
@ -74,6 +74,37 @@ Item
font: UM.Theme.getFont("large")
renderType: Text.NativeRendering
}
Label
{
id: noPrintersFoundLabel
anchors.top: waitingLabel.bottom
anchors.topMargin: 2 * UM.Theme.getSize("wide_margin").height
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: catalog.i18nc("@label", "No printers found in your account?")
font: UM.Theme.getFont("medium")
}
Label
{
text: "Sign in with a different account"
anchors.top: noPrintersFoundLabel.bottom
anchors.horizontalCenter: parent.horizontalCenter
font: UM.Theme.getFont("medium")
color: UM.Theme.getColor("text_link")
MouseArea {
anchors.fill: parent;
onClicked: Cura.API.account.loginWithForcedLogout()
hoverEnabled: true
onEntered:
{
parent.font.underline = true
}
onExited:
{
parent.font.underline = false
}
}
}
visible: discoveredCloudPrintersModel.count == 0
}