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
25import Ubuntu.Components 0.1
30 property var model: null
33 "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
34 "unity.widgets.systemsettings.tablet.switch" : switchMenu,
36 "com.canonical.indicator.button" : buttonMenu,
37 "com.canonical.indicator.div" : divMenu,
38 "com.canonical.indicator.section" : sectionMenu,
39 "com.canonical.indicator.progress" : progressMenu,
40 "com.canonical.indicator.slider" : sliderMenu,
41 "com.canonical.indicator.switch" : switchMenu,
43 "com.canonical.indicator.messages.messageitem" : messageItem,
44 "com.canonical.indicator.messages.sourceitem" : groupedMessage,
46 "com.canonical.unity.slider" : sliderMenu,
47 "com.canonical.unity.switch" : switchMenu,
49 "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
50 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
53 Component { id: divMenu; Indicators.DivMenuItem {} }
57 Indicators.SliderMenuItem {
58 property QtObject menu: null
60 text: menu && menu.label ? menu.label : ""
61 icon: menu && menu.icon ? menu.icon : ""
62 minIcon: menu && menu.ext.minIcon ? menu.ext.minIcon : ""
63 maxIcon: menu && menu.ext.maxIcon ? menu.ext.maxIcon : ""
65 minimumValue: menu.ext.minValue ? menu.ext.minValue : 0.0
67 var maximum = menu.ext.maxValue ? menu.ext.maxValue : 1.0
68 if (maximum <= minimumValue) {
69 return minimumValue + 1;
73 value: menu ? menu.actionState : 0.0
74 enabled: menu ? menu.sensitive : false
76 Component.onCompleted: {
77 model.loadExtendedAttributes(modelIndex, {'min-value': 'double',
78 'max-value': 'double',
84 model.changeState(modelIndex, value);
91 Indicators.ButtonMenuItem {
92 property QtObject menu: null
94 text: menu && menu.label ? menu.label : ""
95 enabled: menu ? menu.sensitive : false
98 model.activate(modelIndex);
99 shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
105 Indicators.SectionMenuItem {
106 property QtObject menu: null
108 text: menu && menu.label ? menu.label : ""
114 Indicators.ProgressMenuItem {
115 property QtObject menu: null
117 text: menu && menu.label ? menu.label : ""
118 icon: menu ? menu.icon : ""
119 value : menu ? menu.actionState : 0.0
120 enabled: menu ? menu.sensitive : false
126 Indicators.StandardMenuItem {
127 property QtObject menu: null
129 text: menu && menu.label ? menu.label : ""
130 icon: menu && menu.icon ? menu.icon : ""
131 checkable: menu ? (menu.isCheck || menu.isRadio) : false
132 checked: checkable ? menu.isToggled : false
133 enabled: menu ? menu.sensitive : false
136 model.activate(modelIndex);
137 shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
144 Indicators.SwitchMenuItem {
145 property QtObject menu: null
147 text: menu && menu.label ? menu.label : ""
148 icon: menu && menu.icon ? menu.icon : ""
149 checked: menu ? menu.isToggled : false
150 enabled: menu ? menu.sensitive : false
153 model.activate(modelIndex);
154 shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
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
180 name: menu ? menu.ext.xCanonicalWifiApStrengthAction : ""
183 text: menu && menu.label ? menu.label : ""
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'});
196 model.activate(modelIndex);
197 shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
204 ICMessaging.MessageMenuItemFactory {
206 property QtObject menu: null
207 model: menuFactory.model ? menuFactory.model : null
209 Component.onCompleted: {
210 model.loadExtendedAttributes(modelIndex, {'x-canonical-time': 'int64',
211 'x-canonical-text': 'string',
212 'x-canonical-message-actions': 'variant',
214 'x-canonical-app-icon': 'icon'});
221 ICMessaging.GroupedMessage {
222 property QtObject menu: null
224 title: menu && menu.label ? menu.label : ""
225 count: menu && menu.actionState[0] ? menu.actionState[0] : "0"
226 appIcon: menu && menu.ext.icon !== undefined ? menu.ext.icon : "qrc:/indicators/artwork/messaging/default_app.svg"
228 Component.onCompleted: {
229 model.loadExtendedAttributes(modelIndex, {'icon': 'icon'});
232 model.activate(modelIndex, true);
233 shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
236 model.activate(modelIndex, false);
241 function load(modelData) {
242 if (modelData.type !== undefined) {
243 var component = _map[modelData.type];
244 if (component !== undefined) {
248 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