on xenial help sign in
Make tryLockscreen work a bit better
commit0236a4e55667fb921a37c17e15319ea4c480c266 authorMichael Terry <michael.terry@canonical.com> dateWed 24 Sep 2014, 15:30 (12 years ago) parent0ee1422
4 files changed+18−40
qml/Components/Lockscreen.qml+8−2 qml/Components/PassphraseLockscreen.qml+2 tests/qmltests/CMakeLists.txt+1−1 tests/qmltests/Components/tst_Lockscreen.qml+7−37
qml/Components/Lockscreen.qml+8−2
@@ -55,6 +55,8 @@ Showable {
5555 signal emergencyCall()
5656 signal infoPopupConfirmed()
5757
58+ onActiveFocusChanged: if (activeFocus && pinPadLoader.item) pinPadLoader.item.forceActiveFocus()
59+
5860 function reset() {
5961 // This causes the loader below to destry and recreate the source
6062 pinPadLoader.resetting = true;
@@ -92,6 +94,10 @@ Showable {
9294
9395 MouseArea {
9496 anchors.fill: root
97+ onClicked: {
98+ if (pinPadLoader.item)
99+ pinPadLoader.item.forceActiveFocus()
100+ }
95101 }
96102
97103 FocusScope {
@@ -120,8 +126,8 @@ Showable {
120126 onSourceChanged: {
121127 waiting = false
122128 showWrongText = false
123− if (loaderScope.activeFocus)
124− clear(false)
129+ if (loaderScope.activeFocus && pinPadLoader.item)
130+ pinPadLoader.item.forceActiveFocus()
125131 }
126132
127133 Connections {
qml/Components/PassphraseLockscreen.qml+2
@@ -40,6 +40,8 @@ Item {
4040 }
4141 }
4242
43+ onActiveFocusChanged: if (activeFocus) pinentryField.forceActiveFocus()
44+
4345 Column {
4446 id: shakeContainer
4547 anchors.horizontalCenter: parent.horizontalCenter
tests/qmltests/CMakeLists.txt+1−1
@@ -26,7 +26,7 @@ add_qml_test(Components Carousel)
2626add_qml_test(Components DraggingArea)
2727add_qml_test(Components EdgeDemoOverlay)
2828add_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)
3030add_qml_test(Components Rating)
3131add_qml_test(Components ResponsiveFlowView)
3232add_qml_test(Components ResponsiveGridView)
tests/qmltests/Components/tst_Lockscreen.qml+7−37
@@ -18,8 +18,6 @@ import QtQuick 2.0
1818import QtTest 1.0
1919import ".."
2020import "../../../qml/Components"
21−import AccountsService 0.1
22−import LightDM 0.1 as LightDM
2321import Ubuntu.Components 0.1
2422import Unity.Test 0.1 as UT
2523
@@ -53,24 +51,6 @@ Rectangle {
5351 }
5452 }
5553
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−
7454 Rectangle {
7555 anchors.fill: parent
7656 anchors.leftMargin: lockscreen.width
@@ -151,17 +131,6 @@ Rectangle {
151131 id: enteredLabel
152132 }
153133 }
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−
165134 TextField {
166135 id: infoTextTextField
167136 width: parent.width
@@ -262,11 +231,11 @@ Rectangle {
262231
263232 function test_unlock_data() {
264233 return [
265− {tag: "numeric", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: 4, maxPinLength: 4},
266− {tag: "alphanumeric", alphanumeric: true, username: "has-password", password: "password", minPinLength: -1, maxPinLength: -1},
267− {tag: "numeric (wrong)", alphanumeric: false, username: "has-pin", password: "4321", minPinLength: 4, maxPinLength: 4},
268− {tag: "alphanumeric (wrong)", alphanumeric: true, username: "has-password", password: "drowssap", minPinLength: -1, maxPinLength: -1},
269− {tag: "flexible length", alphanumeric: false, username: "has-pin", password: "1234", minPinLength: -1, maxPinLength: -1},
234+ {tag: "numeric", alphanumeric: false, password: "1234", minPinLength: 4, maxPinLength: 4},
235+ {tag: "alphanumeric", alphanumeric: true, password: "password", minPinLength: -1, maxPinLength: -1},
236+ {tag: "numeric (wrong)", alphanumeric: false, password: "4321", minPinLength: 4, maxPinLength: 4},
237+ {tag: "alphanumeric (wrong)", alphanumeric: true, password: "drowssap", minPinLength: -1, maxPinLength: -1},
238+ {tag: "flexible length", alphanumeric: false, password: "1234", minPinLength: -1, maxPinLength: -1},
270239 ]
271240 }
272241
@@ -274,7 +243,8 @@ Rectangle {
274243 enteredLabel.text = ""
275244 minPinLengthTextField.text = data.minPinLength
276245 maxPinLengthTextField.text = data.maxPinLength
277− setUser(data.username)
246+ pinPadCheckBox.checked = data.alphanumeric
247+ infoTextTextField.text = "Enter " + (data.alphanumeric ? "passphrase" : "passcode")
278248 waitForLockscreenReady();
279249
280250 var inputField = findChild(lockscreen, "pinentryField")