on xenial help sign in
show the SIM page at most once
a36b48fLukáš Tinkl
qml/Wizard/Pages.qml+1
@@ -32,6 +32,7 @@ Item {
32 property int passwordMethod: UbuntuSecurityPrivacyPanel.Passphrase
32 property int passwordMethod: UbuntuSecurityPrivacyPanel.Passphrase
33 property string password: ""
33 property string password: ""
34 property string countryCode: "US" // default country (for the timezone page)
34 property string countryCode: "US" // default country (for the timezone page)
35+ property bool seenSIMPage: false // we want to see the SIM page at most once
35
36
36 UbuntuSecurityPrivacyPanel {
37 UbuntuSecurityPrivacyPanel {
37 id: securityPrivacy
38 id: securityPrivacy
qml/Wizard/Pages/10-language.qml+5−1
@@ -153,7 +153,11 @@ LocalComponents.Page {
153 }
153 }
154 i18n.language = plugin.languageCodes[plugin.currentLanguage]; // re-notify of change after above call (for qlocale change)
154 i18n.language = plugin.languageCodes[plugin.currentLanguage]; // re-notify of change after above call (for qlocale change)
155 root.countryCode = plugin.languageCodes[plugin.currentLanguage].split('_')[1].split('.')[0]; // extract the country code, save it for the timezone page
155 root.countryCode = plugin.languageCodes[plugin.currentLanguage].split('_')[1].split('.')[0]; // extract the country code, save it for the timezone page
156+
157+ if (simManager0.present || simManager1.present || root.seenSIMPage) // go to next page
156− pageStack.next();
158+ pageStack.next();
159+ else
160+ pageStack.load(Qt.resolvedUrl("sim.qml")); // show the SIM page
157 }
161 }
158 }
162 }
159 }
163 }
qml/Wizard/Pages/20-sim.qml → qml/Wizard/Pages/sim.qmlrenamed+4−22
@@ -29,12 +29,6 @@ LocalComponents.Page {
29 customTitle: true
29 customTitle: true
30 hasBackButton: false
30 hasBackButton: false
31
31
32− skipValid: modemManager.gotSimCard
33−
34− // skip this page altogether if...
35− skip: !modemManager.available || modemManager.modems.length === 0 || // .. we don't have any modem
36− simManager0.present || simManager1.present // ... or we already have a SIM card inserted
37−
38 property bool hadSIM: simManager0.present || simManager1.present
32 property bool hadSIM: simManager0.present || simManager1.present
39
33
40 Timer {
34 Timer {
@@ -45,24 +39,9 @@ LocalComponents.Page {
45 print("=== SIM page: timer triggered");
39 print("=== SIM page: timer triggered");
46 hadSIM = simManager0.present || simManager1.present;
40 hadSIM = simManager0.present || simManager1.present;
47 print("=== SIM page: had sim:", hadSIM);
41 print("=== SIM page: had sim:", hadSIM);
48− if (hadSIM) {
49− skip = true;
50− skipValid = true;
51− }
52− else {
53− checkSkipValid();
54− }
55 }
42 }
56 }
43 }
57
44
58− function checkSkipValid() {
59− skipValid = (modemManager.available && modemManager.modems.length === 0) || // got modem with no SIM card slots
60− !modemManager.available || // modem not available
61− (simManager0.ready && !simManager0.present) || (simManager1.ready && !simManager1.present) || // empty SIM card slots
62− simManager0.present || simManager1.present; // already have a SIM card inserted
63− print("=== SIM page: check skipValid:", skipValid);
64− }
65−
66 Connections {
45 Connections {
67 target: modemManager
46 target: modemManager
68 onGotSimCardChanged: {
47 onGotSimCardChanged: {
@@ -122,7 +101,10 @@ LocalComponents.Page {
122 id: forwardButton
101 id: forwardButton
123 LocalComponents.StackButton {
102 LocalComponents.StackButton {
124 text: i18n.tr("Skip")
103 text: i18n.tr("Skip")
104+ onClicked: {
105+ seenSIMPage = true;
125− onClicked: pageStack.next()
106+ pageStack.next();
107+ }
126 }
108 }
127 }
109 }
128}
110}