on xenial help sign in
change the retry label to accept arbitrary text
7c1c6dbMichael Zanetti
qml/Greeter/Lockscreen.qml+4−5
@@ -29,6 +29,8 @@ Showable {
29 property string placeholderText: ""
29 property string placeholderText: ""
30 // Placeholder text while shaking (e.g. Incorrect passprase)
30 // Placeholder text while shaking (e.g. Incorrect passprase)
31 property string wrongPlaceholderText: ""
31 property string wrongPlaceholderText: ""
32+ // Retries text (e.g. 3 retries left)
33+ property string retryText: ""
32
34
33 // Informational text. (e.g. some text to tell which domain this is pin is entered for.
35 // Informational text. (e.g. some text to tell which domain this is pin is entered for.
34 property string infoText: ""
36 property string infoText: ""
@@ -47,9 +49,6 @@ Showable {
47 property int minPinLength: -1
49 property int minPinLength: -1
48 property int maxPinLength: -1
50 property int maxPinLength: -1
49
51
50− // Set this to a value greater 0 to show a label telling the user how many retries are left
51− property int retryCount: -1
52−
53 property url background: ""
52 property url background: ""
54
53
55 signal entered(string passphrase)
54 signal entered(string passphrase)
@@ -112,11 +111,11 @@ Showable {
112 left: parent.left
111 left: parent.left
113 right: parent.right
112 right: parent.right
114 }
113 }
115− text: i18n.tr("%1 retry remaining", "%1 retries remaining", root.retryCount).arg(root.retryCount)
114+ text: root.retryText
116 horizontalAlignment: Text.AlignHCenter
115 horizontalAlignment: Text.AlignHCenter
117 color: "#f3f3e7"
116 color: "#f3f3e7"
118 opacity: 0.6
117 opacity: 0.6
119− visible: root.retryCount >= 0
118+ visible: root.retryText.length > 0
120 }
119 }
121 Label {
120 Label {
122 id: infoTextLabel
121 id: infoTextLabel
tests/qmltests/Greeter/tst_Lockscreen.qml+5−7
@@ -34,10 +34,10 @@ Rectangle {
34 anchors.rightMargin: units.gu(30)
34 anchors.rightMargin: units.gu(30)
35 placeholderText: "Please enter your PIN"
35 placeholderText: "Please enter your PIN"
36 wrongPlaceholderText: "Incorrect PIN"
36 wrongPlaceholderText: "Incorrect PIN"
37+ retryText: retryCountTextField.text
37 alphaNumeric: pinPadCheckBox.checked
38 alphaNumeric: pinPadCheckBox.checked
38 minPinLength: minPinLengthTextField.text
39 minPinLength: minPinLengthTextField.text
39 maxPinLength: maxPinLengthTextField.text
40 maxPinLength: maxPinLengthTextField.text
40− retryCount: retryCountTextField.text
41 username: "Lola"
41 username: "Lola"
42 background: "../../../qml/graphics/phone_background.jpg"
42 background: "../../../qml/graphics/phone_background.jpg"
43 infoText: infoTextTextField.text
43 infoText: infoTextTextField.text
@@ -118,7 +118,7 @@ Rectangle {
118 TextField {
118 TextField {
119 id: retryCountTextField
119 id: retryCountTextField
120 width: units.gu(7)
120 width: units.gu(7)
121− text: "3"
121+ text: "3 retries left"
122 }
122 }
123 Label {
123 Label {
124 text: "Retries left"
124 text: "Retries left"
@@ -398,10 +398,8 @@ Rectangle {
398
398
399 function test_retryDisplay_data() {
399 function test_retryDisplay_data() {
400 return [
400 return [
401− {tag: "0", retryCount: 0, shown: true},
401+ {tag: "empty", retryText: "", shown: false},
402− {tag: "1", retryCount: 1, shown: true},
402+ {tag: "3 retries left", retryText: "3 retries left", shown: true},
403− {tag: "3", retryCount: 3, shown: true},
404− {tag: "-1", retryCount: -1, shown: false},
405 ]
403 ]
406 }
404 }
407
405
@@ -409,7 +407,7 @@ Rectangle {
409 pinPadCheckBox.checked = false
407 pinPadCheckBox.checked = false
410 waitForLockscreenReady();
408 waitForLockscreenReady();
411
409
412− retryCountTextField.text = data.retryCount;
410+ retryCountTextField.text = data.retryText;
413 var label = findChild(lockscreen, "retryCountLabel")
411 var label = findChild(lockscreen, "retryCountLabel")
414 compare(label.visible, data.shown);
412 compare(label.visible, data.shown);
415 }
413 }