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.text = "Creating profile..."
}
onCancel:
{
locationView.state = "selectLocation"
}
}
},
State
@ -83,6 +87,10 @@ Item
locationView.attemptLogin = true
attemptTimer.start()
}
onCancel:
{
locationView.state = "selectLocation"
}
}
}
]

View File

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