on 3d752be help sign in
72 lines 2.0 kB history raw
1/*
2 * Copyright 2013 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 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 */
20import QtQuick 2.0
21import Ubuntu.Components 0.1
22import Ubuntu.Components.ListItems 0.1 as ListItem
23import Unity.Indicators 0.1 as Indicators
25Indicators.FramedMenuItem {
26 id: accessPoint
28 property bool checked: false
29 property bool secure: false
30 property bool adHoc: false
31 property int signalStrength: 0
33 signal activate()
35 onCheckedChanged: {
36 // Can't rely on binding. Checked is assigned on click.
37 checkBoxActive.checked = checked;
38 }
40 icon: {
41 var imageName = "nm-signal-100"
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";
53 }
55 if (secure) {
56 imageName += "-secure";
57 }
58 return "image://gicon/" + imageName;
59 }
61 iconFrame: false
62 control: CheckBox {
63 id: checkBoxActive
64 height: units.gu(4)
65 width: units.gu(4)
66 anchors.centerIn: parent
68 onClicked: {
69 accessPoint.activate();
70 }
71 }