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
22Indicators.FakeIndicatorsModel {
25 property var originalModelData: [
27 "identifier": "indicator-keyboard",
28 "indicatorProperties": {
30 "busName": "com.canonical.indicators.fake0",
31 "menuObjectPath": "/com/canonical/indicators/fake0",
32 "actionsObjectPath": "/com/canonical/indicators/fake0"
36 "identifier": "fake-indicator-bluetooth",
37 "indicatorProperties": {
39 "busName": "com.canonical.indicators.fake1",
40 "menuObjectPath": "/com/canonical/indicators/fake1",
41 "actionsObjectPath": "/com/canonical/indicators/fake1"
45 "identifier": "fake-indicator-network",
46 "indicatorProperties": {
48 "busName": "com.canonical.indicators.fake2",
49 "menuObjectPath": "/com/canonical/indicators/fake2",
50 "actionsObjectPath": "/com/canonical/indicators/fake2"
54 "identifier": "fake-indicator-messages",
55 "indicatorProperties": {
57 "busName": "com.canonical.indicators.fake3",
58 "menuObjectPath": "/com/canonical/indicators/fake3",
59 "actionsObjectPath": "/com/canonical/indicators/fake3"
63 "identifier": "fake-indicator-sound",
64 "indicatorProperties": {
66 "busName": "com.canonical.indicators.fake4",
67 "menuObjectPath": "/com/canonical/indicators/fake4",
68 "actionsObjectPath": "/com/canonical/indicators/fake4"
72 "identifier": "fake-indicator-power",
73 "indicatorProperties": {
75 "busName": "com.canonical.indicators.fake5",
76 "menuObjectPath": "/com/canonical/indicators/fake5",
77 "actionsObjectPath": "/com/canonical/indicators/fake5"
81 "identifier": "fake-indicator-datetime",
82 "indicatorProperties": {
84 "busName": "com.canonical.indicators.fake6",
85 "menuObjectPath": "/com/canonical/indicators/fake6",
86 "actionsObjectPath": "/com/canonical/indicators/fake6"
90 "identifier": "fake-indicator-session",
91 "indicatorProperties": {
93 "busName": "com.canonical.indicators.fake7",
94 "menuObjectPath": "/com/canonical/indicators/fake7",
95 "actionsObjectPath": "/com/canonical/indicators/fake7"
100 Component.onCompleted: {
101 // init data for the fake indicator-keyboard
102 MockInputDeviceBackend.addMockDevice("/indicator_kbd0", InputInfo.Keyboard);
103 AccountsService.keymaps = ["us", "cs"];
106 Component.onDestruction: {
107 MockInputDeviceBackend.removeDevice("/indicator_kbd0");
108 AccountsService.keymaps = ["us"];
111 function load(profile) {
113 root.modelData = originalModelData;
115 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake0",
116 getUnityMenuModelData("indicator-keyboard",
119 [ "image://theme/input-keyboard-symbolic" ]));
120 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake1",
121 getUnityMenuModelData("fake-indicator-bluetooth",
124 [ "image://theme/bluetooth-active" ]));
125 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake2",
126 getUnityMenuModelData("fake-indicator-network",
129 [ "image://theme/simcard-error", "image://theme/wifi-high" ]));
130 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake3",
131 getUnityMenuModelData("fake-indicator-messages",
134 [ "image://theme/messages-new" ]));
135 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake4",
136 getUnityMenuModelData("fake-indicator-sound",
139 [ "image://theme/audio-volume-high" ]));
140 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake5",
141 getUnityMenuModelData("fake-indicator-power",
144 [ "image://theme/battery-020" ]));
145 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake6",
146 getUnityMenuModelData("fake-indicator-datetime",
147 "Upcoming Events (F)",
150 Indicators.UnityMenuModelCache.setCachedModelData("/com/canonical/indicators/fake7",
151 getUnityMenuModelData("fake-indicator-session",
154 ["image://theme/system-devices-panel"]));
157 function getUnityMenuModelData(identifier, title, label, icons) {
162 "isSeparator": false,
164 "type": "com.canonical.indicator.root",
181 for (var i = 0; i < 8; i++) {
186 "isSeparator": false,
196 submenus.push(submenu);
198 root[0]["submenu"] = submenus;
203 function setIndicatorVisible(identifier, visible) {
204 for (var i = 0; i < originalModelData.length; i++) {
205 if (originalModelData[i]["identifier"] === identifier) {
206 var data = Indicators.UnityMenuModelCache.getCachedModelData(
207 originalModelData[i]["indicatorProperties"]["menuObjectPath"]);
209 data[0]["rowData"]["actionState"]["visible"] = visible;
211 Indicators.UnityMenuModelCache.setCachedModelData(
212 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