on xenial help sign in
Merge from passphrase-ui-tweaks
commit18209eb789f5810326fe50c4a6abeeec7325444f authorMichael Terry <michael.terry@canonical.com> dateWed 24 Sep 2014, 15:31 (12 years ago) parentf93342e0236a4e
4 files changed+18−40
qml/Components/Lockscreen.qml+8−2 qml/Components/PassphraseLockscreen.qml+2 tests/qmltests/CMakeLists.txt+1−1 tests/qmltests/Greeter/tst_Lockscreen.qml → tests/qmltests/Components/tst_Lockscreen.qml+7−37
qml/Components/Lockscreen.qml+8−2
@@ -61,6 +61,8 @@ Showable {
6161 signal emergencyCall()
6262 signal infoPopupConfirmed()
6363
64+ onActiveFocusChanged: if (activeFocus && pinPadLoader.item) pinPadLoader.item.forceActiveFocus()
65+
6466 function reset() {
6567 // This causes the loader below to destry and recreate the source
6668 pinPadLoader.resetting = true;
@@ -99,6 +101,10 @@ Showable {
99101
100102 MouseArea {
101103 anchors.fill: root
104+ onClicked: {
105+ if (pinPadLoader.item)
106+ pinPadLoader.item.forceActiveFocus()
107+ }
102108 }
103109
104110 FocusScope {
@@ -127,8 +133,8 @@ Showable {
127133 onSourceChanged: {
128134 waiting = false
129135 showWrongText = false
130− if (loaderScope.activeFocus)
131− clear(false)
136+ if (loaderScope.activeFocus && pinPadLoader.item)
137+ pinPadLoader.item.forceActiveFocus()
132138 }
133139
134140 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,6 +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)
2930add_qml_test(Components Rating)
3031add_qml_test(Components ResponsiveFlowView)
3132add_qml_test(Components ResponsiveGridView)
@@ -60,7 +61,6 @@ add_qml_test(Dash/ScopeSettings ScopeSettingList)
6061add_qml_test(Dash/ScopeSettings ScopeSettingNumber)
6162add_qml_test(Dash/ScopeSettings ScopeSettingString)
6263add_qml_test(Dash/ScopeSettings ScopeSettingsWidgetFactory)
63−add_qml_test(Greeter Lockscreen ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
6464add_qml_test(Greeter MultiGreeter ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
6565add_qml_test(Greeter SingleGreeter ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
6666add_qml_test(Greeter Infographics ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/libusermetrics:${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full")
tests/qmltests/Greeter/tst_Lockscreen.qml → tests/qmltests/Components/tst_Lockscreen.qmlrenamed+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")