on xenial help sign in
implement the in-place Restart dialog when SIM gets inserted
25811f3Lukáš Tinkl
qml/Wizard/Page.qml+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.3
17import QtQuick 2.3
18−import Ubuntu.Components 1.1
18+import Ubuntu.Components 1.2
19
19
20Item {
20Item {
21 readonly property real buttonMargin: units.gu(3)
21 readonly property real buttonMargin: units.gu(3)
qml/Wizard/Pages.qml+1−1
@@ -15,7 +15,7 @@
15 */
15 */
16
16
17import QtQuick 2.3
17import QtQuick 2.3
18−import Ubuntu.Components 1.1
18+import Ubuntu.Components 1.2
19import Ubuntu.SystemSettings.SecurityPrivacy 1.0
19import Ubuntu.SystemSettings.SecurityPrivacy 1.0
20import Wizard 0.1
20import Wizard 0.1
21import "../Components"
21import "../Components"
qml/Wizard/Pages/20-sim.qml+46−10
@@ -16,13 +16,14 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import MeeGo.QOfono 0.2
18import MeeGo.QOfono 0.2
19−import Ubuntu.Components 0.1
19+import Ubuntu.Components 1.2
20+import Ubuntu.Components.Popups 1.0
20import ".." as LocalComponents
21import ".." as LocalComponents
21
22
22LocalComponents.Page {
23LocalComponents.Page {
23 objectName: "simPage"
24 objectName: "simPage"
24
25
25− title: i18n.tr("Add a SIM card and restart your device")
26+ title: i18n.tr("No SIM card installed")
26 forwardButtonSourceComponent: forwardButton
27 forwardButtonSourceComponent: forwardButton
27
28
28 skipValid: !manager.available ||
29 skipValid: !manager.available ||
@@ -30,14 +31,42 @@ LocalComponents.Page {
30 && (manager.modems.length < 2 || simManager1.ready))
31 && (manager.modems.length < 2 || simManager1.ready))
31 skip: !manager.available || manager.modems.length === 0 || simManager0.present || simManager1.present
32 skip: !manager.available || manager.modems.length === 0 || simManager0.present || simManager1.present
32
33
34+ property bool hadModem: false
35+
36+ Component.onCompleted: {
37+ hadModem = simManager0.present || simManager1.present
38+ print("Had modem: " + hadModem)
39+ }
40+
41+ Dialog {
42+ id: restartDialog
43+ title: i18n.tr("SIM card added")
44+ text: i18n.tr("You must restart the device to access the mobile network.")
45+
46+ Button {
47+ id: restartButton
48+ text: i18n.tr("Restart")
49+ onClicked: {
50+ // TODO reboot for real
51+ PopupUtils.close(restartDialog)
52+ }
53+ }
54+ }
55+
33 OfonoManager {
56 OfonoManager {
34 id: manager
57 id: manager
35 property bool ready: false
58 property bool ready: false
36− onModemsChanged: ready = true
59+ onModemsChanged: {
60+ print("Modems changed " + modems)
61+ ready = true
62+ if (!hadModem && (simManager0.present || simManager1.present)) { // show the restart dialog in case a SIM gets inserted
63+ PopupUtils.open(restartDialog)
64+ }
65+ }
37 }
66 }
38
67
39 // Ideally we would query the system more cleverly than hardcoding two
68 // Ideally we would query the system more cleverly than hardcoding two
40− // modems. But we don't yet have a more clever way. :(
69+ // sims. But we don't yet have a more clever way. :(
41 OfonoSimManager {
70 OfonoSimManager {
42 id: simManager0
71 id: simManager0
43 modemPath: manager.modems.length >= 1 ? manager.modems[0] : ""
72 modemPath: manager.modems.length >= 1 ? manager.modems[0] : ""
@@ -51,19 +80,26 @@ LocalComponents.Page {
51 Column {
80 Column {
52 anchors.fill: content
81 anchors.fill: content
53 spacing: units.gu(4)
82 spacing: units.gu(4)
83+ anchors.topMargin: units.gu(4)
54
84
55 Label {
85 Label {
56 anchors.left: parent.left
86 anchors.left: parent.left
57 anchors.right: parent.right
87 anchors.right: parent.right
58 wrapMode: Text.Wrap
88 wrapMode: Text.Wrap
59− text: i18n.tr("Without it, you won’t be able to make calls or use text messaging.")
89+ text: i18n.tr("You won’t be able to make calls or use text messaging without a SIM.")
90+ fontSize: "small"
91+ font.weight: Font.Light
92+ color: restartDialog.visible ? Theme.palette.normal.backgroundText : "black"
60 }
93 }
61
94
62− Image {
95+ Label {
63− id: image
96+ anchors.left: parent.left
64− source: "data/meet_ubuntu_simcard@30.png"
97+ anchors.right: parent.right
65− height: units.gu(6.5)
98+ wrapMode: Text.Wrap
66− width: units.gu(9)
99+ text: i18n.tr("To proceed with no SIM tap <em>Skip</em>.")
100+ fontSize: "small"
101+ font.weight: Font.Light
102+ color: restartDialog.visible ? Theme.palette.normal.backgroundText : "black"
67 }
103 }
68 }
104 }
69
105