2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU 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 General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import Unity.Indicators 0.1 as Indicators
19import Unity.InputInfo 0.1
20import AccountsService 0.1
21import "fakeindicatorsmodeldata.js" as FakeIndicators
23Indicators.FakeIndicatorsModel {
26 property var light: false
28 onLightChanged: load()
30 property var originalModelData: [
32 "identifier": "indicator-keyboard",
33 "indicatorProperties": {
35 "busName": "com.canonical.indicators.fake0",
36 "menuObjectPath": "/com/canonical/indicators/fake0",
37 "actionsObjectPath": "/com/canonical/indicators/fake0"
41 "identifier": "fake-indicator-bluetooth",
42 "indicatorProperties": {
44 "busName": "com.canonical.indicators.fake1",
45 "menuObjectPath": "/com/canonical/indicators/fake1",
46 "actionsObjectPath": "/com/canonical/indicators/fake1"
50 "identifier": "fake-indicator-network",
51 "indicatorProperties": {
53 "busName": "com.canonical.indicators.fake2",
54 "menuObjectPath": "/com/canonical/indicators/fake2",
55 "actionsObjectPath": "/com/canonical/indicators/fake2"
59 "identifier": "fake-indicator-messages",
60 "indicatorProperties": {
62 "busName": "com.canonical.indicators.fake3",
63 "menuObjectPath": "/com/canonical/indicators/fake3",
64 "actionsObjectPath": "/com/canonical/indicators/fake3"
68 "identifier": "fake-indicator-files",
69 "indicatorProperties": {
71 "busName": "com.canonical.indicators.fake4",
72 "menuObjectPath": "/com/canonical/indicators/fake4",
73 "actionsObjectPath": "/com/canonical/indicators/fake4"
77 "identifier": "fake-indicator-sound",
78 "indicatorProperties": {
80 "busName": "com.canonical.indicators.fake5",
81 "menuObjectPath": "/com/canonical/indicators/fake5",
82 "actionsObjectPath": "/com/canonical/indicators/fake5"
86 "identifier": "fake-indicator-power",
87 "indicatorProperties": {
89 "busName": "com.canonical.indicators.fake6",
90 "menuObjectPath": "/com/canonical/indicators/fake6",
91 "actionsObjectPath": "/com/canonical/indicators/fake6"
95 "identifier": "fake-indicator-datetime",
96 "indicatorProperties": {
98 "busName": "com.canonical.indicators.fake7",
99 "menuObjectPath": "/com/canonical/indicators/fake7",
100 "actionsObjectPath": "/com/canonical/indicators/fake7"
104 "identifier": "fake-indicator-session",
105 "indicatorProperties": {
107 "busName": "com.canonical.indicators.fake8",
108 "menuObjectPath": "/com/canonical/indicators/fake8",
109 "actionsObjectPath": "/com/canonical/indicators/fake8"
114 Component.onCompleted: {
115 // init data for the fake indicator-keyboard
116 MockInputDeviceBackend.addMockDevice("/indicator_kbd0", InputInfo.Keyboard);
117 AccountsService.keymaps = ["us", "cs"];
120 Component.onDestruction: {
121 MockInputDeviceBackend.removeDevice("/indicator_kbd0");
122 AccountsService.keymaps = ["us"];
125 function load(profile) {
127 root.modelData = originalModelData;
129 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake0",
130 getUnityMenuModelData("indicator-keyboard",
133 [ "image://theme/input-keyboard-symbolic" ],
135 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake1",
136 getUnityMenuModelData("fake-indicator-bluetooth",
139 [ "image://theme/bluetooth-active" ],
141 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake2",
142 getUnityMenuModelData("fake-indicator-network",
145 [ "image://theme/simcard-error", "image://theme/wifi-high" ],
147 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake3",
148 getUnityMenuModelData("fake-indicator-messages",
151 [ "image://theme/messages-new" ],
153 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake4",
154 getUnityMenuModelData("fake-indicator-files",
157 [ "image://theme/transfer-progress" ],
159 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake5",
160 getUnityMenuModelData("fake-indicator-sound",
163 [ "image://theme/audio-volume-high" ],
165 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake6",
166 getUnityMenuModelData("fake-indicator-power",
169 [ "image://theme/battery-020" ],
171 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake7",
172 getUnityMenuModelData("fake-indicator-datetime",
173 "Upcoming Events (F)",
177 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake8",
178 getUnityMenuModelData("fake-indicator-session",
181 ["image://theme/system-devices-panel"],
185 function getUnityMenuModelData(identifier, title, label, icons, light) {
186 var menudata = undefined;
189 var menudata = FakeIndicators.fakeMenuData[identifier];
193 if (menudata !== undefined) {
194 var rootState = menudata[0]["rowData"].actionState;
195 rootState.title = title;
196 rootState.label = label;
197 rootState.icons = icons;
205 "isSeparator": false,
207 "type": "com.canonical.indicator.root",
224 for (var i = 0; i < maxItems; i++) {
229 "isSeparator": false,
239 submenus.push(submenu);
241 root[0]["submenu"] = submenus;
246 function setIndicatorVisible(identifier, visible) {
247 for (var i = 0; i < originalModelData.length; i++) {
248 if (originalModelData[i]["identifier"] === identifier) {
249 var data = Indicators.UnityMenuModelCache.getCachedModelData(
250 originalModelData[i]["indicatorProperties"]["menuObjectPath"]);
252 data[0]["rowData"]["actionState"]["visible"] = visible;
254 Indicators.UnityMenuModelCache.setCachedModelData(
255 originalModelData[i]["indicatorProperties"]["menuObjectPath"],
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