@@ -16,13 +16,14 @@
1616
1717import QtQuick 2.0
1818import MeeGo.QOfono 0.2
19−import Ubuntu.Components 0.1
19+import Ubuntu.Components 1.2
20+import Ubuntu.Components.Popups 1.0
2021import ".." as LocalComponents
2122
2223LocalComponents.Page {
2324 objectName: "simPage"
2425
25− title: i18n.tr("Add a SIM card and restart your device")
26+ title: i18n.tr("No SIM card installed")
2627 forwardButtonSourceComponent: forwardButton
2728
2829 skipValid: !manager.available ||
@@ -30,14 +31,42 @@ LocalComponents.Page {
3031 && (manager.modems.length < 2 || simManager1.ready))
3132 skip: !manager.available || manager.modems.length === 0 || simManager0.present || simManager1.present
3233
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+
3356 OfonoManager {
3457 id: manager
3558 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+ }
3766 }
3867
3968 // 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. :(
4170 OfonoSimManager {
4271 id: simManager0
4372 modemPath: manager.modems.length >= 1 ? manager.modems[0] : ""
@@ -51,19 +80,26 @@ LocalComponents.Page {
5180 Column {
5281 anchors.fill: content
5382 spacing: units.gu(4)
83+ anchors.topMargin: units.gu(4)
5484
5585 Label {
5686 anchors.left: parent.left
5787 anchors.right: parent.right
5888 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"
6093 }
6194
62− Image {
63− id: image
64− source: "data/meet_ubuntu_simcard@30.png"
65− height: units.gu(6.5)
66− width: units.gu(9)
95+ Label {
96+ anchors.left: parent.left
97+ anchors.right: parent.right
98+ wrapMode: Text.Wrap
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"
67103 }
68104 }
69105