on xenial help sign in
move the ofono stuff to Pages, remove debugs
commit4d4e761d3ee99f1f25f8d3dca33b4c188a740efa authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 9 Dec 2015, 21:42 (11 years ago) parent13edd4b
4 files changed+36−40
qml/Wizard/Page.qml+1−27 qml/Wizard/Pages.qml+26 qml/Wizard/Pages/10-language.qml+5−5 qml/Wizard/Pages/sim.qml+4−8
qml/Wizard/Page.qml+1−27
@@ -16,7 +16,6 @@
1616
1717import QtQuick 2.4
1818import Ubuntu.Components 1.3
19−import MeeGo.QOfono 0.2
2019import Wizard 0.1
2120
2221Item {
@@ -61,31 +60,6 @@ Item {
6160 visible: false
6261 anchors.fill: parent
6362
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−
8963 Timer {
9064 id: indicatorTimer
9165 interval: 1000
@@ -149,7 +123,7 @@ Item {
149123 name: "no-simcard"
150124 height: parent.height
151125 width: height
152− visible: !(simManager0.present || simManager1.present)
126+ visible: !(root.simManager0.present || root.simManager1.present)
153127 color: "white"
154128 }
155129
qml/Wizard/Pages.qml+26
@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.4
18+import MeeGo.QOfono 0.2
1819import Ubuntu.Components 1.3
1920import Ubuntu.SystemSettings.SecurityPrivacy 1.0
2021import Wizard 0.1
@@ -35,11 +36,36 @@ Item {
3536 property string countryCode: "US" // default country (for the timezone page)
3637 property bool seenSIMPage: false // we want to see the SIM page at most once
3738
39+ property alias modemManager: modemManager
40+ property alias simManager0: simManager0
41+ property alias simManager1: simManager1
42+
3843 UbuntuSecurityPrivacyPanel {
3944 id: securityPrivacy
4045 objectName: "securityPrivacy"
4146 }
4247
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+
4369 function quitWizard() {
4470 pageStack.currentPage.enabled = false;
4571
qml/Wizard/Pages/10-language.qml+5−5
@@ -35,10 +35,10 @@ LocalComponents.Page {
3535 {
3636 var detectedLang = "";
3737 // try to detect the language+country from the SIM card
38− if (simManager0.present && simManager0.preferredLanguages.length > 0) {
39− detectedLang = simManager0.preferredLanguages[0] + "_" + LocalePlugin.mccToCountryCode(simManager0.mobileCountryCode);
40− } else if (simManager1.present && simManager1.preferredLanguages.length > 0) {
41− detectedLang = simManager1.preferredLanguages[0] + "_" + LocalePlugin.mccToCountryCode(simManager1.mobileCountryCode);
38+ if (root.simManager0.present && root.simManager0.preferredLanguages.length > 0) {
39+ detectedLang = root.simManager0.preferredLanguages[0] + "_" + LocalePlugin.mccToCountryCode(root.simManager0.mobileCountryCode);
40+ } else if (root.simManager1.present && root.simManager1.preferredLanguages.length > 0) {
41+ detectedLang = root.simManager1.preferredLanguages[0] + "_" + LocalePlugin.mccToCountryCode(root.simManager1.mobileCountryCode);
4242 } else if (plugin.currentLanguage != -1) {
4343 detectedLang = plugin.languageCodes[plugin.currentLanguage].split(".")[0]; // remove the encoding part, after dot (en_US.utf8 -> en_US)
4444 } else {
@@ -161,7 +161,7 @@ LocalComponents.Page {
161161 i18n.language = plugin.languageCodes[plugin.currentLanguage]; // re-notify of change after above call (for qlocale change)
162162 root.countryCode = plugin.languageCodes[plugin.currentLanguage].split('_')[1].split('.')[0]; // extract the country code, save it for the timezone page
163163
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
165165 pageStack.next();
166166 else
167167 pageStack.load(Qt.resolvedUrl("sim.qml")); // show the SIM page
qml/Wizard/Pages/sim.qml+4−8
@@ -29,25 +29,21 @@ LocalComponents.Page {
2929 customTitle: true
3030 hasBackButton: false
3131
32− property bool hadSIM: simManager0.present || simManager1.present
32+ property bool hadSIM: root.simManager0.present || root.simManager1.present
3333
3434 Timer {
3535 id: timer
3636 interval: 300
3737 running: true
3838 onTriggered: {
39− print("=== SIM page: timer triggered");
40− hadSIM = simManager0.present || simManager1.present;
41− print("=== SIM page: had sim:", hadSIM);
39+ hadSIM = root.simManager0.present || root.simManager1.present;
4240 }
4341 }
4442
4543 Connections {
46− target: modemManager
44+ target: root.modemManager
4745 onGotSimCardChanged: {
48− print("=== SIM page: SIM card inserted");
49− if (!hadSIM && modemManager.gotSimCard) { // show the restart dialog in case a SIM gets inserted
50− print("=== SIM page: showing reboot dialog");
46+ if (!hadSIM && root.modemManager.gotSimCard) { // show the restart dialog in case a SIM gets inserted
5147 restartDialog.visible = true;
5248 }
5349 }