~ci-train-bot/ubuntu-settings-components/ubuntu-settings-components-ubuntu-zesty-2202

« back to all changes in this revision

Viewing changes to plugins/Ubuntu/Settings/Menus/ModemInfoItem.qml

  • Committer: Bileto Bot
  • Date: 2016-10-24 11:32:00 UTC
  • mfrom: (146.3.110 slots-layout)
  • Revision ID: ci-train-bot@canonical.com-20161024113200-85dvkl9m1o0msi5i
* Menus: rewrite components using ListItemLayout's and SlotsLayout's
* Bump revision to 0.10, as per Components removal

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 *
13
13
 * You should have received a copy of the GNU Lesser General Public License
14
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Author: Marco Trevisan <marco.trevisan@canonical.com>
15
17
 */
16
18
 
17
19
import QtQuick 2.4
18
20
import QtQuick.Layouts 1.1
19
21
import Ubuntu.Components 1.3
20
 
import Ubuntu.Components.ListItems 1.3 as ListItem
21
22
 
22
 
ListItem.Empty {
 
23
BaseMenu {
23
24
    id: menu
24
 
    implicitHeight:   mainColumn.implicitHeight
25
 
                    + mainColumn.anchors.topMargin
26
 
                    + mainColumn.anchors.bottomMargin
27
25
 
28
26
    property alias statusIcon: statusIcon.name
29
27
    property alias statusText: labelStatus.text
33
31
    property bool roaming: false
34
32
    signal unlock
35
33
 
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
 
        Row {
51
 
            id: statusRow
52
 
            spacing: units.gu(1)
53
 
 
54
 
            height: labelStatus.height
55
 
            width: parent.width
 
34
    implicitHeight: slotsLayout.height + (divider.visible ? divider.height : 0)
 
35
 
 
36
    SlotsLayout {
 
37
        id: slotsLayout
 
38
        objectName: "menuItemInfoSlotsLayout"
 
39
 
 
40
        mainSlot: ColumnLayout {
 
41
            spacing: units.gu(0.5)
56
42
 
57
43
            Label {
58
 
                id: labelStatus
 
44
                id: labelSimIdentifier
59
45
                elide: Text.ElideRight
60
 
                opacity: 0.6
61
 
            }
62
 
 
63
 
            Row {
64
 
                spacing: units.gu(0.5)
65
 
                height: parent.height
66
 
                Icon {
67
 
                    id: statusIcon
68
 
                    color: theme.palette.normal.backgroundText
69
 
 
70
 
                    height: labelStatus.height
71
 
                    width: height
72
 
 
73
 
                    visible: name !== ""
74
 
                }
75
 
 
76
 
                Icon {
77
 
                    id: iconConnectivity
78
 
                    color: theme.palette.normal.backgroundText
79
 
 
80
 
                    width: statusIcon.width // fix lp:1585645 by breaking the binding loop
81
 
                    height: width
82
 
 
83
 
                    visible: name !== ""
84
 
                }
85
 
            }
86
 
 
87
 
            Row {
88
 
                spacing: units.gu(0.5)
89
 
                height: parent.height
 
46
                visible: text !== ""
 
47
                font.bold: true
 
48
                opacity: menu.locked ? 0.6 : 1.0
 
49
            }
 
50
 
 
51
            Row {
 
52
                id: statusRow
 
53
                spacing: units.gu(1)
 
54
                height: labelStatus.height
90
55
 
91
56
                Label {
92
 
                    id: labelRoaming
93
 
                    visible: menu.roaming
 
57
                    id: labelStatus
94
58
                    elide: Text.ElideRight
95
 
                    fontSize: "x-small"
96
 
                    text: i18n.dtr("ubuntu-settings-components", "Roaming")
97
59
                    opacity: 0.6
98
60
                }
99
61
 
100
 
                Icon {
101
 
                    id: iconRoaming
102
 
                    color: theme.palette.normal.backgroundText
103
 
                    visible: menu.roaming
104
 
 
105
 
                    height: labelStatus.height
106
 
                    width: height
107
 
 
108
 
                    name: "network-cellular-roaming"
109
 
                }
110
 
            }
111
 
        }
112
 
 
113
 
        Button {
114
 
            id: buttonUnlock
115
 
            objectName: "buttonUnlockSim"
116
 
            visible: menu.locked
117
 
 
118
 
            text: i18n.dtr("ubuntu-settings-components", "Unlock SIM")
119
 
            Layout.preferredWidth: implicitWidth + units.gu(5)
120
 
 
121
 
            onTriggered: menu.unlock()
 
62
                Row {
 
63
                    spacing: units.gu(0.5)
 
64
                    height: parent.height
 
65
                    Icon {
 
66
                        id: statusIcon
 
67
                        color: theme.palette.normal.backgroundText
 
68
 
 
69
                        height: labelStatus.height
 
70
                        width: height
 
71
 
 
72
                        visible: name !== ""
 
73
                    }
 
74
 
 
75
                    Icon {
 
76
                        id: iconConnectivity
 
77
                        color: theme.palette.normal.backgroundText
 
78
 
 
79
                        width: statusIcon.width // fix lp:1585645 by breaking the binding loop
 
80
                        height: width
 
81
 
 
82
                        visible: name !== ""
 
83
                    }
 
84
                }
 
85
 
 
86
                Row {
 
87
                    spacing: units.gu(0.5)
 
88
                    height: parent.height
 
89
 
 
90
                    Label {
 
91
                        id: labelRoaming
 
92
                        visible: menu.roaming
 
93
                        elide: Text.ElideRight
 
94
                        fontSize: "x-small"
 
95
                        text: i18n.dtr("ubuntu-settings-components", "Roaming")
 
96
                        opacity: 0.6
 
97
                    }
 
98
 
 
99
                    Icon {
 
100
                        id: iconRoaming
 
101
                        color: theme.palette.normal.backgroundText
 
102
                        visible: menu.roaming
 
103
 
 
104
                        height: labelStatus.height
 
105
                        width: height
 
106
 
 
107
                        name: "network-cellular-roaming"
 
108
                    }
 
109
                }
 
110
            }
 
111
 
 
112
            Button {
 
113
                id: buttonUnlock
 
114
                objectName: "buttonUnlockSim"
 
115
                visible: menu.locked
 
116
 
 
117
                text: i18n.dtr("ubuntu-settings-components", "Unlock SIM")
 
118
                Layout.preferredWidth: implicitWidth + units.gu(5)
 
119
 
 
120
                onTriggered: menu.unlock()
 
121
            }
122
122
        }
123
123
    }
124
124
}