Unity 8
sim.qml
1 /*
2  * Copyright (C) 2013-2016 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 import QtQuick 2.12
18 import MeeGo.QOfono 0.2
19 import Ubuntu.Components 1.3
20 import Ubuntu.Components.Popups 1.3
21 import Unity.Session 0.1
22 import ".." as LocalComponents
23 
24 LocalComponents.Page {
25  objectName: "simPage"
26 
27  title: i18n.tr("No SIM card installed")
28  forwardButtonSourceComponent: forwardButton
29  customTitle: true
30  hasBackButton: false
31 
32  property bool hadSIM: root.simManager0.present || root.simManager1.present
33 
34  Timer {
35  id: timer
36  interval: 300
37  running: true
38  onTriggered: {
39  hadSIM = root.simManager0.present || root.simManager1.present;
40  }
41  }
42 
43  Connections {
44  target: root.modemManager
45  onGotSimCardChanged: {
46  if (!hadSIM && root.modemManager.gotSimCard) { // show the restart dialog in case a SIM gets inserted
47  restartDialog.visible = true;
48  }
49  }
50  }
51 
52  Dialog {
53  id: restartDialog
54  title: i18n.tr("SIM card added")
55  text: i18n.tr("You must restart the device to access the mobile network.")
56 
57  Button {
58  id: restartButton
59  text: i18n.tr("Restart")
60  onClicked: {
61  DBusUnitySessionService.reboot();
62  }
63  }
64  }
65 
66  Column {
67  anchors {
68  fill: content
69  leftMargin: staticMargin
70  rightMargin: staticMargin
71  }
72  spacing: units.gu(3)
73 
74  Label {
75  anchors.left: parent.left
76  anchors.right: parent.right
77  wrapMode: Text.Wrap
78  text: i18n.tr("You won’t be able to make calls or use text messaging without a SIM.")
79  fontSize: "small"
80  font.weight: Font.Light
81  lineHeight: 1.2
82  color: restartDialog.visible ? theme.palette.normal.backgroundText : textColor
83  }
84 
85  Label {
86  anchors.left: parent.left
87  anchors.right: parent.right
88  wrapMode: Text.Wrap
89  textFormat: Text.RichText
90  text: i18n.tr("To proceed with no SIM tap Skip.")
91  fontSize: "small"
92  font.weight: Font.Light
93  lineHeight: 1.2
94  color: restartDialog.visible ? theme.palette.normal.backgroundText : textColor
95  }
96  }
97 
98  Component {
99  id: forwardButton
100  LocalComponents.StackButton {
101  text: i18n.tr("Skip")
102  onClicked: {
103  seenSIMPage = true;
104  pageStack.next();
105  }
106  }
107  }
108 }