on xenial help sign in
Fix some focus issues with PassphraseLockscreen
commit6ec5408dd5758433011b55dea0b92d8354a30daa authorMichael Terry <michael.terry@canonical.com> dateTue 23 Sep 2014, 22:36 (12 years ago) parent9b6e865
2 files changed+79−74
qml/Components/Lockscreen.qml+76−70 qml/Components/PassphraseLockscreen.qml+3−4
qml/Components/Lockscreen.qml+76−70
@@ -94,83 +94,89 @@ Showable {
9494 anchors.fill: root
9595 }
9696
97− Loader {
98− id: pinPadLoader
99− objectName: "pinPadLoader"
97+ FocusScope {
98+ id: loaderScope
10099 anchors.fill: parent
101− property bool resetting: false
102− property bool waiting: false
103− property bool showWrongText: false
104−
105− source: {
106− if (resetting || !root.required) {
107− return ""
108− } else if (root.delayMinutes > 0) {
109− return "DelayedLockscreen.qml"
110− } else if (root.alphaNumeric) {
111− return "PassphraseLockscreen.qml"
112− } else {
113− return "PinLockscreen.qml"
100+
101+ Loader {
102+ id: pinPadLoader
103+ objectName: "pinPadLoader"
104+ anchors.fill: parent
105+ property bool resetting: false
106+ property bool waiting: false
107+ property bool showWrongText: false
108+
109+ source: {
110+ if (resetting || !root.required) {
111+ return ""
112+ } else if (root.delayMinutes > 0) {
113+ return "DelayedLockscreen.qml"
114+ } else if (root.alphaNumeric) {
115+ return "PassphraseLockscreen.qml"
116+ } else {
117+ return "PinLockscreen.qml"
118+ }
119+ }
120+ onSourceChanged: {
121+ waiting = false
122+ showWrongText = false
123+ if (loaderScope.activeFocus)
124+ clear(false)
114125 }
115− }
116− onSourceChanged: {
117− waiting = false
118− showWrongText = false
119− clear(false)
120− }
121126
122− Connections {
123− target: pinPadLoader.item
127+ Connections {
128+ target: pinPadLoader.item
124129
125− onEntered: {
126− pinPadLoader.waiting = true
127− root.entered(passphrase);
128− }
130+ onEntered: {
131+ pinPadLoader.waiting = true
132+ root.entered(passphrase);
133+ }
129134
130− onCancel: {
131− root.cancel()
135+ onCancel: {
136+ root.cancel()
137+ }
132138 }
133− }
134139
135− Binding {
136− target: pinPadLoader.item
137− property: "minPinLength"
138− value: root.minPinLength
139− }
140− Binding {
141− target: pinPadLoader.item
142− property: "maxPinLength"
143− value: root.maxPinLength
144− }
145− Binding {
146− target: pinPadLoader.item
147− property: "infoText"
148− value: root.infoText
149− }
150− Binding {
151− target: pinPadLoader.item
152− property: "retryText"
153− value: root.retryText
154− }
155− Binding {
156− target: pinPadLoader.item
157− property: "errorText"
158− value: pinPadLoader.showWrongText ? root.errorText : ""
159− }
160− Binding {
161− target: pinPadLoader.item
162− property: "entryEnabled"
163− value: !pinPadLoader.waiting
164− }
165− Binding {
166− target: pinPadLoader.item
167− property: "alphaNumeric"
168− value: root.alphaNumeric
169− }
170− Binding {
171− target: pinPadLoader.item
172− property: "delayMinutes"
173− value: root.delayMinutes
140+ Binding {
141+ target: pinPadLoader.item
142+ property: "minPinLength"
143+ value: root.minPinLength
144+ }
145+ Binding {
146+ target: pinPadLoader.item
147+ property: "maxPinLength"
148+ value: root.maxPinLength
149+ }
150+ Binding {
151+ target: pinPadLoader.item
152+ property: "infoText"
153+ value: root.infoText
154+ }
155+ Binding {
156+ target: pinPadLoader.item
157+ property: "retryText"
158+ value: root.retryText
159+ }
160+ Binding {
161+ target: pinPadLoader.item
162+ property: "errorText"
163+ value: pinPadLoader.showWrongText ? root.errorText : ""
164+ }
165+ Binding {
166+ target: pinPadLoader.item
167+ property: "entryEnabled"
168+ value: !pinPadLoader.waiting
169+ }
170+ Binding {
171+ target: pinPadLoader.item
172+ property: "alphaNumeric"
173+ value: root.alphaNumeric
174+ }
175+ Binding {
176+ target: pinPadLoader.item
177+ property: "delayMinutes"
178+ value: root.delayMinutes
179+ }
174180 }
175181 }
176182
qml/Components/PassphraseLockscreen.qml+3−4
@@ -87,13 +87,12 @@ Item {
8787 cursorPosition = length
8888 }
8989 }
90− enabled: root.entryEnabled
9190 clip: true
9291
93− onTextChanged: incorrectOverride = true
92+ // simulate being disabled, but without removing OSK focus
93+ maximumLength: root.entryEnabled ? 32767 : length
9494
95− onActiveFocusChanged: if (!activeFocus) pinentryField.forceActiveFocus()
96− onEnabledChanged: if (enabled) pinentryField.forceActiveFocus()
95+ onTextChanged: incorrectOverride = true
9796
9897 onAccepted: {
9998 if (pinentryField.text) {