on xenial help sign in
new lockscreen design
4807570Michael Zanetti
qml/Components/Lockscreen.qml+29−75
@@ -24,15 +24,14 @@ Showable {
24 // Determine if a numeric or alphanumeric pad is used.
24 // Determine if a numeric or alphanumeric pad is used.
25 property bool alphaNumeric: false
25 property bool alphaNumeric: false
26
26
27− // Placeholder text
27+ // Informational text. (e.g. some text to tell which domain this is pin is entered for)
28− property string placeholderText: ""
29− // Placeholder text while shaking (e.g. Incorrect passprase)
30− property string wrongPlaceholderText: ""
28+ property string infoText: ""
29+
31 // Retries text (e.g. 3 retries left)
30 // Retries text (e.g. 3 retries left)
32 property string retryText: ""
31 property string retryText: ""
33
32
34− // Informational text. (e.g. some text to tell which domain this is pin is entered for.
33+ // The text to be displayed in case the login failed
35− property string infoText: ""
34+ property string errorText: ""
36
35
37 // In case the Lockscreen can show a greeter message, this is the username
36 // In case the Lockscreen can show a greeter message, this is the username
38 property string username: ""
37 property string username: ""
@@ -41,10 +40,7 @@ Showable {
41 // If both are unset, the Lockscreen will show a confirm button and allow typing any length of pin before
40 // If both are unset, the Lockscreen will show a confirm button and allow typing any length of pin before
42 // confirming. If minPinLength is set to a value > 0, the confirm button will only become active when the
41 // confirming. If minPinLength is set to a value > 0, the confirm button will only become active when the
43 // entered pin is at least that long. If maxPinLength is set, the lockscreen won't allow entering any
42 // entered pin is at least that long. If maxPinLength is set, the lockscreen won't allow entering any
44− // more numbers than that. If both are set to the same value, the lockscreen will enter auto confirming
43+ // more numbers than that.
45− // behavior, hiding the confirmation button and triggering that automatically when the entered pin reached
46− // that length. This is ignored by the alphaNumeric lockscreen as that one is always confirmed by pressing
47− // enter on the OSK.
48 property int minPinLength: -1
44 property int minPinLength: -1
49 property int maxPinLength: -1
45 property int maxPinLength: -1
50
46
@@ -110,41 +106,6 @@ Showable {
110 anchors.fill: root
106 anchors.fill: root
111 }
107 }
112
108
113− Column {
114− spacing: units.gu(2)
115− anchors {
116− left: parent.left
117− right: parent.right
118− bottom: pinPadLoader.top
119− bottomMargin: units.gu(2)
120− }
121− Label {
122− objectName: "retryCountLabel"
123− anchors {
124− left: parent.left
125− right: parent.right
126− }
127− text: root.retryText
128− horizontalAlignment: Text.AlignHCenter
129− color: "#f3f3e7"
130− opacity: 0.6
131− visible: root.retryText.length > 0
132− }
133− Label {
134− id: infoTextLabel
135− objectName: "infoTextLabel"
136− anchors {
137− left: parent.left
138− right: parent.right
139− }
140− text: root.infoText
141− horizontalAlignment: Text.AlignHCenter
142− color: "#f3f3e7"
143− opacity: 0.6
144− visible: root.infoText.length > 0
145− }
146− }
147−
148 Loader {
109 Loader {
149 id: pinPadLoader
110 id: pinPadLoader
150 objectName: "pinPadLoader"
111 objectName: "pinPadLoader"
@@ -152,7 +113,7 @@ Showable {
152 left: parent.left
113 left: parent.left
153 right: parent.right
114 right: parent.right
154 verticalCenter: parent.verticalCenter
115 verticalCenter: parent.verticalCenter
155− verticalCenterOffset: root.alphaNumeric ? -units.gu(10) : -units.gu(4)
116+ verticalCenterOffset: root.alphaNumeric ? -units.gu(10) : 0
156 }
117 }
157 property bool resetting: false
118 property bool resetting: false
158 property bool waiting: false
119 property bool waiting: false
@@ -193,10 +154,18 @@ Showable {
193 }
154 }
194 Binding {
155 Binding {
195 target: pinPadLoader.item
156 target: pinPadLoader.item
196− property: "placeholderText"
157+ property: "infoText"
197− value: forcedDelayTimer.running ? pinPadLoader.forcedDelayText :
158+ value: root.infoText
198− (pinPadLoader.showWrongText ? root.wrongPlaceholderText :
159+ }
199− root.placeholderText)
160+ Binding {
161+ target: pinPadLoader.item
162+ property: "retryText"
163+ value: root.retryText
164+ }
165+ Binding {
166+ target: pinPadLoader.item
167+ property: "errorText"
168+ value: root.errorText
200 }
169 }
201 Binding {
170 Binding {
202 target: pinPadLoader.item
171 target: pinPadLoader.item
@@ -210,8 +179,9 @@ Showable {
210 }
179 }
211 }
180 }
212
181
213− Column {
182+ Label {
214− id: emergencyCallColumn
183+ id: emergencyCallLabel
184+ objectName: "emergencyCallLabel"
215
185
216 // FIXME: We *should* show emergency dialer if there is a SIM present,
186 // FIXME: We *should* show emergency dialer if there is a SIM present,
217 // regardless of whether the side stage is enabled. But right now,
187 // regardless of whether the side stage is enabled. But right now,
@@ -223,37 +193,21 @@ Showable {
223 visible: !shell.sideStageEnabled
193 visible: !shell.sideStageEnabled
224
194
225 anchors {
195 anchors {
226− left: parent.left
227 bottom: parent.bottom
196 bottom: parent.bottom
228 bottomMargin: units.gu(4)
197 bottomMargin: units.gu(4)
229− right: parent.right
230− }
231− height: childrenRect.height
232− spacing: units.gu(1)
233−
234− Icon {
235− objectName: "emergencyCallIcon"
236− height: units.gu(3)
237− width: height
238− anchors.horizontalCenter: parent.horizontalCenter
198+ horizontalCenter: parent.horizontalCenter
239− name: "phone-app-call-symbolic"
240− color: "#f3f3e7"
241− opacity: 0.6
242 }
199 }
243
200
244− Label {
245− text: i18n.tr("Emergency Call")
201+ text: i18n.tr("Emergency Call")
246− color: "#f3f3e7"
202+ color: "#f3f3e7"
247− opacity: 0.6
203+ opacity: 0.6
248− fontSize: "medium"
204+ fontSize: "small"
249− anchors.horizontalCenter: parent.horizontalCenter
250− }
251 }
205 }
252
206
253 MouseArea {
207 MouseArea {
254− anchors.fill: emergencyCallColumn
208+ anchors.fill: emergencyCallLabel
255 onClicked: root.emergencyCall()
209 onClicked: root.emergencyCall()
256− enabled: emergencyCallColumn.visible
210+ enabled: emergencyCallLabel.visible
257 }
211 }
258
212
259 Component {
213 Component {
qml/Components/PassphraseLockscreen.qml+2−3
@@ -22,7 +22,7 @@ Item {
22 id: root
22 id: root
23 height: highlightItem.height
23 height: highlightItem.height
24
24
25− property string placeholderText
25+ property string infoText
26 property string username: ""
26 property string username: ""
27 property bool entryEnabled: true
27 property bool entryEnabled: true
28
28
@@ -75,8 +75,7 @@ Item {
75 echoMode: TextInput.Password
75 echoMode: TextInput.Password
76 opacity: 0.9
76 opacity: 0.9
77 hasClearButton: false
77 hasClearButton: false
78− enabled: entryEnabled
79− placeholderText: root.placeholderText
78+ placeholderText: root.infoText
80
79
81 onAccepted: {
80 onAccepted: {
82 if (pinentryField.text) {
81 if (pinentryField.text) {
qml/Components/PinLockscreen.qml+133−157
@@ -22,9 +22,11 @@ import "../Components"
22Column {
22Column {
23 id: root
23 id: root
24 anchors.centerIn: parent
24 anchors.centerIn: parent
25− spacing: units.gu(3.5)
25+ spacing: units.gu(2)
26
26
27− property alias placeholderText: pinentryField.placeholderText
27+ property string infoText
28+ property string retryText
29+ property string errorText
28 property int padWidth: units.gu(34)
30 property int padWidth: units.gu(34)
29 property int padHeight: units.gu(28)
31 property int padHeight: units.gu(28)
30 property int minPinLength: -1
32 property int minPinLength: -1
@@ -35,199 +37,173 @@ Column {
35
37
36 property bool entryEnabled: true
38 property bool entryEnabled: true
37
39
38− function clear(playAnimation) {
40+ function clear(showAnimation) {
39 pinentryField.text = "";
41 pinentryField.text = "";
40− if (playAnimation) {
42+ if (showAnimation) {
43+ pinentryField.incorrectOverride = true;
41 wrongPasswordAnimation.start();
44 wrongPasswordAnimation.start();
42 }
45 }
43 }
46 }
44
47
45− QtObject {
48+ Label {
46− id: priv
49+ id: infoField
47− property bool autoConfirm: root.minPinLength == root.maxPinLength && root.minPinLength != -1
50+ objectName: "infoTextLabel"
51+ fontSize: "large"
52+ color: "#f3f3e7"
53+ anchors.horizontalCenter: parent.horizontalCenter
54+ text: root.infoText
48 }
55 }
49
56
50− UbuntuShape {
57+ Item {
51− id: pinentryField
58+ id: pinContainer
52− objectName: "pinentryField"
59+ anchors { left: parent.left; right: parent.right; margins: units.gu(2) }
53− anchors.horizontalCenter: parent.horizontalCenter
54− color: "#55000000"
55− width:root.padWidth
56− height: units.gu(5)
60+ height: units.gu(4)
57− radius: "medium"
58− property string text: ""
59− property string placeholderText: ""
60−
61− function appendChar(character) {
62− if (root.maxPinLength == -1 || pinentryField.text.length < root.maxPinLength) {
63− pinentryField.text = pinentryField.text + character;
64− }
65− }
66
61
67− onTextChanged: {
62+ Row {
68− pinentryFieldLabel.text = "";
63+ id: pinentryField
64+ objectName: "pinentryField"
65+ anchors.horizontalCenter: parent.horizontalCenter
66+ anchors.verticalCenter: parent.verticalCenter
67+ spacing: Math.max(0, Math.min(units.gu(3), (parent.width / root.maxPinLength) - units.gu(3)))
68+
69+ property string text
70+ property bool incorrectOverride: false
71+
72+ Repeater {
69− for (var i = 0; i < text.length; ++i) {
73+ model: pinentryField.text.length
70− pinentryFieldLabel.text += "•";
74+ delegate: Rectangle {
75+ color: "#f3f3e7"
76+ width: Math.min(units.gu(2), (pinContainer.width - pinContainer.height*2 ) / (root.maxPinLength >= 0 ? root.maxPinLength : 16))
77+ height: width
78+ radius: width / 2
79+ }
71 }
80 }
72− if (priv.autoConfirm && text.length === root.maxPinLength) {
81+
73− root.entered(text);
82+ function appendNumber(number) {
83+ if (incorrectOverride) {
84+ incorrectOverride = false;
85+ }
86+
87+ pinentryField.text = pinentryField.text + number
74 }
88 }
75− }
76
89
77− Label {
90+ function backspace() {
78− id: pinentryFieldLabel
91+ pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1)
79− anchors.centerIn: parent
92+ }
80− width: parent.width - (backspaceIcon.width + backspaceIcon.anchors.rightMargin) * 2
81− elide: Text.ElideMiddle
82− horizontalAlignment: Text.AlignHCenter
83− font.pixelSize: units.dp(44)
84− color: "#f3f3e7"
85− opacity: 0.6
86 }
93 }
87 Label {
94 Label {
88− id: pinentryFieldPlaceHolder
95+ id: wrongNoticeLabel
89− objectName: "pinentryFieldPlaceHolder"
96+ objectName: "wrongNoticeLabel"
90− anchors.centerIn: parent
97+ fontSize: "x-large"
91− horizontalAlignment: Text.AlignHCenter
92 color: "#f3f3e7"
98 color: "#f3f3e7"
93− opacity: 0.6
99+ anchors.horizontalCenter: parent.horizontalCenter
94− text: parent.placeholderText
100+ text: root.errorText
95− visible: pinentryFieldLabel.text.length == 0
101+ visible: pinentryField.incorrectOverride
96 }
102 }
97
103
98− Icon {
104+ AbstractButton {
99− id: backspaceIcon
100 objectName: "backspaceIcon"
105 objectName: "backspaceIcon"
101− anchors {
102− top: parent.top
103− topMargin: units.gu(1)
104− right: parent.right
105− rightMargin: units.gu(2)
106− bottom: parent.bottom
106+ anchors { right: parent.right; top: parent.top; bottom: parent.bottom }
107− bottomMargin: units.gu(1)
108− }
109− visible: entryEnabled && !priv.autoConfirm
110 width: height
107 width: height
111− name: "erase"
108+
112− color: "#f3f3e7"
109+ Icon {
113− opacity: 0.6
114− MouseArea {
115 anchors.fill: parent
110 anchors.fill: parent
116− onClicked: pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1);
111+ name: "erase"
112+ color: "#f3f3e7"
117 }
113 }
118− }
119− }
120
114
121− UbuntuShape {
115+ opacity: (pinentryField.text.length && !pinentryField.incorrectOverride) > 0 ? 1 : 0
122− anchors {
116+
123− left: parent.left
117+ Behavior on opacity {
124− right: parent.right
118+ UbuntuNumberAnimation {}
125− margins: (parent.width - root.padWidth) / 2
126− }
127− height: root.padHeight
128− color: "#55000000"
129− radius: "medium"
130−
131− ThinDivider {
132− anchors {
133− left: parent.left
134− right: parent.right
135− top: parent.top
136− topMargin: root.padHeight / 4
137− }
138− }
139− ThinDivider {
140− anchors {
141− left: parent.left
142− right: parent.right
143− verticalCenter: parent.verticalCenter
144− }
145− }
146− ThinDivider {
147− anchors {
148− left: parent.left
149− right: parent.right
150− bottom: parent.bottom
151− bottomMargin: root.padHeight / 4
152 }
119 }
153− }
154
120
155− ThinDivider {
121+ onClicked: pinentryField.backspace()
156− anchors.centerIn: parent
157− anchors.horizontalCenterOffset: -root.padWidth / 6
158− width: root.padHeight
159− rotation: -90
160− }
161− ThinDivider {
162− anchors.centerIn: parent
163− anchors.horizontalCenterOffset: root.padWidth / 6
164− width: root.padHeight
165− rotation: -90
166 }
122 }
123+ }
167
124
168− Grid {
169− anchors {
170− left: parent.left
171− right: parent.right
172− margins: (parent.width - root.padWidth) / 2
173− }
174
125
175− columns: 3
126+ Label {
127+ objectName: "retryLabel"
128+ fontSize: "x-small"
129+ color: "#f3f3e7"
130+ anchors.horizontalCenter: parent.horizontalCenter
131+ text: root.retryText
132+ }
176
133
177− Repeater {
134+ ThinDivider {
178− model: 9
135+ anchors { left: parent.left; right: parent.right; margins: units.gu(2) }
179−
180− PinPadButton {
181− objectName: "pinPadButton" + (index + 1)
182− width: root.padWidth / 3
183− height: root.padHeight / 4
184− text: index + 1
185− enabled: entryEnabled
186−
187− onClicked: {
188− pinentryField.appendChar(text);
189− }
190− }
191− }
136+ }
192
137
193− PinPadButton {
138+ Grid {
194− objectName: "pinPadButtonBack"
139+ id: numbersGrid
195− width: root.padWidth / 3
140+ anchors { horizontalCenter: parent.horizontalCenter }
196− height: root.padHeight / 4
141+ columns: 3
197− subText: i18n.tr("CANCEL")
198− onClicked: root.cancel();
199− }
200
142
201− PinPadButton {
143+ property int buttonHeight: units.gu(8)
202− objectName: "pinPadButton0"
144+ property int buttonWidth: units.gu(12)
203− width: root.padWidth / 3
145+
204− height: root.padHeight / 4
146+ Repeater {
205− text: "0"
147+ model: 9
206− onClicked: pinentryField.appendChar(text);
207− enabled: entryEnabled
208− }
209
148
210 PinPadButton {
149 PinPadButton {
211− objectName: "pinPadButtonErase"
150+ objectName: "pinPadButton" + text
212− width: root.padWidth / 3
151+ text: index + 1
213− height: root.padHeight / 4
152+ height: numbersGrid.buttonHeight
214− iconName: priv.autoConfirm ? "erase" : ""
153+ width: numbersGrid.buttonWidth
215− subText: priv.autoConfirm ? "" : i18n.tr("DONE")
154+ enabled: root.maxPinLength == -1 ||
155+ pinentryField.text.length < root.maxPinLength ||
156+ pinentryField.incorrectOverride
157+
216 onClicked: {
158 onClicked: {
217− if (priv.autoConfirm) {
159+ pinentryField.appendNumber(index + 1)
218− pinentryField.text = pinentryField.text.substring(0, pinentryField.text.length-1);
219− } else {
220− root.entered(pinentryField.text);
221− }
222 }
160 }
223− enabled: priv.autoConfirm ? entryEnabled : pinentryField.text.length >= root.minPinLength
224 }
161 }
225 }
162 }
163+ Item {
164+ height: numbersGrid.buttonHeight
165+ width: numbersGrid.buttonWidth
226− }
166+ }
167+ PinPadButton {
168+ text: "0"
169+ height: numbersGrid.buttonHeight
170+ width: numbersGrid.buttonWidth
171+ enabled: root.maxPinLength == -1 ||
172+ pinentryField.text.length < root.maxPinLength ||
173+ pinentryField.incorrectOverride
174+
175+ onClicked: {
176+ pinentryField.appendNumber(0)
177+ }
178+ }
179+ Item {
180+ height: numbersGrid.buttonHeight
181+ width: numbersGrid.buttonWidth
182+ }
183+ PinPadButton {
184+ iconName: "close"
185+ height: numbersGrid.buttonHeight
186+ width: numbersGrid.buttonWidth
227
187
188+ onClicked: root.cancel()
189+ }
190+ Item {
191+ height: numbersGrid.buttonHeight
192+ width: numbersGrid.buttonWidth
193+ }
194+ PinPadButton {
195+ iconName: "tick"
196+ objectName: "confirmButton"
197+ height: numbersGrid.buttonHeight
198+ width: numbersGrid.buttonWidth
199+ enabled: pinentryField.text.length >= root.minPinLength
200+
201+ onClicked: root.entered(pinentryField.text)
202+ }
203+ }
228 WrongPasswordAnimation {
204 WrongPasswordAnimation {
229 id: wrongPasswordAnimation
205 id: wrongPasswordAnimation
230 objectName: "wrongPasswordAnimation"
206 objectName: "wrongPasswordAnimation"
231− target: pinentryField
207+ target: root
232 }
208 }
233}
209}
qml/Components/PinPadButton.qml+31−45
@@ -15,62 +15,48 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
19
19
20−Item {
20+AbstractButton {
21 id: root
21 id: root
22 opacity: enabled ? 1 : 0.6
22 opacity: enabled ? 1 : 0.6
23
23
24 property alias text: label.text
24 property alias text: label.text
25− property alias subText: subTextLabel.text
26 property string iconName
25 property string iconName
27
26
28− signal clicked()
27+ UbuntuShape {
28+ anchors.fill: parent
29+ opacity: root.pressed ? 1 : 0
30+ Behavior on opacity {
31+ UbuntuNumberAnimation {}
32+ }
33+ }
29
34
30− Column {
35+ Label {
36+ id: label
31 anchors.centerIn: parent
37 anchors.centerIn: parent
32− width: parent.width
33− height: childrenRect.height
34−
35− Item {
36− anchors {
37− left: parent.left
38− right: parent.right
39− }
40− height: label.visible || icon.visible ? Math.max(label.height, icon.height) : 0
41−
42− Label {
43− id: label
44− anchors.centerIn: parent
45− width: parent.width
46− horizontalAlignment: Text.AlignHCenter
38+ horizontalAlignment: Text.AlignHCenter
47− color: "#f3f3e7"
39+ color: "#f3f3e7"
48− fontSize: "large"
40+ fontSize: "x-large"
49− font.weight: Font.DemiBold
41+ font.weight: Font.DemiBold
50− visible: text.length > 0
42+ visible: text.length > 0
51− }
43+ scale: root.pressed ? 0.9 : 1
52−
44+ Behavior on scale {
53− Icon {
45+ UbuntuNumberAnimation {}
54− id: icon
55− height: units.gu(3)
56− width: height
57− anchors.centerIn: parent
58− name: root.iconName
59− color: "#f3f3e7"
60− visible: name.length > 0
61− }
62− }
63− Label {
64− id: subTextLabel
65− fontSize: "small"
66− color: "#f3f3e7"
67− anchors.horizontalCenter: parent.horizontalCenter
68− visible: text.length > 0
69 }
46 }
70 }
47 }
71
48
72− MouseArea {
49+ Icon {
50+ id: icon
51+ height: units.gu(3)
52+ width: height
73− anchors.fill: parent
53+ anchors.centerIn: parent
74− onClicked: root.clicked()
54+ name: root.iconName
55+ color: "#f3f3e7"
56+ visible: name.length > 0
57+ scale: root.pressed ? 0.9 : 1
58+ Behavior on scale {
59+ UbuntuNumberAnimation { duration: UbuntuAnimation.SlowDuration }
60+ }
75 }
61 }
76}
62}
qml/Notifications/NotificationMenuItemFactory.qml+4−1
@@ -117,7 +117,10 @@ Loader {
117 right: parent.right
117 right: parent.right
118 }
118 }
119 height: menuFactory.maxHeight
119 height: menuFactory.maxHeight
120− placeholderText: i18n.tr("Please enter SIM PIN")
120+ infoText: i18n.tr("Please enter SIM PIN")
121+ errorText: i18n.tr("Sorry, incorrect PIN")
122+ minPinLength: 4
123+ maxPinLength: 8
121 background: shell.background
124 background: shell.background
122
125
123 onEntered: {
126 onEntered: {
qml/Shell.qml+2−4
@@ -266,10 +266,8 @@ Item {
266 promptText = lockscreen.alphaNumeric ?
266 promptText = lockscreen.alphaNumeric ?
267 i18n.tr("passphrase") : i18n.tr("passcode")
267 i18n.tr("passphrase") : i18n.tr("passcode")
268 }
268 }
269− lockscreen.placeholderText = i18n.tr("Enter your %1").arg(promptText)
269+ lockscreen.infoText = i18n.tr("Enter your %1").arg(promptText)
270− lockscreen.wrongPlaceholderText = i18n.tr("Incorrect %1").arg(promptText) +
270+ lockscreen.errorText = i18n.tr("Incorrect %1").arg(promptText)
271− "\n" +
272− i18n.tr("Please re-enter")
273 lockscreen.show();
271 lockscreen.show();
274 }
272 }
275 }
273 }
tests/qmltests/Greeter/tst_Lockscreen.qml+55−48
@@ -26,22 +26,21 @@ import Unity.Test 0.1 as UT
26Rectangle {
26Rectangle {
27 id: root
27 id: root
28 width: units.gu(80)
28 width: units.gu(80)
29− height: units.gu(80)
29+ height: units.gu(70)
30 color: "orange"
30 color: "orange"
31
31
32 Lockscreen {
32 Lockscreen {
33 id: lockscreen
33 id: lockscreen
34 anchors.fill: parent
34 anchors.fill: parent
35− anchors.rightMargin: units.gu(30)
35+ anchors.rightMargin: units.gu(40)
36− placeholderText: "Please enter your PIN"
36+ infoText: infoTextTextField.text
37− wrongPlaceholderText: "Incorrect PIN"
38 retryText: retryCountTextField.text
37 retryText: retryCountTextField.text
38+ errorText: errorTextTextField.text
39 alphaNumeric: pinPadCheckBox.checked
39 alphaNumeric: pinPadCheckBox.checked
40 minPinLength: minPinLengthTextField.text
40 minPinLength: minPinLengthTextField.text
41 maxPinLength: maxPinLengthTextField.text
41 maxPinLength: maxPinLengthTextField.text
42 username: "Lola"
42 username: "Lola"
43 background: "../../../qml/graphics/phone_background.jpg"
43 background: "../../../qml/graphics/phone_background.jpg"
44− infoText: infoTextTextField.text
45 }
44 }
46
45
47 Connections {
46 Connections {
@@ -68,7 +67,7 @@ Rectangle {
68 } else {
67 } else {
69 pinPadCheckBox.checked = true
68 pinPadCheckBox.checked = true
70 }
69 }
71− lockscreen.placeholderText = text;
70+ lockscreen.infoText = text;
72 }
71 }
73 }
72 }
74
73
@@ -157,7 +156,14 @@ Rectangle {
157 id: infoTextTextField
156 id: infoTextTextField
158 width: parent.width
157 width: parent.width
159 placeholderText: "Infotext"
158 placeholderText: "Infotext"
160− text: "+49 179 3253553"
159+ text: "Enter SIM1 PIN"
160+ }
161+
162+ TextField {
163+ id: errorTextTextField
164+ width: parent.width
165+ placeholderText: "Error text"
166+ text: "Sorry, incorrect PIN"
161 }
167 }
162
168
163 TextField {
169 TextField {
@@ -223,7 +229,7 @@ Rectangle {
223 emergencyCheckBox.checked = false
229 emergencyCheckBox.checked = false
224 pinPadCheckBox.checked = data.alphanumeric
230 pinPadCheckBox.checked = data.alphanumeric
225 waitForLockscreenReady();
231 waitForLockscreenReady();
226− var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
232+ var emergencyButton = findChild(lockscreen, "emergencyCallLabel")
227 mouseClick(emergencyButton, units.gu(1), units.gu(1))
233 mouseClick(emergencyButton, units.gu(1), units.gu(1))
228 tryCompare(emergencyCheckBox, "checked", true)
234 tryCompare(emergencyCheckBox, "checked", true)
229
235
@@ -231,18 +237,20 @@ Rectangle {
231
237
232 function test_labels_data() {
238 function test_labels_data() {
233 return [
239 return [
234− {tag: "numeric", alphanumeric: false, placeholderText: "Please enter your PIN", username: "foobar" },
240+ {tag: "numeric", alphanumeric: false, infoText: "Please enter your PIN", username: "foobar" },
235− {tag: "alphanumeric", alphanumeric: true, placeholderText: "Please enter your password", username: "Lola" }
241+ {tag: "alphanumeric", alphanumeric: true, infoText: "Please enter your password", username: "Lola" }
236 ]
242 ]
237 }
243 }
238
244
239 function test_labels(data) {
245 function test_labels(data) {
240 pinPadCheckBox.checked = data.alphanumeric
246 pinPadCheckBox.checked = data.alphanumeric
241− lockscreen.placeholderText = data.placeholderText
247+ lockscreen.infoText = data.infoText
242 waitForLockscreenReady();
248 waitForLockscreenReady();
243− compare(findChild(lockscreen, "pinentryField").placeholderText, data.placeholderText, "Placeholdertext is not what it should be")
244 if (data.alphanumeric) {
249 if (data.alphanumeric) {
250+ compare(findChild(lockscreen, "pinentryField").placeholderText, data.infoText, "Placeholdertext is not what it should be")
245 compare(findChild(lockscreen, "greeterLabel").text, "Hello " + data.username, "Greeter is not set correctly")
251 compare(findChild(lockscreen, "greeterLabel").text, "Hello " + data.username, "Greeter is not set correctly")
252+ } else {
253+ compare(findChild(lockscreen, "infoTextLabel").text, data.infoText, "Placeholdertext is not what it should be")
246 }
254 }
247 }
255 }
248
256
@@ -276,10 +284,8 @@ Rectangle {
276 var button = findChild(lockscreen, "pinPadButton" + character)
284 var button = findChild(lockscreen, "pinPadButton" + character)
277 mouseClick(button, units.gu(1), units.gu(1))
285 mouseClick(button, units.gu(1), units.gu(1))
278 }
286 }
279− if (data.minPinLength !== data.maxPinLength || data.minPinLength == -1) {
280− var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
287+ var confirmButton = findChild(lockscreen, "confirmButton");
281− mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
288+ mouseClick(confirmButton, units.gu(1), units.gu(1));
282− }
283 }
289 }
284 tryCompare(enteredLabel, "text", data.password)
290 tryCompare(enteredLabel, "text", data.password)
285 }
291 }
@@ -317,11 +323,9 @@ Rectangle {
317 wait(0) // Trigger event loop to make sure the animation would start running
323 wait(0) // Trigger event loop to make sure the animation would start running
318 compare(animation.running, data.animation)
324 compare(animation.running, data.animation)
319 if (data.animation) {
325 if (data.animation) {
320− if (data.alphanumeric) {
326+ if (!data.alphanumeric) {
321− tryCompare(inputField, "placeholderText", lockscreen.wrongPlaceholderText)
322− } else {
323− var label = findChild(lockscreen, "pinentryFieldPlaceHolder");
327+ var label = findChild(lockscreen, "wrongNoticeLabel");
324− tryCompare(label, "text", lockscreen.wrongPlaceholderText)
328+ tryCompare(label, "visible", true)
325 }
329 }
326 }
330 }
327
331
@@ -343,24 +347,21 @@ Rectangle {
343 maxPinLengthTextField.text = data.maxPinLength
347 maxPinLengthTextField.text = data.maxPinLength
344 waitForLockscreenReady();
348 waitForLockscreenReady();
345
349
346− var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
347 var backspaceIcon = findChild(lockscreen, "backspaceIcon");
350 var backspaceIcon = findChild(lockscreen, "backspaceIcon");
348 var pinEntryField = findChild(lockscreen, "pinentryField");
351 var pinEntryField = findChild(lockscreen, "pinentryField");
349
352
350− var autoConfirmEnabled = data.minPinLength === data.maxPinLength && data.minPinLength !== -1;
351− compare(pinPadButtonErase.iconName, autoConfirmEnabled ? "erase" : "");
352− compare(backspaceIcon.visible, !autoConfirmEnabled);
353+ compare(backspaceIcon.opacity, 0);
353
354
354 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
355 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
355 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
356 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
356 compare(pinEntryField.text, "5");
357 compare(pinEntryField.text, "5");
357
358
358− if (data.minPinLength !== data.maxPinLength) {
359− mouseClick(backspaceIcon, units.gu(1), units.gu(1));
359+ tryCompare(backspaceIcon, "opacity", 1);
360− } else {
360+
361− mouseClick(pinPadButtonErase, units.gu(1), units.gu(1));
361+ mouseClick(backspaceIcon, units.gu(1), units.gu(1));
362− }
363 compare(pinEntryField.text, "");
362 compare(pinEntryField.text, "");
363+
364+ tryCompare(backspaceIcon, "opacity", 0);
364 }
365 }
365
366
366 function test_minMaxLength_data() {
367 function test_minMaxLength_data() {
@@ -378,32 +379,38 @@ Rectangle {
378 waitForLockscreenReady();
379 waitForLockscreenReady();
379
380
380 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
381 var pinPadButton5 = findChild(lockscreen, "pinPadButton5");
381− var pinPadButtonErase = findChild(lockscreen, "pinPadButtonErase");
382+ var backspaceButton = findChild(lockscreen, "backspaceIcon");
383+ var confirmButton = findChild(lockscreen, "confirmButton");
382 var inputField = findChild(lockscreen, "pinentryField")
384 var inputField = findChild(lockscreen, "pinentryField")
383
385
386+ tryCompare(backspaceButton, "opacity", 0)
387+
384 for (var i = 0; i < 10; i++) {
388 for (var i = 0; i < 10; i++) {
385 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
389 mouseClick(pinPadButton5, units.gu(1), units.gu(1));
390+ tryCompare(backspaceButton, "opacity", 1)
386
391
387− if (data.minPinLength == data.maxPinLength && data.minPinLength != -1) {
392+ if (data.maxPinLength == -1) {
388− // auto confirm mode...
393+ // Undefined maxLength... make sure all presses are recorded
389− compare(inputField.text.length, (i+1) % data.minPinLength);
394+ compare(inputField.text.length, i+1);
390 } else {
395 } else {
391− // manual confirm mode
396+ // We have a max length. Make sure we're only accepting maxLength presses
392− tryCompare(pinPadButtonErase, "enabled", (i+1) >= data.minPinLength)
393− if (data.maxPinLength == -1) {
394− compare(inputField.text.length, i+1);
395− } else {
396− compare(inputField.text.length, Math.min(data.maxPinLength, i+1));
397+ compare(inputField.text.length, Math.min(data.maxPinLength, i+1));
397− }
398+ }
398
399
400+ if (data.minPinLength == -1) {
401+ // Undefined minLength. Make sure confirm button is always enabled
402+ compare(confirmButton.enabled, true);
403+ } else {
404+ // We have a min length. Make sure the confirm button is only enabled when met.
405+ compare(confirmButton.enabled, (i+1) >= data.minPinLength);
399 }
406 }
400 }
407 }
401 }
408 }
402
409
403 function test_retryDisplay_data() {
410 function test_retryDisplay_data() {
404 return [
411 return [
405− {tag: "empty", retryText: "", shown: false},
412+ {tag: "empty", retryText: ""},
406− {tag: "3 retries left", retryText: "3 retries left", shown: true},
413+ {tag: "3 retries left", retryText: "3 retries left"},
407 ]
414 ]
408 }
415 }
409
416
@@ -412,8 +419,8 @@ Rectangle {
412 waitForLockscreenReady();
419 waitForLockscreenReady();
413
420
414 retryCountTextField.text = data.retryText;
421 retryCountTextField.text = data.retryText;
415− var label = findChild(lockscreen, "retryCountLabel")
422+ var label = findChild(lockscreen, "retryLabel")
416− compare(label.visible, data.shown);
423+ compare(label.text, data.retryText);
417 }
424 }
418
425
419 function test_infoPopup() {
426 function test_infoPopup() {
@@ -438,8 +445,8 @@ Rectangle {
438
445
439 function test_infoTextDisplay_data() {
446 function test_infoTextDisplay_data() {
440 return [
447 return [
441− {tag: "empty string", text: "", shown: false},
448+ {tag: "empty string", text: ""},
442− {tag: "hello world", text: "hello world", shown: true},
449+ {tag: "hello world", text: "hello world"},
443 ]
450 ]
444 }
451 }
445
452
@@ -449,7 +456,7 @@ Rectangle {
449
456
450 infoTextTextField.text = data.text;
457 infoTextTextField.text = data.text;
451 var label = findChild(lockscreen, "infoTextLabel")
458 var label = findChild(lockscreen, "infoTextLabel")
452− compare(label.visible, data.shown);
459+ compare(label.text, data.text);
453 }
460 }
454 }
461 }
455
462