Unity 8
ModemInfoItem.qml
1 /*
2  * Copyright 2014,2015 Canonical Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 import QtQuick 2.4
18 import QtQuick.Layouts 1.1
19 import Ubuntu.Components 1.3
20 import Ubuntu.Components.ListItems 1.3 as ListItem
21 
22 ListItem.Empty {
23  id: menu
24  implicitHeight: mainColumn.implicitHeight
25  + mainColumn.anchors.topMargin
26  + mainColumn.anchors.bottomMargin
27 
28  property alias statusIcon: statusIcon.name
29  property alias statusText: labelStatus.text
30  property alias connectivityIcon: iconConnectivity.name
31  property alias simIdentifierText: labelSimIdentifier.text
32  property bool locked : false
33  property bool roaming: false
34  signal unlock
35 
36  ColumnLayout {
37  id: mainColumn
38  anchors.fill: parent
39  anchors.margins: menu.__contentsMargins
40  spacing: units.gu(0.5)
41 
42  Label {
43  id: labelSimIdentifier
44  elide: Text.ElideRight
45  visible: text !== ""
46  font.bold: true
47  opacity: menu.locked ? 0.6 : 1.0
48  }
49 
50  RowLayout {
51  id: statusRow
52  spacing: units.gu(1)
53 
54  height: labelStatus.height
55  width: parent.width
56 
57  Label {
58  id: labelStatus
59  elide: Text.ElideRight
60  opacity: 0.6
61  }
62 
63  RowLayout {
64  spacing: 0.5
65  height: parent.height
66  Icon {
67  id: statusIcon
68  color: theme.palette.selected.backgroundText
69 
70  Layout.preferredHeight: parent.height
71  Layout.preferredWidth: Layout.preferredHeight
72 
73  visible: name !== ""
74  }
75 
76  Icon {
77  id: iconConnectivity
78  color: theme.palette.selected.backgroundText
79 
80  Layout.preferredHeight: parent.height
81  Layout.preferredWidth: Layout.preferredHeight
82 
83  visible: name !== ""
84  }
85  }
86 
87  Item {
88  // eat up all the excess space so that RoamingIndication
89  // ends up to the far right
90  Layout.fillWidth: true
91  }
92 
93  RoamingIndication {
94  id: roamingIndication
95  visible: menu.roaming
96  Layout.fillHeight: true
97  }
98  }
99 
100  Button {
101  id: buttonUnlock
102  objectName: "buttonUnlockSim"
103  visible: menu.locked
104 
105  text: i18n.tr("Unlock SIM")
106  Layout.preferredWidth: implicitWidth + units.gu(5)
107 
108  onTriggered: menu.unlock()
109  }
110  }
111 }