on xenial help sign in
add a signal to inform the caller when the infoPopup is closed
91548deMichael Zanetti
qml/Greeter/Lockscreen.qml+12−1
@@ -27,6 +27,8 @@ Showable {
27
27
28 // Placeholder text
28 // Placeholder text
29 property string placeholderText: ""
29 property string placeholderText: ""
30+ // Placeholder text while shaking (e.g. Incorrect passprase)
31+ property string wrongPlaceholderText: ""
30
32
31 // Informational text. (e.g. some text to tell which domain this is pin is entered for.
33 // Informational text. (e.g. some text to tell which domain this is pin is entered for.
32 property string infoText: ""
34 property string infoText: ""
@@ -53,6 +55,7 @@ Showable {
53 signal entered(string passphrase)
55 signal entered(string passphrase)
54 signal cancel()
56 signal cancel()
55 signal emergencyCall()
57 signal emergencyCall()
58+ signal infoPopupConfirmed()
56
59
57 onRequiredChanged: {
60 onRequiredChanged: {
58 if (required && pinPadLoader.item) {
61 if (required && pinPadLoader.item) {
@@ -172,6 +175,11 @@ Showable {
172 property: "placeholderText"
175 property: "placeholderText"
173 value: root.placeholderText
176 value: root.placeholderText
174 }
177 }
178+ Binding {
179+ target: pinPadLoader.item
180+ property: "wrongPlaceholderText"
181+ value: root.wrongPlaceholderText
182+ }
175 Binding {
183 Binding {
176 target: pinPadLoader.item
184 target: pinPadLoader.item
177 property: "username"
185 property: "username"
@@ -222,7 +230,10 @@ Showable {
222 Button {
230 Button {
223 objectName: "infoPopupOkButton"
231 objectName: "infoPopupOkButton"
224 text: i18n.tr("OK")
232 text: i18n.tr("OK")
233+ onClicked: {
225− onClicked: PopupUtils.close(dialog)
234+ PopupUtils.close(dialog)
235+ root.infoPopupConfirmed();
236+ }
226 }
237 }
227 }
238 }
228 }
239 }
qml/Greeter/PassphraseLockscreen.qml+3−1
@@ -22,7 +22,8 @@ Item {
22 id: root
22 id: root
23 height: highlightItem.height
23 height: highlightItem.height
24
24
25− property alias placeholderText: pinentryField.placeholderText
25+ property string placeholderText
26+ property string wrongPlaceholderText
26 property string username: ""
27 property string username: ""
27
28
28 signal entered(string passphrase)
29 signal entered(string passphrase)
@@ -73,6 +74,7 @@ Item {
73 echoMode: TextInput.Password
74 echoMode: TextInput.Password
74 opacity: 0.9
75 opacity: 0.9
75 hasClearButton: false
76 hasClearButton: false
77+ placeholderText: wrongPasswordAnimation.running ? root.wrongPlaceholderText : root.placeholderText
76
78
77 onAccepted: {
79 onAccepted: {
78 if (pinentryField.text) {
80 if (pinentryField.text) {
qml/Greeter/PinLockscreen.qml+4−1
@@ -25,6 +25,7 @@ Column {
25 spacing: units.gu(3.5)
25 spacing: units.gu(3.5)
26
26
27 property alias placeholderText: pinentryField.placeholderText
27 property alias placeholderText: pinentryField.placeholderText
28+ property alias wrongPlaceholderText: pinentryField.wrongPlaceholderText
28 property int padWidth: units.gu(34)
29 property int padWidth: units.gu(34)
29 property int padHeight: units.gu(28)
30 property int padHeight: units.gu(28)
30 property int minPinLength: -1
31 property int minPinLength: -1
@@ -57,6 +58,7 @@ Column {
57 radius: "medium"
58 radius: "medium"
58 property string text: ""
59 property string text: ""
59 property string placeholderText: ""
60 property string placeholderText: ""
61+ property string wrongPlaceholderText: ""
60
62
61 function appendChar(character) {
63 function appendChar(character) {
62 if (root.maxPinLength == -1 || pinentryField.text.length < root.maxPinLength) {
64 if (root.maxPinLength == -1 || pinentryField.text.length < root.maxPinLength) {
@@ -86,9 +88,10 @@ Column {
86 }
88 }
87 Label {
89 Label {
88 id: pinentryFieldPlaceHolder
90 id: pinentryFieldPlaceHolder
91+ objectName: "pinentryFieldPlaceHolder"
89 anchors.centerIn: parent
92 anchors.centerIn: parent
90 color: "grey"
93 color: "grey"
91− text: wrongPasswordAnimation.running ? i18n.tr("Incorrect passcode") : parent.placeholderText
94+ text: wrongPasswordAnimation.running ? parent.wrongPlaceholderText : parent.placeholderText
92 visible: pinentryFieldLabel.text.length == 0
95 visible: pinentryFieldLabel.text.length == 0
93 }
96 }
94
97
tests/qmltests/Greeter/tst_Lockscreen.qml+22
@@ -33,6 +33,7 @@ Rectangle {
33 anchors.fill: parent
33 anchors.fill: parent
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 alphaNumeric: pinPadCheckBox.checked
37 alphaNumeric: pinPadCheckBox.checked
37 minPinLength: minPinLengthTextField.text
38 minPinLength: minPinLengthTextField.text
38 maxPinLength: maxPinLengthTextField.text
39 maxPinLength: maxPinLengthTextField.text
@@ -309,6 +310,16 @@ Rectangle {
309
310
310 wait(0) // Trigger event loop to make sure the animation would start running
311 wait(0) // Trigger event loop to make sure the animation would start running
311 compare(animation.running, data.animation)
312 compare(animation.running, data.animation)
313+ if (data.animation) {
314+ if (data.alphanumeric) {
315+ tryCompare(inputField, "placeholderText", lockscreen.wrongPlaceholderText)
316+ tryCompare(inputField, "placeholderText", lockscreen.placeholderText)
317+ } else {
318+ var label = findChild(lockscreen, "pinentryFieldPlaceHolder");
319+ tryCompare(label, "text", lockscreen.wrongPlaceholderText)
320+ tryCompare(label, "text", lockscreen.placeholderText)
321+ }
322+ }
312
323
313 // wait for animation to finish to not disturb other tests
324 // wait for animation to finish to not disturb other tests
314 tryCompare(animation, "running", false)
325 tryCompare(animation, "running", false)
@@ -411,10 +422,16 @@ Rectangle {
411 var infoPopup = findChild(root, "infoPopup");
422 var infoPopup = findChild(root, "infoPopup");
412 compare(infoPopup.title, "foo");
423 compare(infoPopup.title, "foo");
413 compare(infoPopup.text, "bar");
424 compare(infoPopup.text, "bar");
425+
426+ signalSpy.signalName = "infoPopupConfirmed"
427+ signalSpy.clear();
428+
414 var okButton = findChild(root, "infoPopupOkButton");
429 var okButton = findChild(root, "infoPopupOkButton");
415 mouseClick(okButton, okButton.width / 2, okButton.height / 2);
430 mouseClick(okButton, okButton.width / 2, okButton.height / 2);
416
431
417 tryCompareFunction(function() { return findChild(root, "infoPopup") === null}, true);
432 tryCompareFunction(function() { return findChild(root, "infoPopup") === null}, true);
433+
434+ tryCompare(signalSpy, "count", 1);
418 }
435 }
419
436
420 function test_infoTextDisplay_data() {
437 function test_infoTextDisplay_data() {
@@ -433,4 +450,9 @@ Rectangle {
433 compare(label.visible, data.shown);
450 compare(label.visible, data.shown);
434 }
451 }
435 }
452 }
453+
454+ SignalSpy {
455+ id: signalSpy
456+ target: lockscreen
457+ }
436}
458}