on xenial help sign in
Show a spinner while waiting for PAM, clean up wrong-password text handling
commitd73fdc539e9d2678f2fad5ba56984e60007681a9 authorMichael Terry <michael.terry@canonical.com> dateFri 1 Aug 2014, 10:01 (12 years ago) parent3ddfbee
3 files changed+33−28
qml/Components/Lockscreen.qml+14−21 qml/Components/PassphraseLockscreen.qml+10−2 qml/Components/PinLockscreen.qml+9−5
qml/Components/Lockscreen.qml+14−21
@@ -77,6 +77,7 @@ Showable {
7777 if (pinPadLoader.item) {
7878 pinPadLoader.item.clear(showAnimation);
7979 }
80+ pinPadLoader.showWrongText = showAnimation
8081 pinPadLoader.waiting = false
8182 }
8283
@@ -86,6 +87,7 @@ Showable {
8687
8788 Timer {
8889 id: forcedDelayTimer
90+ onTriggered: pinPadLoader.showWrongText = false
8991 }
9092
9193 Rectangle {
@@ -117,19 +119,6 @@ Showable {
117119 bottom: pinPadLoader.top
118120 bottomMargin: units.gu(2)
119121 }
120− Label {
121− id: delayTextLabel
122− objectName: "delayTextLabel"
123− anchors {
124− left: parent.left
125− right: parent.right
126− }
127− text: i18n.tr("Too many incorrect attempts, please wait")
128− horizontalAlignment: Text.AlignHCenter
129− color: "#f3f3e7"
130− opacity: 0.6
131− visible: forcedDelayTimer.running
132− }
133122 Label {
134123 objectName: "retryCountLabel"
135124 anchors {
@@ -157,8 +146,6 @@ Showable {
157146 }
158147 }
159148
160−
161−
162149 Loader {
163150 id: pinPadLoader
164151 objectName: "pinPadLoader"
@@ -170,6 +157,7 @@ Showable {
170157 }
171158 property bool resetting: false
172159 property bool waiting: false
160+ property bool showWrongText: false
173161
174162 source: (!resetting && root.required) ? (root.alphaNumeric ? "PassphraseLockscreen.qml" : "PinLockscreen.qml") : ""
175163
@@ -199,12 +187,12 @@ Showable {
199187 Binding {
200188 target: pinPadLoader.item
201189 property: "placeholderText"
202− value: root.placeholderText
203− }
204− Binding {
205− target: pinPadLoader.item
206− property: "wrongPlaceholderText"
207− value: root.wrongPlaceholderText
190+ value: forcedDelayTimer.running ?
191+ (i18n.tr("Too many incorrect attempts") +
192+ "\n" +
193+ i18n.tr("Please wait")) :
194+ (pinPadLoader.showWrongText ?
195+ root.wrongPlaceholderText : root.placeholderText)
208196 }
209197 Binding {
210198 target: pinPadLoader.item
@@ -216,6 +204,11 @@ Showable {
216204 property: "entryEnabled"
217205 value: !pinPadLoader.waiting && !forcedDelayTimer.running
218206 }
207+ Binding {
208+ target: pinPadLoader.item
209+ property: "waiting"
210+ value: pinPadLoader.waiting
211+ }
219212 }
220213
221214 Column {
qml/Components/PassphraseLockscreen.qml+10−2
@@ -23,9 +23,9 @@ Item {
2323 height: highlightItem.height
2424
2525 property string placeholderText
26− property string wrongPlaceholderText
2726 property string username: ""
2827 property bool entryEnabled: true
28+ property bool waiting: false
2929
3030 signal entered(string passphrase)
3131 signal cancel()
@@ -77,13 +77,21 @@ Item {
7777 opacity: 0.9
7878 hasClearButton: false
7979 enabled: entryEnabled
80− placeholderText: wrongPasswordAnimation.running ? root.wrongPlaceholderText : root.placeholderText
80+ placeholderText: root.placeholderText
8181
8282 onAccepted: {
8383 if (pinentryField.text) {
8484 root.entered(pinentryField.text);
8585 }
8686 }
87+
88+ ActivityIndicator {
89+ id: spinner
90+ anchors.verticalCenter: parent.verticalCenter
91+ anchors.right: parent.right
92+ anchors.rightMargin: units.gu(1)
93+ running: root.waiting
94+ }
8795 }
8896 }
8997
qml/Components/PinLockscreen.qml+9−5
@@ -25,7 +25,6 @@ Column {
2525 spacing: units.gu(3.5)
2626
2727 property alias placeholderText: pinentryField.placeholderText
28− property alias wrongPlaceholderText: pinentryField.wrongPlaceholderText
2928 property int padWidth: units.gu(34)
3029 property int padHeight: units.gu(28)
3130 property int minPinLength: -1
@@ -35,10 +34,10 @@ Column {
3534 signal cancel()
3635
3736 property bool entryEnabled: true
37+ property bool waiting: false
3838
3939 function clear(playAnimation) {
4040 pinentryField.text = "";
41− pinentryFieldPlaceHolder.text = playAnimation ? wrongPlaceholderText : placeholderText
4241 if (playAnimation) {
4342 wrongPasswordAnimation.start();
4443 }
@@ -59,7 +58,6 @@ Column {
5958 radius: "medium"
6059 property string text: ""
6160 property string placeholderText: ""
62− property string wrongPlaceholderText: ""
6361
6462 function appendChar(character) {
6563 if (root.maxPinLength == -1 || pinentryField.text.length < root.maxPinLength) {
@@ -77,6 +75,11 @@ Column {
7775 }
7876 }
7977
78+ ActivityIndicator {
79+ id: spinner
80+ anchors.centerIn: parent
81+ running: root.waiting
82+ }
8083 Label {
8184 id: pinentryFieldLabel
8285 anchors.centerIn: parent
@@ -86,6 +89,7 @@ Column {
8689 font.pixelSize: units.dp(44)
8790 color: "#f3f3e7"
8891 opacity: 0.6
92+ visible: !spinner.running
8993 }
9094 Label {
9195 id: pinentryFieldPlaceHolder
@@ -95,7 +99,7 @@ Column {
9599 color: "#f3f3e7"
96100 opacity: 0.6
97101 text: parent.placeholderText
98− visible: pinentryFieldLabel.text.length == 0
102+ visible: !spinner.running && pinentryFieldLabel.text.length == 0
99103 }
100104
101105 Icon {
@@ -109,7 +113,7 @@ Column {
109113 bottom: parent.bottom
110114 bottomMargin: units.gu(1)
111115 }
112− visible: !priv.autoConfirm
116+ visible: !spinner.running && entryEnabled && !priv.autoConfirm
113117 width: height
114118 name: "erase"
115119 color: "#f3f3e7"