on xenial help sign in
move the ofono stuff to Pages, remove debugs
4d4e761Lukáš Tinkl
qml/Wizard/Page.qml+1−27
@@ -16,7 +16,6 @@
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18import Ubuntu.Components 1.3
18import Ubuntu.Components 1.3
19−import MeeGo.QOfono 0.2
20import Wizard 0.1
19import Wizard 0.1
21
20
22Item {
21Item {
@@ -61,31 +60,6 @@ Item {
61 visible: false
60 visible: false
62 anchors.fill: parent
61 anchors.fill: parent
63
62
64− property alias modemManager: modemManager
65− property alias simManager0: simManager0
66− property alias simManager1: simManager1
67−
68− OfonoManager { // need it here for the language and country detection
69− id: modemManager
70− readonly property bool gotSimCard: available && ((simManager0.ready && simManager0.present) || (simManager1.ready && simManager1.present))
71− property bool ready: false
72− onModemsChanged: {
73− ready = true;
74− }
75− }
76−
77− // Ideally we would query the system more cleverly than hardcoding two
78− // sims. But we don't yet have a more clever way. :(
79− OfonoSimManager {
80− id: simManager0
81− modemPath: modemManager.modems.length >= 1 ? modemManager.modems[0] : ""
82− }
83−
84− OfonoSimManager {
85− id: simManager1
86− modemPath: modemManager.modems.length >= 2 ? modemManager.modems[1] : ""
87− }
88−
89 Timer {
63 Timer {
90 id: indicatorTimer
64 id: indicatorTimer
91 interval: 1000
65 interval: 1000
@@ -149,7 +123,7 @@ Item {
149 name: "no-simcard"
123 name: "no-simcard"
150 height: parent.height
124 height: parent.height
151 width: height
125 width: height
152− visible: !(simManager0.present || simManager1.present)
126+ visible: !(root.simManager0.present || root.simManager1.present)
153 color: "white"
127 color: "white"
154 }
128 }
155
129
qml/Wizard/Pages.qml+26
@@ -15,6 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18+import MeeGo.QOfono 0.2
18import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
19import Ubuntu.SystemSettings.SecurityPrivacy 1.0
20import Ubuntu.SystemSettings.SecurityPrivacy 1.0
20import Wizard 0.1
21import Wizard 0.1
@@ -35,11 +36,36 @@ Item {
35 property string countryCode: "US" // default country (for the timezone page)
36 property string countryCode: "US" // default country (for the timezone page)
36 property bool seenSIMPage: false // we want to see the SIM page at most once
37 property bool seenSIMPage: false // we want to see the SIM page at most once
37
38
39+ property alias modemManager: modemManager
40+ property alias simManager0: simManager0
41+ property alias simManager1: simManager1
42+
38 UbuntuSecurityPrivacyPanel {
43 UbuntuSecurityPrivacyPanel {
39 id: securityPrivacy
44 id: securityPrivacy
40 objectName: "securityPrivacy"
45 objectName: "securityPrivacy"
41 }
46 }
42
47
48+ OfonoManager { // need it here for the language and country detection
49+ id: modemManager
50+ readonly property bool gotSimCard: available && ((simManager0.ready && simManager0.present) || (simManager1.ready && simManager1.present))
51+ property bool ready: false
52+ onModemsChanged: {
53+ ready = true;
54+ }
55+ }
56+
57+ // Ideally we would query the system more cleverly than hardcoding two
58+ // sims. But we don't yet have a more clever way. :(
59+ OfonoSimManager {
60+ id: simManager0
61+ modemPath: modemManager.modems.length >= 1 ? modemManager.modems[0] : ""
62+ }
63+
64+ OfonoSimManager {
65+ id: simManager1
66+ modemPath: modemManager.modems.length >= 2 ? modemManager.modems[1] : ""
67+ }
68+
43 function quitWizard() {
69 function quitWizard() {
44 pageStack.currentPage.enabled = false;
70 pageStack.currentPage.enabled = false;
45
71
qml/Wizard/Pages/10-language.qml+5−5
@@ -35,10 +35,10 @@ LocalComponents.Page {
35 {
35 {
36 var detectedLang = "";
36 var detectedLang = "";
37 // try to detect the language+country from the SIM card
37 // try to detect the language+country from the SIM card
38− if (simManager0.present && simManager0.preferredLanguages.length > 0) {
38+ if (root.simManager0.present && root.simManager0.preferredLanguages.length > 0) {
39− detectedLang = simManager0.preferredLanguages[0] + "_" + LocalePlugin.mccToCountryCode(simManager0.mobileCountryCode);
39+ detectedLang = root.simManager0.preferredLanguages[0] + "_" + LocalePlugin.mccToCountryCode(root.simManager0.mobileCountryCode);
40− } else if (simManager1.present && simManager1.preferredLanguages.length > 0) {
40+ } else if (root.simManager1.present && root.simManager1.preferredLanguages.length > 0) {
41− detectedLang = simManager1.preferredLanguages[0] + "_" + LocalePlugin.mccToCountryCode(simManager1.mobileCountryCode);
41+ detectedLang = root.simManager1.preferredLanguages[0] + "_" + LocalePlugin.mccToCountryCode(root.simManager1.mobileCountryCode);
42 } else if (plugin.currentLanguage != -1) {
42 } else if (plugin.currentLanguage != -1) {
43 detectedLang = plugin.languageCodes[plugin.currentLanguage].split(".")[0]; // remove the encoding part, after dot (en_US.utf8 -> en_US)
43 detectedLang = plugin.languageCodes[plugin.currentLanguage].split(".")[0]; // remove the encoding part, after dot (en_US.utf8 -> en_US)
44 } else {
44 } else {
@@ -161,7 +161,7 @@ LocalComponents.Page {
161 i18n.language = plugin.languageCodes[plugin.currentLanguage]; // re-notify of change after above call (for qlocale change)
161 i18n.language = plugin.languageCodes[plugin.currentLanguage]; // re-notify of change after above call (for qlocale change)
162 root.countryCode = plugin.languageCodes[plugin.currentLanguage].split('_')[1].split('.')[0]; // extract the country code, save it for the timezone page
162 root.countryCode = plugin.languageCodes[plugin.currentLanguage].split('_')[1].split('.')[0]; // extract the country code, save it for the timezone page
163
163
164− if (simManager0.present || simManager1.present || root.seenSIMPage) // go to next page
164+ if (root.simManager0.present || root.simManager1.present || root.seenSIMPage) // go to next page
165 pageStack.next();
165 pageStack.next();
166 else
166 else
167 pageStack.load(Qt.resolvedUrl("sim.qml")); // show the SIM page
167 pageStack.load(Qt.resolvedUrl("sim.qml")); // show the SIM page
qml/Wizard/Pages/sim.qml+4−8
@@ -29,25 +29,21 @@ LocalComponents.Page {
29 customTitle: true
29 customTitle: true
30 hasBackButton: false
30 hasBackButton: false
31
31
32− property bool hadSIM: simManager0.present || simManager1.present
32+ property bool hadSIM: root.simManager0.present || root.simManager1.present
33
33
34 Timer {
34 Timer {
35 id: timer
35 id: timer
36 interval: 300
36 interval: 300
37 running: true
37 running: true
38 onTriggered: {
38 onTriggered: {
39− print("=== SIM page: timer triggered");
40− hadSIM = simManager0.present || simManager1.present;
39+ hadSIM = root.simManager0.present || root.simManager1.present;
41− print("=== SIM page: had sim:", hadSIM);
42 }
40 }
43 }
41 }
44
42
45 Connections {
43 Connections {
46− target: modemManager
44+ target: root.modemManager
47 onGotSimCardChanged: {
45 onGotSimCardChanged: {
48− print("=== SIM page: SIM card inserted");
49− if (!hadSIM && modemManager.gotSimCard) { // show the restart dialog in case a SIM gets inserted
46+ if (!hadSIM && root.modemManager.gotSimCard) { // show the restart dialog in case a SIM gets inserted
50− print("=== SIM page: showing reboot dialog");
51 restartDialog.visible = true;
47 restartDialog.visible = true;
52 }
48 }
53 }
49 }