on xenial help sign in
change the retry label to accept arbitrary text
commit7c1c6db6ac43018c92c59f25ed9e3fbeb9489e2f authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 20 May 2014, 14:10 (12 years ago) parentb41b888
2 files changed+9−12
qml/Greeter/Lockscreen.qml+4−5 tests/qmltests/Greeter/tst_Lockscreen.qml+5−7
qml/Greeter/Lockscreen.qml+4−5
@@ -29,6 +29,8 @@ Showable {
2929 property string placeholderText: ""
3030 // Placeholder text while shaking (e.g. Incorrect passprase)
3131 property string wrongPlaceholderText: ""
32+ // Retries text (e.g. 3 retries left)
33+ property string retryText: ""
3234
3335 // Informational text. (e.g. some text to tell which domain this is pin is entered for.
3436 property string infoText: ""
@@ -47,9 +49,6 @@ Showable {
4749 property int minPinLength: -1
4850 property int maxPinLength: -1
4951
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−
5352 property url background: ""
5453
5554 signal entered(string passphrase)
@@ -112,11 +111,11 @@ Showable {
112111 left: parent.left
113112 right: parent.right
114113 }
115− text: i18n.tr("%1 retry remaining", "%1 retries remaining", root.retryCount).arg(root.retryCount)
114+ text: root.retryText
116115 horizontalAlignment: Text.AlignHCenter
117116 color: "#f3f3e7"
118117 opacity: 0.6
119− visible: root.retryCount >= 0
118+ visible: root.retryText.length > 0
120119 }
121120 Label {
122121 id: infoTextLabel
tests/qmltests/Greeter/tst_Lockscreen.qml+5−7
@@ -34,10 +34,10 @@ Rectangle {
3434 anchors.rightMargin: units.gu(30)
3535 placeholderText: "Please enter your PIN"
3636 wrongPlaceholderText: "Incorrect PIN"
37+ retryText: retryCountTextField.text
3738 alphaNumeric: pinPadCheckBox.checked
3839 minPinLength: minPinLengthTextField.text
3940 maxPinLength: maxPinLengthTextField.text
40− retryCount: retryCountTextField.text
4141 username: "Lola"
4242 background: "../../../qml/graphics/phone_background.jpg"
4343 infoText: infoTextTextField.text
@@ -118,7 +118,7 @@ Rectangle {
118118 TextField {
119119 id: retryCountTextField
120120 width: units.gu(7)
121− text: "3"
121+ text: "3 retries left"
122122 }
123123 Label {
124124 text: "Retries left"
@@ -398,10 +398,8 @@ Rectangle {
398398
399399 function test_retryDisplay_data() {
400400 return [
401− {tag: "0", retryCount: 0, shown: true},
402− {tag: "1", retryCount: 1, shown: true},
403− {tag: "3", retryCount: 3, shown: true},
404− {tag: "-1", retryCount: -1, shown: false},
401+ {tag: "empty", retryText: "", shown: false},
402+ {tag: "3 retries left", retryText: "3 retries left", shown: true},
405403 ]
406404 }
407405
@@ -409,7 +407,7 @@ Rectangle {
409407 pinPadCheckBox.checked = false
410408 waitForLockscreenReady();
411409
412− retryCountTextField.text = data.retryCount;
410+ retryCountTextField.text = data.retryText;
413411 var label = findChild(lockscreen, "retryCountLabel")
414412 compare(label.visible, data.shown);
415413 }