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 Unity.Indicators.Messaging 0.1 as ICMessaging
24import QMenuModel 0.1 as QMenuModel
29 property var model: null
32 "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
33 "unity.widgets.systemsettings.tablet.switch" : switchMenu,
35 "com.canonical.indicator.button" : buttonMenu,
36 "com.canonical.indicator.div" : divMenu,
37 "com.canonical.indicator.section" : sectionMenu,
38 "com.canonical.indicator.progress" : progressMenu,
39 "com.canonical.indicator.slider" : sliderMenu,
40 "com.canonical.indicator.switch" : switchMenu,
42 "com.canonical.indicator.messages.messageitem" : messageItem,
43 "com.canonical.indicator.messages.sourceitem" : groupedMessage,
45 "com.canonical.unity.slider" : sliderMenu,
46 "com.canonical.unity.switch" : switchMenu,
48 "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
49 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
52 Component { id: divMenu; Indicators.DivMenuItem {} }
56 Indicators.SliderMenuItem {
57 property QtObject menu: null
59 text: menu && menu.label ? menu.label : ""
60 icon: menu && menu.icon ? menu.icon : ""
61 minIcon: menu && menu.ext.minIcon ? menu.ext.minIcon : ""
62 maxIcon: menu && menu.ext.maxIcon ? menu.ext.maxIcon : ""
64 minimumValue: menu.ext.minValue ? menu.ext.minValue : 0.0
66 var maximum = menu.ext.maxValue ? menu.ext.maxValue : 1.0
67 if (maximum <= minimumValue) {
68 return minimumValue + 1;
72 value: menu ? menu.actionState : 0.0
73 enabled: menu ? menu.sensitive : false
75 Component.onCompleted: {
76 model.loadExtendedAttributes(modelIndex, {'min-value': 'double',
77 'max-value': 'double',
83 model.changeState(modelIndex, value);
90 Indicators.ButtonMenuItem {
91 property QtObject menu: null
93 text: menu && menu.label ? menu.label : ""
94 enabled: menu ? menu.sensitive : false
97 model.activate(modelIndex);
103 Indicators.SectionMenuItem {
104 property QtObject menu: null
106 text: menu && menu.label ? menu.label : ""
112 Indicators.ProgressMenuItem {
113 property QtObject menu: null
115 text: menu && menu.label ? menu.label : ""
116 icon: menu ? menu.icon : ""
117 value : menu ? menu.actionState : 0.0
123 Indicators.StandardMenuItem {
124 property QtObject menu: null
126 text: menu && menu.label ? menu.label : ""
127 icon: menu && menu.icon ? menu.icon : ""
128 checkable: menu ? (menu.isCheck || menu.isRadio) : false
129 checked: checkable ? menu.isToggled : false
130 enabled: menu ? menu.sensitive : false
133 model.activate(modelIndex);
140 Indicators.SwitchMenuItem {
141 property QtObject menu: null
143 text: menu && menu.label ? menu.label : ""
144 icon: menu && menu.icon ? menu.icon : ""
145 checked: menu ? menu.isToggled : false
146 enabled: menu ? menu.sensitive : false
149 model.activate(modelIndex);
156 Indicators.SectionMenuItem {
157 property QtObject menu: null
159 text: menu && menu.label ? menu.label : ""
160 busy: menu ? menu.ext.xCanonicalBusyAction : false
162 Component.onCompleted: {
163 model.loadExtendedAttributes(modelIndex, {'x-canonical-busy-action': 'bool'});
170 ICNetwork.AccessPoint {
171 property QtObject menu: null
172 property var strengthAction: QMenuModel.UnityMenuAction {
173 model: menuFactory.model ? menuFactory.model : null
175 name: menu ? menu.ext.xCanonicalWifiApStrengthAction : ""
178 text: menu && menu.label ? menu.label : ""
179 secure: menu ? menu.ext.xCanonicalWifiApIsSecure : false
180 adHoc: menu ? menu.ext.xCanonicalWifiApIsAdhoc : false
181 checked: menu ? menu.isToggled : false
182 signalStrength: strengthAction.valid ? strengthAction.state : 0
183 enabled: menu ? menu.sensitive : false
185 Component.onCompleted: {
186 model.loadExtendedAttributes(modelIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
187 'x-canonical-wifi-ap-is-secure': 'bool',
188 'x-canonical-wifi-ap-strength-action': 'string'});
191 model.activate(modelIndex);
198 ICMessaging.MessageMenuItemFactory {
200 property QtObject menu: null
201 model: menuFactory.model ? menuFactory.model : null
203 Component.onCompleted: {
204 model.loadExtendedAttributes(modelIndex, {'x-canonical-time': 'int64',
205 'x-canonical-text': 'string',
206 'x-canonical-message-actions': 'variant',
208 'x-canonical-app-icon': 'icon'});
215 ICMessaging.GroupedMessage {
216 property QtObject menu: null
218 title: menu && menu.label ? menu.label : ""
219 count: menu && menu.actionState[0] ? menu.actionState[0] : "0"
220 appIcon: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_app.svg"
222 Component.onCompleted: {
223 model.loadExtendedAttributes(modelIndex, {'icon': 'icon'});
226 model.activate(modelIndex, true);
229 model.activate(modelIndex, false);
234 function load(modelData) {
235 if (modelData.type !== undefined) {
236 var component = _map[modelData.type];
237 if (component !== undefined) {
241 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