on xenial help sign in
Dual SIM pin unlocking. Hook up the UI to the backend. Fixes: 1267135, 1336675, 1357000, 1359226, 1361074

Approved by: Michael Zanetti

commit45e8385e4d00e442f54692a00a6f2f1aa7c0980e authorAntti Kaijanmäki <antti.kaijanmaki@canonical.com> dateWed 8 Oct 2014, 09:41 (12 years ago) parenteeac5a624f9b99
3 files changed+99−33
po/unity8.pot+19−27 qml/Components/Lockscreen.qml+3−1 qml/Notifications/NotificationMenuItemFactory.qml+77−5
po/unity8.pot+19−27
@@ -8,7 +8,7 @@ msgid ""
88msgstr ""
99"Project-Id-Version: unity8\n"
1010"Report-Msgid-Bugs-To: \n"
11−"POT-Creation-Date: 2014-10-03 08:13-0400\n"
11+"POT-Creation-Date: 2014-10-07 11:37+0300\n"
1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -152,23 +152,23 @@ msgid ""
152152"phone<br><br>Tap on the screen to start"
153153msgstr ""
154154
155−#: qml/Components/Lockscreen.qml:218
155+#: qml/Components/Lockscreen.qml:220
156156msgid "Emergency Call"
157157msgstr ""
158158
159−#: qml/Components/Lockscreen.qml:250
159+#: qml/Components/Lockscreen.qml:252
160160msgid "OK"
161161msgstr ""
162162
163−#: qml/Dash/GenericScopeView.qml:411 qml/Dash/GenericScopeView.qml:568
163+#: qml/Dash/GenericScopeView.qml:434 qml/Dash/GenericScopeView.qml:591
164164msgid "See less"
165165msgstr ""
166166
167−#: qml/Dash/GenericScopeView.qml:411
167+#: qml/Dash/GenericScopeView.qml:434
168168msgid "See all"
169169msgstr ""
170170
171−#: qml/Dash/GenericScopeView.qml:473 qml/Dash/PageHeader.qml:258
171+#: qml/Dash/GenericScopeView.qml:496 qml/Dash/PageHeader.qml:258
172172#: qml/Panel/SearchIndicator.qml:27
173173msgid "Search"
174174msgstr ""
@@ -257,18 +257,10 @@ msgstr ""
257257msgid "Speaking..."
258258msgstr ""
259259
260−#: qml/Notifications/NotificationMenuItemFactory.qml:108
260+#: qml/Notifications/NotificationMenuItemFactory.qml:116
261261msgid "Show password"
262262msgstr ""
263263
264−#: qml/Notifications/NotificationMenuItemFactory.qml:124
265−msgid "Enter SIM PIN"
266−msgstr ""
267−
268−#: qml/Notifications/NotificationMenuItemFactory.qml:125
269−msgid "Sorry, incorrect PIN"
270−msgstr ""
271−
272264#: qml/Panel/ActiveCallHint.qml:77
273265msgid "Tap to return to call..."
274266msgstr ""
@@ -313,55 +305,55 @@ msgstr ""
313305msgid "Roaming"
314306msgstr ""
315307
316−#: qml/Shell.qml:340
308+#: qml/Shell.qml:346
317309msgid "Enter passphrase"
318310msgstr ""
319311
320−#: qml/Shell.qml:341
312+#: qml/Shell.qml:347
321313msgid "Sorry, incorrect passphrase"
322314msgstr ""
323315
324−#: qml/Shell.qml:342
316+#: qml/Shell.qml:348
325317msgid "Please re-enter"
326318msgstr ""
327319
328−#: qml/Shell.qml:344
320+#: qml/Shell.qml:350
329321msgid "Enter passcode"
330322msgstr ""
331323
332−#: qml/Shell.qml:345
324+#: qml/Shell.qml:351
333325msgid "Sorry, incorrect passcode"
334326msgstr ""
335327
336−#: qml/Shell.qml:348
328+#: qml/Shell.qml:354
337329#, qt-format
338330msgid "Enter %1"
339331msgstr ""
340332
341−#: qml/Shell.qml:349
333+#: qml/Shell.qml:355
342334#, qt-format
343335msgid "Sorry, incorrect %1"
344336msgstr ""
345337
346−#: qml/Shell.qml:384
338+#: qml/Shell.qml:390
347339msgid "Sorry, incorrect passphrase."
348340msgstr ""
349341
350−#: qml/Shell.qml:385
342+#: qml/Shell.qml:391
351343msgid "Sorry, incorrect passcode."
352344msgstr ""
353345
354−#: qml/Shell.qml:386
346+#: qml/Shell.qml:392
355347msgid "This will be your last attempt."
356348msgstr ""
357349
358−#: qml/Shell.qml:388
350+#: qml/Shell.qml:394
359351msgid ""
360352"If passphrase is entered incorrectly, your phone will conduct a factory "
361353"reset and all personal data will be deleted."
362354msgstr ""
363355
364−#: qml/Shell.qml:389
356+#: qml/Shell.qml:395
365357msgid ""
366358"If passcode is entered incorrectly, your phone will conduct a factory reset "
367359"and all personal data will be deleted."
qml/Components/Lockscreen.qml+3−1
@@ -78,7 +78,9 @@ Showable {
7878 }
7979
8080 function showInfoPopup(title, text) {
81− PopupUtils.open(infoPopupComponent, root, {title: title, text: text})
81+ var popup = PopupUtils.open(infoPopupComponent, root, {title: title, text: text})
82+ // FIXME: SDK will do this internally soonish
83+ popup.z = Number.MAX_VALUE
8284 }
8385
8486 Rectangle {
qml/Notifications/NotificationMenuItemFactory.qml+77−5
@@ -19,6 +19,7 @@
1919
2020import QtQuick 2.0
2121import Ubuntu.Components 0.1
22+import QMenuModel 0.1
2223import "../Components"
2324
2425Loader {
@@ -26,7 +27,7 @@ Loader {
2627
2728 property QtObject menuModel: null
2829 property QtObject menuData: null
29− property int menuIndex
30+ property int menuIndex : -1
3031 property int maxHeight
3132 readonly property bool fullscreen: menuData.type === "com.canonical.snapdecision.pinlock"
3233
@@ -46,6 +47,13 @@ Loader {
4647 }
4748 }
4849
50+ function getExtendedProperty(object, propertyName, defaultValue) {
51+ if (object && object.hasOwnProperty(propertyName)) {
52+ return object[propertyName];
53+ }
54+ return defaultValue;
55+ }
56+
4957 Component {
5058 id: textfield
5159
@@ -121,14 +129,14 @@ Loader {
121129 right: parent.right
122130 }
123131 height: menuFactory.maxHeight
124− infoText: i18n.tr("Enter SIM PIN")
125− errorText: i18n.tr("Sorry, incorrect PIN")
126− minPinLength: 4
127− maxPinLength: 8
132+ infoText: notification.summary
133+ errorText: errorAction.valid ? errorAction.state : ""
134+ retryText: notification.body
128135 background: shell.background
129136
130137 onEntered: {
131138 menuModel.changeState(menuIndex, passphrase);
139+ clear(false);
132140 }
133141
134142 onCancel: {
@@ -139,6 +147,70 @@ Loader {
139147 shell.activateApplication("dialer-app")
140148 menuModel.activate(menuIndex, false)
141149 }
150+
151+ property var extendedData: menuData && menuData.ext || undefined
152+
153+ property var pinMinMaxAction : UnityMenuAction {
154+ model: menuModel
155+ index: menuIndex
156+ name: getExtendedProperty(extendedData, "xCanonicalPinMinMax", "")
157+
158+ onStateChanged: {
159+ var min = pinMinMaxAction.state[0];
160+ var max = pinMinMaxAction.state[1];
161+
162+ if (min === 0) min = -1;
163+ if (max === 0) max = -1;
164+
165+ minPinLength = min
166+ maxPinLength = max
167+ }
168+ }
169+
170+ property var popupAction: UnityMenuAction {
171+ model: menuModel
172+ index: menuIndex
173+ name: getExtendedProperty(extendedData, "xCanonicalPinPopup", "")
174+ onStateChanged: {
175+ if (state !== "")
176+ showInfoPopup("", state);
177+ }
178+ }
179+ onInfoPopupConfirmed: {
180+ popupAction.activate();
181+ }
182+
183+ Timer {
184+ id: errorTimer
185+ interval: 4000;
186+ running: false;
187+ repeat: false
188+ onTriggered: {
189+ errorAction.activate();
190+ }
191+ }
192+ property var errorAction: UnityMenuAction {
193+ model: menuModel
194+ index: menuIndex
195+ name: getExtendedProperty(extendedData, "xCanonicalPinError", "")
196+ onStateChanged: {
197+ errorText = state;
198+ if (state !== "") {
199+ clear(true);
200+ errorTimer.running = true;
201+ }
202+ }
203+ }
204+
205+ function loadAttributes() {
206+ if (!menuModel || menuIndex == -1) return;
207+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-pin-min-max': 'string',
208+ 'x-canonical-pin-popup': 'string',
209+ 'x-canonical-pin-error': 'string'});
210+ }
211+ Component.onCompleted: {
212+ loadAttributes();
213+ }
142214 }
143215 }
144216}