@@ -22,13 +22,15 @@ import Ubuntu.Components 0.1
2222import Ubuntu.Components.ListItems 0.1 as ListItem
2323import Unity.Indicators 0.1 as Indicators
2424
25−Indicators.FramedMenuItem {
26− id: accessPoint
25+Indicators.BaseMenuItem {
26+ id: menuItem
27+ implicitHeight: units.gu(5.5)
2728
2829 property bool checked: false
2930 property bool secure: false
3031 property bool adHoc: false
3132 property int signalStrength: 0
33+ property alias text: label.text
3234
3335 signal activate()
3436
@@ -37,36 +39,79 @@ Indicators.FramedMenuItem {
3739 checkBoxActive.checked = checked;
3840 }
3941
40− icon: {
41− var imageName = "nm-signal-100"
42−
43− if (adHoc) {
44− imageName = "nm-adhoc";
45− } else if (signalStrength == 0) {
46− imageName = "nm-signal-00";
47− } else if (signalStrength <= 25) {
48− imageName = "nm-signal-25";
49− } else if (signalStrength <= 50) {
50− imageName = "nm-signal-50";
51− } else if (signalStrength <= 75) {
52− imageName = "nm-signal-75";
42+ onClicked: {
43+ checkBoxActive.clicked();
44+ }
45+
46+ CheckBox {
47+ id: checkBoxActive
48+ height: units.gu(3)
49+ width: units.gu(3)
50+
51+ anchors {
52+ left: parent.left
53+ leftMargin: menuItem.__contentsMargins
54+ verticalCenter: parent.verticalCenter
5355 }
5456
55− if (secure) {
56− imageName += "-secure";
57+ onClicked: {
58+ menuItem.activate();
5759 }
58− return "image://gicon/" + imageName;
5960 }
6061
61− iconFrame: false
62− control: CheckBox {
63− id: checkBoxActive
64− height: units.gu(4)
65− width: units.gu(4)
66− anchors.centerIn: parent
62+ Image {
63+ id: iconSignal
6764
68− onClicked: {
69− accessPoint.activate();
65+ width: height
66+ height: Math.min(units.gu(5), parent.height - units.gu(1))
67+ anchors {
68+ left: checkBoxActive.right
69+ leftMargin: units.gu(1)
70+ verticalCenter: parent.verticalCenter
71+ }
72+
73+ source: {
74+ var imageName = "nm-signal-100"
75+
76+ if (adHoc) {
77+ imageName = "nm-adhoc";
78+ } else if (signalStrength == 0) {
79+ imageName = "nm-signal-00";
80+ } else if (signalStrength <= 25) {
81+ imageName = "nm-signal-25";
82+ } else if (signalStrength <= 50) {
83+ imageName = "nm-signal-50";
84+ } else if (signalStrength <= 75) {
85+ imageName = "nm-signal-75";
86+ }
87+ return "image://theme/" + imageName;
88+ }
89+ }
90+
91+ Label {
92+ id: label
93+ anchors {
94+ left: iconSignal.right
95+ leftMargin: units.gu(1)
96+ verticalCenter: parent.verticalCenter
97+ right: iconSecure.visible ? iconSecure.left : parent.right
98+ rightMargin: menuItem.__contentsMargins
99+ }
100+ elide: Text.ElideRight
101+ opacity: label.enabled ? 1.0 : 0.5
102+ }
103+
104+ Image {
105+ id: iconSecure
106+ visible: secure
107+ source: "qrc:/indicators/artwork/network/secure.svg"
108+
109+ width: height
110+ height: Math.min(units.gu(4), parent.height - units.gu(1))
111+ anchors {
112+ right: parent.right
113+ rightMargin: units.gu(1)
114+ verticalCenter: parent.verticalCenter
70115 }
71116 }
72117}