on xenial help sign in
revised modem info item.
commit3614d990ddf81d3968e3910a1c1522d0093f2221 authorAntti Kaijanmäki <antti.kaijanmaki@canonical.com> dateWed 30 Jul 2014, 23:38 (12 years ago) parent1ddcc7d
3 files changed+73−96
qml/Panel/Indicators/MenuItemFactory.qml+7−7 qml/Panel/Indicators/ModemInfoItem.qml+54−66 qml/Panel/Indicators/RoamingIndication.qml+12−23
qml/Panel/Indicators/MenuItemFactory.qml+7−7
@@ -384,42 +384,42 @@ Item {
384384 property int menuIndex: -1
385385 property var extendedData: menuData && menuData.ext || undefined
386386
387− property var statusLabelAction: QMenuModel.UnityMenuAction {
387+ property var statusLabelAction: UnityMenuAction {
388388 model: menuModel
389389 index: menuIndex
390390 name: getExtendedProperty(extendedData, "xCanonicalModemStatusLabelAction", "")
391391 }
392392 statusText: statusLabelAction.valid ? statusLabelAction.state : ""
393393
394− property var statusIconAction: QMenuModel.UnityMenuAction {
394+ property var statusIconAction: UnityMenuAction {
395395 model: menuModel
396396 index: menuIndex
397397 name: getExtendedProperty(extendedData, "xCanonicalModemStatusIconAction", "")
398398 }
399399 statusIcon: statusIconAction.valid ? statusIconAction.state : ""
400400
401− property var connectivityIconAction: QMenuModel.UnityMenuAction {
401+ property var connectivityIconAction: UnityMenuAction {
402402 model: menuModel
403403 index: menuIndex
404404 name: getExtendedProperty(extendedData, "xCanonicalModemConnectivityIconAction", "")
405405 }
406406 connectivityIcon: connectivityIconAction.valid ? connectivityIconAction.state : ""
407407
408− property var simIdentifierLabelAction: QMenuModel.UnityMenuAction {
408+ property var simIdentifierLabelAction: UnityMenuAction {
409409 model: menuModel
410410 index: menuIndex
411411 name: getExtendedProperty(extendedData, "xCanonicalModemSimIdentifierLabelAction", "")
412412 }
413413 simIdentifierText: simIdentifierLabelAction.valid ? simIdentifierLabelAction.state : ""
414414
415− property var roamingAction: QMenuModel.UnityMenuAction {
415+ property var roamingAction: UnityMenuAction {
416416 model: menuModel
417417 index: menuIndex
418418 name: getExtendedProperty(extendedData, "xCanonicalModemRoamingAction", "")
419419 }
420420 roaming: roamingAction.valid ? roamingAction.state : false
421421
422− property var unlockAction: QMenuModel.UnityMenuAction {
422+ property var unlockAction: UnityMenuAction {
423423 model: menuModel
424424 index: menuIndex
425425 name: getExtendedProperty(extendedData, "xCanonicalModemLockedAction", "")
@@ -442,7 +442,7 @@ Item {
442442 menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-modem-status-label-action': 'string',
443443 'x-canonical-modem-status-icon-action': 'string',
444444 'x-canonical-modem-connectivity-icon-action': 'string',
445− 'x-canonical-modem-sim-identifier-label': 'string',
445+ 'x-canonical-modem-sim-identifier-label-action': 'string',
446446 'x-canonical-modem-roaming-action': 'string',
447447 'x-canonical-modem-locked-action': 'string'});
448448 }
qml/Panel/Indicators/ModemInfoItem.qml+54−66
@@ -18,12 +18,15 @@
1818 */
1919
2020import QtQuick 2.0
21+import QtQuick.Layouts 1.1
2122import Ubuntu.Components 0.1
2223import Ubuntu.Components.ListItems 0.1 as ListItem
2324
2425ListItem.Empty {
2526 id: menu
26− implicitHeight: units.gu(5.5)
27+ implicitHeight: mainColumn.implicitHeight
28+ + mainColumn.anchors.topMargin
29+ + mainColumn.anchors.bottomMargin
2730
2831 property alias statusIcon: statusIcon.name
2932 property alias statusText: labelStatus.text
@@ -33,93 +36,78 @@ ListItem.Empty {
3336 property bool roaming: false
3437 signal unlock
3538
36− Row {
37− id: iconRow
38− height: parent.height
39+ ColumnLayout {
40+ id: mainColumn
41+ anchors.fill: parent
42+ anchors.margins: menu.__contentsMargins
43+ spacing: units.gu(0.5)
3944
40− anchors {
41− left: parent.left
42− top: parent.top
43− leftMargin: menu.__contentsMargins
44− verticalCenter: parent.verticalCenter
45− }
46−
47− Icon {
48− id: statusIcon
49− color: Theme.palette.selected.backgroundText
50− keyColor: "#cccccc"
51−
52− width: height
53− height: Math.min(units.gu(5), parent.height - units.gu(1))
45+ Label {
46+ id: labelSimIdentifier
47+ elide: Text.ElideRight
48+ visible: text !== ""
49+ font.bold: true
50+ opacity: menu.locked ? 0.6 : 1.0
5451 }
5552
56− Icon {
57− id: iconConnectivity
58− color: Theme.palette.selected.backgroundText
59− keyColor: "#cccccc"
53+ RowLayout {
54+ id: statusRow
55+ spacing: units.gu(1)
6056
61− width: height
62− height: Math.min(units.gu(5), parent.height - units.gu(1))
63− }
64− }
57+ height: labelStatus.height
58+ width: parent.width
6559
66− Column {
67− id: columnStatus
68− anchors {
69− left: iconRow.right
70− leftMargin: units.gu(1)
71− verticalCenter: parent.verticalCenter
72− rightMargin: menu.__contentsMargins
73− }
60+ Label {
61+ id: labelStatus
62+ elide: Text.ElideRight
63+ opacity: 0.6
64+ }
7465
75− Label {
76− id: labelStatus
66+ RowLayout {
67+ spacing: 0.5
68+ height: parent.height
69+ Icon {
70+ id: statusIcon
71+ color: Theme.palette.selected.backgroundText
7772
78− elide: Text.ElideRight
79− }
73+ width: height
74+ height: parent.height
8075
81− Label {
82− id: labelSimIdentifier
76+ visible: name !== ""
77+ }
8378
84− elide: Text.ElideRight
85− visible: text !== ""
79+ Icon {
80+ id: iconConnectivity
81+ color: Theme.palette.selected.backgroundText
8682
87− fontSize: "x-small"
88− font.bold: true
89− }
90− }
83+ width: height
84+ height: parent.height
9185
92− Item {
93− height: parent.height
86+ visible: name !== ""
87+ }
88+ }
9489
95− anchors {
96− right: parent.right
97− rightMargin: menu.__contentsMargins
98− verticalCenter: parent.verticalCenter
99− }
90+ Item {
91+ // eat up all the excess space so that RoamingIndication
92+ // ends up to the far right
93+ Layout.fillWidth: true
94+ }
10095
101− RoamingIndication {
102− id: roamingIndication
103− anchors {
104− right: parent.right
105− verticalCenter: parent.verticalCenter
96+ RoamingIndication {
97+ id: roamingIndication
98+ visible: menu.roaming
99+ height: parent.height
106100 }
107− visible: menu.roaming
108− height: Math.min(units.gu(5), parent.height - units.gu(1))
109101 }
110102
111103 Button {
112− anchors {
113− right: parent.right
114− verticalCenter: parent.verticalCenter
115− }
116104 id: buttonUnlock
117105 objectName: "buttonUnlockSim"
118106 visible: menu.locked
119107
120− text: i18n.tr("Unlock")
108+ text: i18n.tr("Unlock SIM")
109+ Layout.preferredWidth: implicitWidth + units.gu(5)
121110
122− height: Math.min(units.gu(4), parent.height - units.gu(1))
123111 onTriggered: menu.unlock()
124112 }
125113 }
qml/Panel/Indicators/RoamingIndication.qml+12−23
@@ -18,38 +18,27 @@
1818 */
1919
2020import QtQuick 2.0
21+import QtQuick.Layouts 1.1
22+
2123import Ubuntu.Components 0.1
2224
23−Item {
24− width: (labelRoaming.width > iconRoaming.width) ? labelRoaming.width : iconRoaming.width
25+RowLayout {
26+ spacing: units.gu(0.5)
27+ Label {
28+ id: labelRoaming
29+ elide: Text.ElideRight
30+ fontSize: "x-small"
31+ text: i18n.tr("Roaming")
32+ opacity: 0.6
33+ }
2534
2635 Icon {
2736 id: iconRoaming
28− anchors {
29− top: parent.top
30− horizontalCenter: parent.horizontalCenter
31− }
32−
3337 color: Theme.palette.selected.backgroundText
34− keyColor: "#cccccc"
3538
39+ height: parent.height
3640 width: height
37− height: units.gu(4)
3841
3942 name: "network-cellular-roaming"
4043 }
41−
42− Label {
43− id: labelRoaming
44− anchors {
45− bottom: parent.bottom
46− horizontalCenter: parent.horizontalCenter
47− }
48− elide: Text.ElideRight
49−
50− fontSize: "x-small"
51− font.bold: true
52−
53− text: i18n.tr("roaming")
54− }
5544}