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 originalModelData: [
28 "identifier": "indicator-keyboard",
29 "indicatorProperties": {
31 "busName": "com.canonical.indicators.fake0",
32 "menuObjectPath": "/com/canonical/indicators/fake0",
33 "actionsObjectPath": "/com/canonical/indicators/fake0"
37 "identifier": "fake-indicator-bluetooth",
38 "indicatorProperties": {
40 "busName": "com.canonical.indicators.fake1",
41 "menuObjectPath": "/com/canonical/indicators/fake1",
42 "actionsObjectPath": "/com/canonical/indicators/fake1"
46 "identifier": "fake-indicator-network",
47 "indicatorProperties": {
49 "busName": "com.canonical.indicators.fake2",
50 "menuObjectPath": "/com/canonical/indicators/fake2",
51 "actionsObjectPath": "/com/canonical/indicators/fake2"
55 "identifier": "fake-indicator-messages",
56 "indicatorProperties": {
58 "busName": "com.canonical.indicators.fake3",
59 "menuObjectPath": "/com/canonical/indicators/fake3",
60 "actionsObjectPath": "/com/canonical/indicators/fake3"
64 "identifier": "fake-indicator-files",
65 "indicatorProperties": {
67 "busName": "com.canonical.indicators.fake4",
68 "menuObjectPath": "/com/canonical/indicators/fake4",
69 "actionsObjectPath": "/com/canonical/indicators/fake4"
73 "identifier": "fake-indicator-sound",
74 "indicatorProperties": {
76 "busName": "com.canonical.indicators.fake5",
77 "menuObjectPath": "/com/canonical/indicators/fake5",
78 "actionsObjectPath": "/com/canonical/indicators/fake5"
82 "identifier": "fake-indicator-power",
83 "indicatorProperties": {
85 "busName": "com.canonical.indicators.fake6",
86 "menuObjectPath": "/com/canonical/indicators/fake6",
87 "actionsObjectPath": "/com/canonical/indicators/fake6"
91 "identifier": "fake-indicator-datetime",
92 "indicatorProperties": {
94 "busName": "com.canonical.indicators.fake7",
95 "menuObjectPath": "/com/canonical/indicators/fake7",
96 "actionsObjectPath": "/com/canonical/indicators/fake7"
100 "identifier": "fake-indicator-session",
101 "indicatorProperties": {
103 "busName": "com.canonical.indicators.fake8",
104 "menuObjectPath": "/com/canonical/indicators/fake8",
105 "actionsObjectPath": "/com/canonical/indicators/fake8"
110 Component.onCompleted: {
111 // init data for the fake indicator-keyboard
112 MockInputDeviceBackend.addMockDevice("/indicator_kbd0", InputInfo.Keyboard);
113 AccountsService.keymaps = ["us", "cs"];
116 Component.onDestruction: {
117 MockInputDeviceBackend.removeDevice("/indicator_kbd0");
118 AccountsService.keymaps = ["us"];
121 function load(profile) {
123 root.modelData = originalModelData;
125 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake0",
126 getUnityMenuModelData("indicator-keyboard",
129 [ "image://theme/input-keyboard-symbolic" ]));
130 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake1",
131 getUnityMenuModelData("fake-indicator-bluetooth",
134 [ "image://theme/bluetooth-active" ]));
135 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake2",
136 getUnityMenuModelData("fake-indicator-network",
139 [ "image://theme/simcard-error", "image://theme/wifi-high" ]));
140 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake3",
141 getUnityMenuModelData("fake-indicator-messages",
144 [ "image://theme/messages-new" ]));
145 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake4",
146 getUnityMenuModelData("fake-indicator-files",
149 [ "image://theme/transfer-progress" ]));
150 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake5",
151 getUnityMenuModelData("fake-indicator-sound",
154 [ "image://theme/audio-volume-high" ]));
155 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake6",
156 getUnityMenuModelData("fake-indicator-power",
159 [ "image://theme/battery-020" ]));
160 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake7",
161 getUnityMenuModelData("fake-indicator-datetime",
162 "Upcoming Events (F)",
165 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake8",
166 getUnityMenuModelData("fake-indicator-session",
169 ["image://theme/system-devices-panel"]));
172 function getUnityMenuModelData(identifier, title, label, icons) {
173 var menudata = FakeIndicators.fakeMenuData[identifier];
175 if (menudata !== undefined) {
176 var rootState = menudata[0]["rowData"].actionState;
177 rootState.title = title;
178 rootState.label = label;
179 rootState.icons = icons;
187 "isSeparator": false,
189 "type": "com.canonical.indicator.root",
206 for (var i = 0; i < 8; i++) {
211 "isSeparator": false,
221 submenus.push(submenu);
223 root[0]["submenu"] = submenus;
228 function setIndicatorVisible(identifier, visible) {
229 for (var i = 0; i < originalModelData.length; i++) {
230 if (originalModelData[i]["identifier"] === identifier) {
231 var data = Indicators.UnityMenuModelCache.getCachedModelData(
232 originalModelData[i]["indicatorProperties"]["menuObjectPath"]);
234 data[0]["rowData"]["actionState"]["visible"] = visible;
236 Indicators.UnityMenuModelCache.setCachedModelData(
237 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