on xenial help sign in
Make tryLockscreen work a bit better
0236a4eMichael Terry
qml/Components/Lockscreen.qml+8−2
@@ -55,6 +55,8 @@ Showable {
55 signal emergencyCall()
55 signal emergencyCall()
56 signal infoPopupConfirmed()
56 signal infoPopupConfirmed()
57
57
58+ onActiveFocusChanged: if (activeFocus && pinPadLoader.item) pinPadLoader.item.forceActiveFocus()
59+
58 function reset() {
60 function reset() {
59 // This causes the loader below to destry and recreate the source
61 // This causes the loader below to destry and recreate the source
60 pinPadLoader.resetting = true;
62 pinPadLoader.resetting = true;
@@ -92,6 +94,10 @@ Showable {
92
94
93 MouseArea {
95 MouseArea {
94 anchors.fill: root
96 anchors.fill: root
97+ onClicked: {
98+ if (pinPadLoader.item)
99+ pinPadLoader.item.forceActiveFocus()
100+ }
95 }
101 }
96
102
97 FocusScope {
103 FocusScope {
@@ -120,8 +126,8 @@ Showable {
120 onSourceChanged: {
126 onSourceChanged: {
121 waiting = false
127 waiting = false
122 showWrongText = false
128 showWrongText = false
123− if (loaderScope.activeFocus)
129+ if (loaderScope.activeFocus && pinPadLoader.item)
124− clear(false)
130+ pinPadLoader.item.forceActiveFocus()
125 }
131 }
126
132
127 Connections {
133 Connections {
qml/Components/PassphraseLockscreen.qml+2
@@ -40,6 +40,8 @@ Item {
40 }
40 }
41 }
41 }
42
42
43+ onActiveFocusChanged: if (activeFocus) pinentryField.forceActiveFocus()
44+
43 Column {
45 Column {
44 id: shakeContainer
46 id: shakeContainer
45 anchors.horizontalCenter: parent.horizontalCenter
47 anchors.horizontalCenter: parent.horizontalCenter
tests/qmltests/CMakeLists.txt+1−1
@@ -26,7 +26,7 @@ add_qml_test(Components Carousel)
26add_qml_test(Components DraggingArea)
26add_qml_test(Components DraggingArea)
27add_qml_test(Components EdgeDemoOverlay)
27add_qml_test(Components EdgeDemoOverlay)
28add_qml_test(Components LazyImage)
28add_qml_test(Components LazyImage)
29−add_qml_test(Components Lockscreen ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
29+add_qml_test(Components Lockscreen)
30add_qml_test(Components Rating)
30add_qml_test(Components Rating)
31add_qml_test(Components ResponsiveFlowView)
31add_qml_test(Components ResponsiveFlowView)
32add_qml_test(Components ResponsiveGridView)
32add_qml_test(Components ResponsiveGridView)
tests/qmltests/Components/tst_Lockscreen.qml+7−37
@@ -18,8 +18,6 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import ".."
19import ".."
20import "../../../qml/Components"
20import "../../../qml/Components"
21−import AccountsService 0.1
22−import LightDM 0.1 as LightDM
23import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
24import Unity.Test 0.1 as UT
22import Unity.Test 0.1 as UT
25
23
@@ -53,24 +51,6 @@ Rectangle {
53 }
51 }
54 }
52 }
55
53
56− function setUser(username) {
57− AccountsService.user = username
58− LightDM.Greeter.authenticate(username)
59− }
60−
61− Connections {
62− target: LightDM.Greeter
63−
64− onShowPrompt: {
65− if (AccountsService.passwordDisplayHint === AccountsService.Numeric) {
66− pinPadCheckBox.checked = false
67− } else {
68− pinPadCheckBox.checked = true
69− }
70− lockscreen.infoText = text;
71− }
72− }
73−
74 Rectangle {
54 Rectangle {
75 anchors.fill: parent
55 anchors.fill: parent
76 anchors.leftMargin: lockscreen.width
56 anchors.leftMargin: lockscreen.width
@@ -151,17 +131,6 @@ Rectangle {
151 id: enteredLabel
131 id: enteredLabel
152 }
132 }
153 }
133 }
154− Button {
155− text: "start auth (1234)"
156− width: parent.width
157− onClicked: setUser("has-pin")
158− }
159− Button {
160− text: "start auth (password)"
161− width: parent.width
162− onClicked: setUser("has-password")
163− }
164−
165 TextField {
134 TextField {
166 id: infoTextTextField
135 id: infoTextTextField
167 width: parent.width
136 width: parent.width
@@ -262,11 +231,11 @@ Rectangle {
262
231
263 function test_unlock_data() {
232 function test_unlock_data() {
264 return [
233 return [
265− {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: 4, maxPinLength: 4},
234+ {tag: "numeric", alphanumeric: false, password: "1234", minPinLength: 4, maxPinLength: 4},
266− {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", minPinLength: -1, maxPinLength: -1},
235+ {tag: "alphanumeric", alphanumeric: true, password: "password", minPinLength: -1, maxPinLength: -1},
267− {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", minPinLength: 4, maxPinLength: 4},
236+ {tag: "numeric (wrong)", alphanumeric: false, password: "4321", minPinLength: 4, maxPinLength: 4},
268− {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", minPinLength: -1, maxPinLength: -1},
237+ {tag: "alphanumeric (wrong)", alphanumeric: true, password: "drowssap", minPinLength: -1, maxPinLength: -1},
269− {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: -1, maxPinLength: -1},
238+ {tag: "flexible length", alphanumeric: false, password: "1234", minPinLength: -1, maxPinLength: -1},
270 ]
239 ]
271 }
240 }
272
241
@@ -274,7 +243,8 @@ Rectangle {
274 enteredLabel.text = ""
243 enteredLabel.text = ""
275 minPinLengthTextField.text = data.minPinLength
244 minPinLengthTextField.text = data.minPinLength
276 maxPinLengthTextField.text = data.maxPinLength
245 maxPinLengthTextField.text = data.maxPinLength
277− setUser(data.username)
246+ pinPadCheckBox.checked = data.alphanumeric
247+ infoTextTextField.text = "Enter " + (data.alphanumeric ? "passphrase" : "passcode")
278 waitForLockscreenReady();
248 waitForLockscreenReady();
279
249
280 var inputField = findChild(lockscreen, "pinentryField")
250 var inputField = findChild(lockscreen, "pinentryField")