on xenial help sign in
Fix some focus issues with PassphraseLockscreen
6ec5408Michael Terry
qml/Components/Lockscreen.qml+76−70
@@ -94,83 +94,89 @@ Showable {
94 anchors.fill: root
94 anchors.fill: root
95 }
95 }
96
96
97− Loader {
97+ FocusScope {
98− id: pinPadLoader
98+ id: loaderScope
99− objectName: "pinPadLoader"
100 anchors.fill: parent
99 anchors.fill: parent
100+
101+ Loader {
102+ id: pinPadLoader
103+ objectName: "pinPadLoader"
104+ anchors.fill: parent
101− property bool resetting: false
105+ property bool resetting: false
102− property bool waiting: false
106+ property bool waiting: false
103− property bool showWrongText: false
107+ property bool showWrongText: false
104−
108+
105− source: {
109+ source: {
106− if (resetting || !root.required) {
110+ if (resetting || !root.required) {
107− return ""
111+ return ""
108− } else if (root.delayMinutes > 0) {
112+ } else if (root.delayMinutes > 0) {
109− return "DelayedLockscreen.qml"
113+ return "DelayedLockscreen.qml"
110− } else if (root.alphaNumeric) {
114+ } else if (root.alphaNumeric) {
111− return "PassphraseLockscreen.qml"
115+ return "PassphraseLockscreen.qml"
112− } else {
116+ } else {
113− return "PinLockscreen.qml"
117+ return "PinLockscreen.qml"
118+ }
119+ }
120+ onSourceChanged: {
121+ waiting = false
122+ showWrongText = false
123+ if (loaderScope.activeFocus)
124+ clear(false)
114 }
125 }
115− }
116− onSourceChanged: {
117− waiting = false
118− showWrongText = false
119− clear(false)
120− }
121
126
122− Connections {
127+ Connections {
123− target: pinPadLoader.item
128+ target: pinPadLoader.item
124
129
125− onEntered: {
130+ onEntered: {
126− pinPadLoader.waiting = true
131+ pinPadLoader.waiting = true
127− root.entered(passphrase);
132+ root.entered(passphrase);
128− }
133+ }
129
134
130− onCancel: {
135+ onCancel: {
131− root.cancel()
136+ root.cancel()
137+ }
132 }
138 }
133− }
134
139
135− Binding {
140+ Binding {
136− target: pinPadLoader.item
141+ target: pinPadLoader.item
137− property: "minPinLength"
142+ property: "minPinLength"
138− value: root.minPinLength
143+ value: root.minPinLength
139− }
144+ }
140− Binding {
145+ Binding {
141− target: pinPadLoader.item
146+ target: pinPadLoader.item
142− property: "maxPinLength"
147+ property: "maxPinLength"
143− value: root.maxPinLength
148+ value: root.maxPinLength
144− }
149+ }
145− Binding {
150+ Binding {
146− target: pinPadLoader.item
151+ target: pinPadLoader.item
147− property: "infoText"
152+ property: "infoText"
148− value: root.infoText
153+ value: root.infoText
149− }
154+ }
150− Binding {
155+ Binding {
151− target: pinPadLoader.item
156+ target: pinPadLoader.item
152− property: "retryText"
157+ property: "retryText"
153− value: root.retryText
158+ value: root.retryText
154− }
159+ }
155− Binding {
160+ Binding {
156− target: pinPadLoader.item
161+ target: pinPadLoader.item
157− property: "errorText"
162+ property: "errorText"
158− value: pinPadLoader.showWrongText ? root.errorText : ""
163+ value: pinPadLoader.showWrongText ? root.errorText : ""
159− }
164+ }
160− Binding {
165+ Binding {
161− target: pinPadLoader.item
166+ target: pinPadLoader.item
162− property: "entryEnabled"
167+ property: "entryEnabled"
163− value: !pinPadLoader.waiting
168+ value: !pinPadLoader.waiting
164− }
169+ }
165− Binding {
170+ Binding {
166− target: pinPadLoader.item
171+ target: pinPadLoader.item
167− property: "alphaNumeric"
172+ property: "alphaNumeric"
168− value: root.alphaNumeric
173+ value: root.alphaNumeric
169− }
174+ }
170− Binding {
175+ Binding {
171− target: pinPadLoader.item
176+ target: pinPadLoader.item
172− property: "delayMinutes"
177+ property: "delayMinutes"
173− value: root.delayMinutes
178+ value: root.delayMinutes
179+ }
174 }
180 }
175 }
181 }
176
182
qml/Components/PassphraseLockscreen.qml+3−4
@@ -87,13 +87,12 @@ Item {
87 cursorPosition = length
87 cursorPosition = length
88 }
88 }
89 }
89 }
90− enabled: root.entryEnabled
91 clip: true
90 clip: true
92
91
93− onTextChanged: incorrectOverride = true
92+ // simulate being disabled, but without removing OSK focus
93+ maximumLength: root.entryEnabled ? 32767 : length
94
94
95− onActiveFocusChanged: if (!activeFocus) pinentryField.forceActiveFocus()
95+ onTextChanged: incorrectOverride = true
96− onEnabledChanged: if (enabled) pinentryField.forceActiveFocus()
97
96
98 onAccepted: {
97 onAccepted: {
99 if (pinentryField.text) {
98 if (pinentryField.text) {