2 * Copyright 2013 Canonical Ltd.
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.
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.
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/>.
17 * Nick Dedekind <nick.dedekind@canonical.com>
21import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators.Network 0.1 as ICNetwork
23import QMenuModel 0.1 as QMenuModel
28 property var model: null
31 "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
32 "unity.widgets.systemsettings.tablet.switch" : switchMenu,
34 "com.canonical.indicator.button" : buttonMenu,
35 "com.canonical.indicator.div" : divMenu,
36 "com.canonical.indicator.section" : sectionMenu,
37 "com.canonical.indicator.progress" : progressMenu,
38 "com.canonical.indicator.slider" : sliderMenu,
39 "com.canonical.indicator.switch" : switchMenu,
41 "com.canonical.unity.slider" : sliderMenu,
42 "com.canonical.unity.switch" : switchMenu,
44 "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
45 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
50 Indicators.SliderMenuItem {
51 property QtObject menu: null
53 text: menu && menu.label ? menu.label : ""
54 icon: menu ? menu.icon : ""
55 minIcon: menu.ext.minIcon
56 maxIcon: menu.ext.maxIcon
58 minimumValue: menu.ext.minValue ? menu.ext.minValue : 0.0
60 var maximum = menu.ext.maxValue ? menu.ext.maxValue : 1.0
61 if (maximum <= minimumValue) {
62 return minimumValue + 1;
66 value: menu ? menu.actionState : 0.0
67 enabled: menu ? menu.sensitive : false
69 Component.onCompleted: {
70 model.loadExtendedAttributes(modelIndex, {'min-value': 'double',
71 'max-value': 'double',
76 // FIXME: The interval should be [0.0 - 1.0]. Unfortunately, when
77 // reaching the boundaries (0.0 or 1.0), the value is converted
78 // to an integer when automatically wrapped in a variant when
79 // passed to QStateAction::updateState(…). The server chokes on
80 // those values, complaining that they’re not of the right type…
82 if (value == Math.round(value)) {
83 if (value >= maximumValue) {
84 model.changeState(modelIndex, maximumValue - 0.000001);
85 } else if (value <= minimumValue) {
86 model.changeState(modelIndex, minimumValue + 0.000001);
88 model.changeState(modelIndex, value * 1.000001);
91 model.changeState(modelIndex, value);
97 Component { id: divMenu; Indicators.DivMenuItem {} }
101 Indicators.ButtonMenuItem {
102 property QtObject menu: null
104 text: menu && menu.label ? menu.label : ""
105 enabled: menu ? menu.sensitive : false
107 onActivate: model.activate(modelIndex);
112 Indicators.SectionMenuItem {
113 property QtObject menu: null
115 text: menu && menu.label ? menu.label : ""
121 Indicators.ProgressMenuItem {
122 property QtObject menu: null
124 text: menu && menu.label ? menu.label : ""
125 icon: menu ? menu.icon : ""
126 value : menu ? menu.actionState : 0.0
132 Indicators.StandardMenuItem {
133 property QtObject menu: null
135 text: menu && menu.label ? menu.label : ""
136 icon: menu ? menu.icon : ""
137 checkable: menu ? (menu.isCheck || menu.isRadio) : false
138 checked: checkable ? menu.isToggled : false
139 enabled: menu ? menu.sensitive : false
141 onActivate: model.activate(modelIndex);
147 Indicators.SwitchMenuItem {
148 property QtObject menu: null
150 text: menu && menu.label ? menu.label : ""
151 icon: menu ? menu.icon : ""
152 checked: menu ? menu.isToggled : false
153 enabled: menu ? menu.sensitive : false
155 onActivate: model.activate(modelIndex);
161 Indicators.SectionMenuItem {
162 property QtObject menu: null
164 text: menu && menu.label ? menu.label : ""
165 busy: menu ? menu.ext.xCanonicalBusyAction : false
167 Component.onCompleted: {
168 model.loadExtendedAttributes(modelIndex, {'x-canonical-busy-action': 'bool'});
175 ICNetwork.AccessPoint {
176 property QtObject menu: null
177 property var strengthAction: QMenuModel.UnityMenuAction {
178 model: menuFactory.model ? menuFactory.model : null
179 name: menu ? menu.ext.xCanonicalWifiApStrengthAction : ""
182 text: menu && menu.label ? menu.label : ""
183 icon: menu ? menu.icon : ""
184 secure: menu ? menu.ext.xCanonicalWifiApIsSecure : false
185 adHoc: menu ? menu.ext.xCanonicalWifiApIsAdhoc : false
186 checked: menu ? menu.isToggled : false
187 signalStrength: strengthAction.valid ? strengthAction.state : 0
188 enabled: menu ? menu.sensitive : false
190 Component.onCompleted: {
191 model.loadExtendedAttributes(modelIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
192 'x-canonical-wifi-ap-is-secure': 'bool',
193 'x-canonical-wifi-ap-strength-action': 'string'});
195 onActivate: model.activate(modelIndex);
199 function load(modelData) {
200 if (modelData.type !== undefined) {
201 var component = _map[modelData.type];
202 if (component !== undefined) {
206 if (modelData.isSeparator) {
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list