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
118 enabled: menu ? menu.sensitive : false
124 Indicators.StandardMenuItem {
125 property QtObject menu: null
127 text: menu && menu.label ? menu.label : ""
128 icon: menu && menu.icon ? menu.icon : ""
129 checkable: menu ? (menu.isCheck || menu.isRadio) : false
130 checked: checkable ? menu.isToggled : false
131 enabled: menu ? menu.sensitive : false
134 model.activate(modelIndex);
141 Indicators.SwitchMenuItem {
142 property QtObject menu: null
144 text: menu && menu.label ? menu.label : ""
145 icon: menu && menu.icon ? menu.icon : ""
146 checked: menu ? menu.isToggled : false
147 enabled: menu ? menu.sensitive : false
150 model.activate(modelIndex);
157 Indicators.SectionMenuItem {
158 property QtObject menu: null
160 text: menu && menu.label ? menu.label : ""
161 busy: menu ? menu.ext.xCanonicalBusyAction : false
163 Component.onCompleted: {
164 model.loadExtendedAttributes(modelIndex, {'x-canonical-busy-action': 'bool'});
171 ICNetwork.AccessPoint {
172 property QtObject menu: null
173 property var strengthAction: QMenuModel.UnityMenuAction {
174 model: menuFactory.model ? menuFactory.model : null
176 name: menu ? menu.ext.xCanonicalWifiApStrengthAction : ""
179 text: menu && menu.label ? menu.label : ""
180 secure: menu ? menu.ext.xCanonicalWifiApIsSecure : false
181 adHoc: menu ? menu.ext.xCanonicalWifiApIsAdhoc : false
182 checked: menu ? menu.isToggled : false
183 signalStrength: strengthAction.valid ? strengthAction.state : 0
184 enabled: menu ? menu.sensitive : false
186 Component.onCompleted: {
187 model.loadExtendedAttributes(modelIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
188 'x-canonical-wifi-ap-is-secure': 'bool',
189 'x-canonical-wifi-ap-strength-action': 'string'});
192 model.activate(modelIndex);
199 ICMessaging.MessageMenuItemFactory {
201 property QtObject menu: null
202 model: menuFactory.model ? menuFactory.model : null
204 Component.onCompleted: {
205 model.loadExtendedAttributes(modelIndex, {'x-canonical-time': 'int64',
206 'x-canonical-text': 'string',
207 'x-canonical-message-actions': 'variant',
209 'x-canonical-app-icon': 'icon'});
216 ICMessaging.GroupedMessage {
217 property QtObject menu: null
219 title: menu && menu.label ? menu.label : ""
220 count: menu && menu.actionState[0] ? menu.actionState[0] : "0"
221 appIcon: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_app.svg"
223 Component.onCompleted: {
224 model.loadExtendedAttributes(modelIndex, {'icon': 'icon'});
227 model.activate(modelIndex, true);
230 model.activate(modelIndex, false);
235 function load(modelData) {
236 if (modelData.type !== undefined) {
237 var component = _map[modelData.type];
238 if (component !== undefined) {
242 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