on xenial help sign in
refactor the modem handling up to allow for language and country detection from other pages
0ffae8dLukáš Tinkl
qml/Wizard/Page.qml+25
@@ -16,6 +16,7 @@
16
16
17import QtQuick 2.3
17import QtQuick 2.3
18import Ubuntu.Components 1.2
18import Ubuntu.Components 1.2
19+import MeeGo.QOfono 0.2
19
20
20Item {
21Item {
21 readonly property real buttonMargin: units.gu(3)
22 readonly property real buttonMargin: units.gu(3)
@@ -52,6 +53,30 @@ Item {
52 visible: false
53 visible: false
53 anchors.fill: parent
54 anchors.fill: parent
54
55
56+ property alias modemManager: modemManager
57+ property alias simManager0: simManager0
58+ property alias simManager1: simManager1
59+
60+ OfonoManager { // need it here for the language and country detection
61+ id: modemManager
62+ property bool ready: false
63+ onModemsChanged: {
64+ ready = true
65+ }
66+ }
67+
68+ // Ideally we would query the system more cleverly than hardcoding two
69+ // sims. But we don't yet have a more clever way. :(
70+ OfonoSimManager {
71+ id: simManager0
72+ modemPath: modemManager.modems.length >= 1 ? modemManager.modems[0] : ""
73+ }
74+
75+ OfonoSimManager {
76+ id: simManager1
77+ modemPath: modemManager.modems.length >= 2 ? modemManager.modems[1] : ""
78+ }
79+
55 // title
80 // title
56 Image {
81 Image {
57 id: titleRect
82 id: titleRect
qml/Wizard/Pages/20-sim.qml+7−22
@@ -29,10 +29,10 @@ LocalComponents.Page {
29 customTitle: true
29 customTitle: true
30 hasBackButton: false
30 hasBackButton: false
31
31
32− skipValid: !manager.available ||
32+ skipValid: !modemManager.available ||
33− (manager.ready && (manager.modems.length < 1 || simManager0.ready)
33+ (modemManager.ready && (modemManager.modems.length < 1 || simManager0.ready)
34− && (manager.modems.length < 2 || simManager1.ready))
34+ && (modemManager.modems.length < 2 || simManager1.ready))
35− skip: !manager.available || manager.modems.length === 0 || simManager0.present || simManager1.present
35+ skip: !modemManager.available || modemManager.modems.length === 0 || simManager0.present || simManager1.present
36
36
37 property bool hadModem: false
37 property bool hadModem: false
38
38
@@ -57,30 +57,15 @@ LocalComponents.Page {
57 }
57 }
58 }
58 }
59
59
60− OfonoManager {
60+ Connections {
61− id: manager
61+ target: modemManager
62− property bool ready: false
63 onModemsChanged: {
62 onModemsChanged: {
64− print("Modems changed " + modems)
65− ready = true
66 if (!hadModem && (simManager0.present || simManager1.present)) { // show the restart dialog in case a SIM gets inserted
63 if (!hadModem && (simManager0.present || simManager1.present)) { // show the restart dialog in case a SIM gets inserted
67− PopupUtils.open(restartDialog)
64+ restartDialog.visible = true
68 }
65 }
69 }
66 }
70 }
67 }
71
68
72− // Ideally we would query the system more cleverly than hardcoding two
73− // sims. But we don't yet have a more clever way. :(
74− OfonoSimManager {
75− id: simManager0
76− modemPath: manager.modems.length >= 1 ? manager.modems[0] : ""
77− }
78−
79− OfonoSimManager {
80− id: simManager1
81− modemPath: manager.modems.length >= 2 ? manager.modems[1] : ""
82− }
83−
84 Column {
69 Column {
85 anchors.fill: content
70 anchors.fill: content
86 spacing: units.gu(4)
71 spacing: units.gu(4)