Commit a3686334 authored by Karel Slaný's avatar Karel Slaný

Back button navigates to previous available action on PIN settings page.

parent bd170099
......@@ -35,8 +35,9 @@ Component {
}
property string currentPIN: ""
property string actionName: "" /* Initial value left blank. */
onActionNameChanged : { /* Handles actionName changes. */
onActionNameChanged : { /* Handles visibility on actionName changes. */
if (actionName == "unspecified") {
acceptElement.visible = false
if (currentPIN == "") {
topLineText.text = qsTr("Currently there is no PIN code set.")
setPinButton.visible = true
......@@ -48,33 +49,50 @@ Component {
changePinButton.visible = true
disablePinButton.visible = true
}
pinValueField.visible = false
pinConfirmField1.visible = false
pinConfirmField2.visible = false
errLineText.visible = false
} else if (actionName == "new") {
acceptElement.visible = true
topLineText.text = qsTr("Enter a new PIN code into both text fields:")
setPinButton.visible = false
changePinButton.visible = false
disablePinButton.visible = false
pinValueField.visible = false
pinConfirmField1.visible = true
pinConfirmField1.focus = true
pinConfirmField2.visible = true
errLineText.visible = false
pinConfirmField1.focus = true
} else if (actionName == "change") {
acceptElement.visible = true
topLineText.text = qsTr("In order to change the PIN code you must enter the current and a new PIN code:")
setPinButton.visible = false
changePinButton.visible = false
disablePinButton.visible = false
pinValueField.visible = true
pinValueField.focus = true
pinConfirmField1.visible = true
pinConfirmField2.visible = true
errLineText.visible = false
pinValueField.focus = true
} else if (actionName == "disable") {
acceptElement.visible = true
topLineText.text = qsTr("In order to change the PIN code you must enter the current and a new PIN code:")
setPinButton.visible = false
changePinButton.visible = false
disablePinButton.visible = false
pinValueField.visible = true
pinValueField.focus = true
pinConfirmField1.visible = false
pinConfirmField2.visible = false
errLineText.visible = false
pinValueField.focus = true
} else {
/* This line should not be reached. */
topLineText.text = qsTr("Something went wrong!")
}
}
property int myWidht: mainItem.width - 2 * defaultMargin
......@@ -100,7 +118,12 @@ Component {
MouseArea {
anchors.fill: parent
onClicked: {
if (actionName != "unspecified") {
/* Navigate to initial action. */
actionName = "unspecified"
} else {
pageView.pop(StackView.Immediate)
}
}
}
}
......@@ -119,7 +142,6 @@ Component {
anchors.rightMargin: defaultMargin
Image {
id: acceptElement
visible: false
anchors.verticalCenter: parent.verticalCenter
sourceSize.height: imgHeight
source: "qrc:/ui/checkbox-marked-circle.svg"
......@@ -234,7 +256,6 @@ Component {
TextField {
id: pinValueField
anchors.horizontalCenter: parent.horizontalCenter
visible: false
width: myWidht * 0.5
echoMode: TextInput.Password
passwordMaskDelay: 500 // milliseconds
......@@ -245,7 +266,6 @@ Component {
TextField {
id: pinConfirmField1
anchors.horizontalCenter: parent.horizontalCenter
visible: false
width: myWidht * 0.5
echoMode: TextInput.Password
passwordMaskDelay: 500 // milliseconds
......@@ -256,7 +276,6 @@ Component {
TextField {
id: pinConfirmField2
anchors.horizontalCenter: parent.horizontalCenter
visible: false
width: myWidht * 0.5
echoMode: TextInput.Password
passwordMaskDelay: 500 // milliseconds
......@@ -266,7 +285,6 @@ Component {
}
Text {
id: errLineText
visible: false
anchors.horizontalCenter: parent.horizontalCenter
font.bold: true
color: datovkaPalette.text
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment