Add cancel button on Locations view to go back to location selector

This commit is contained in:
Angela Mazzurco 2017-07-22 15:42:08 +02:00
parent 962cda0947
commit 64c48be211
2 changed files with 16 additions and 0 deletions

View file

@ -62,6 +62,10 @@ Item
createNewButton.enabled = false createNewButton.enabled = false
createNewButton.text = "Creating profile..." createNewButton.text = "Creating profile..."
} }
onCancel:
{
locationView.state = "selectLocation"
}
} }
}, },
State State
@ -83,6 +87,10 @@ Item
locationView.attemptLogin = true locationView.attemptLogin = true
attemptTimer.start() attemptTimer.start()
} }
onCancel:
{
locationView.state = "selectLocation"
}
} }
} }
] ]

View file

@ -24,6 +24,7 @@ Item
{ {
id: loginView id: loginView
property string buttonText: qsTr("Unlock") property string buttonText: qsTr("Unlock")
property string cancelText: qsTr("Cancel")
property string iconUrl: "qrc:/icons/emblem-locked.svg" property string iconUrl: "qrc:/icons/emblem-locked.svg"
property string login property string login
property bool loginPreset: false property bool loginPreset: false
@ -32,6 +33,7 @@ Item
property string password: advancedMode ? "" : hardcodedPassword property string password: advancedMode ? "" : hardcodedPassword
property string suggestionText property string suggestionText
signal submit(string login, string password) signal submit(string login, string password)
signal cancel()
Component.onCompleted: loginPreset = login.length > 0 Component.onCompleted: loginPreset = login.length > 0
@ -131,6 +133,12 @@ Item
text: loginView.buttonText text: loginView.buttonText
onClicked: loginView.submit(nameField.text, passwordField.text) onClicked: loginView.submit(nameField.text, passwordField.text)
} }
Button
{
id: cancelButton
text: loginView.cancelText
onClicked: loginView.cancel()
}
} }
} }
} }