Merge lp:~mzanetti/unity8/fix_snap_decision_test-rtm into lp:unity8/rtm-14.09
- fix_snap_decision_test-rtm
- Merge into rtm-14.09
Status: | Superseded |
---|---|
Proposed branch: | lp:~mzanetti/unity8/fix_snap_decision_test-rtm |
Merge into: | lp:unity8/rtm-14.09 |
Diff against target: |
3418 lines (+1131/-896) 76 files modified
plugins/AccountsService/AccountsService.qmltypes (+2/-0) plugins/Dash/Dash.qmltypes (+3/-0) plugins/LightDM/LightDM.qmltypes (+1/-0) plugins/Ubuntu/Payments/Payments.qmltypes (+1/-0) plugins/Unity/DashCommunicator/DashCommunicator.qmltypes (+17/-4) plugins/Unity/Indicators/CMakeLists.txt (+1/-0) plugins/Unity/Indicators/Indicators.qmltypes (+10/-7) plugins/Unity/Indicators/plugin.cpp (+8/-2) plugins/Unity/Indicators/plugin.h (+1/-1) plugins/Unity/Indicators/sharedunitymenumodel.cpp (+87/-0) plugins/Unity/Indicators/sharedunitymenumodel.h (+66/-0) plugins/Unity/Indicators/unitymenumodelcache.cpp (+28/-13) plugins/Unity/Indicators/unitymenumodelcache.h (+14/-9) plugins/Unity/Launcher/Launcher.qmltypes (+17/-12) plugins/Unity/Session/Session.qmltypes (+10/-0) plugins/Utils/Utils.qmltypes (+6/-0) po/ast.po (+9/-8) po/en_AU.po (+16/-22) po/es.po (+5/-5) po/fa.po (+4/-10) po/fr.po (+5/-5) po/gd.po (+4/-4) po/hu.po (+3/-9) po/is.po (+9/-9) qml/Greeter/Clock.qml (+9/-9) qml/Notifications/Notifications.qml (+1/-0) qml/Panel/Indicators/CachedUnityMenuModel.qml (+0/-39) qml/Panel/Indicators/IndicatorBase.qml (+2/-2) qml/Shell.qml (+1/-1) tests/mocks/AccountsService/AccountsService.qmltypes (+2/-0) tests/mocks/LightDM/LightDM.qmltypes (+1/-0) tests/mocks/QMenuModel/QMenuModel.qmltypes (+1/-1) tests/mocks/QMenuModel/unitymenumodel.cpp (+1/-2) tests/mocks/QMenuModel/unitymenumodel.h (+6/-2) tests/mocks/Ubuntu/Payments/Payments.qmltypes (+2/-0) tests/mocks/Ubuntu/Telephony/Telephony.qmltypes (+2/-1) tests/mocks/Unity/Application/Application.qmltypes (+13/-0) tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes (+2/-2) tests/mocks/Unity/Indicators/CMakeLists.txt (+3/-10) tests/mocks/Unity/Indicators/FakeMenuPage.qml (+0/-27) tests/mocks/Unity/Indicators/Indicators.qmltypes (+41/-11) tests/mocks/Unity/Indicators/IndicatorsModel.qml (+143/-35) tests/mocks/Unity/Indicators/RootActionState.qml (+17/-9) tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp (+60/-29) tests/mocks/Unity/Indicators/fakeindicatorsmodel.h (+8/-2) tests/mocks/Unity/Indicators/fakeplugin.cpp (+8/-4) tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp (+57/-0) tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h (+50/-0) tests/mocks/Unity/Indicators/indicators_fake.qrc (+0/-14) tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml (+0/-35) tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml (+0/-35) tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml (+0/-35) tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml (+0/-35) tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml (+0/-35) tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml (+0/-23) tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml (+0/-23) tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml (+0/-23) tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml (+0/-23) tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml (+0/-23) tests/mocks/Unity/Indicators/qmldir (+0/-1) tests/mocks/Unity/Launcher/Launcher.qmltypes (+13/-0) tests/mocks/Unity/Unity.qmltypes (+32/-0) tests/plugins/Unity/Indicators/CMakeLists.txt (+1/-0) tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp (+92/-0) tests/qmltests/CMakeLists.txt (+7/-8) tests/qmltests/Greeter/tst_Clock.qml (+57/-40) tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml (+0/-137) tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml (+21/-24) tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml (+0/-8) tests/qmltests/Panel/tst_IndicatorItem.qml (+1/-1) tests/qmltests/Panel/tst_IndicatorRow.qml (+17/-19) tests/qmltests/Panel/tst_Indicators.qml (+1/-0) tests/qmltests/Panel/tst_MenuContent.qml (+0/-8) tests/qmltests/tst_Shell.qml (+128/-40) tests/qmltests/tst_ShellWithPin.qml (+2/-0) tests/qmltests/tst_TabletShell.qml (+2/-0) |
To merge this branch: | bzr merge lp:~mzanetti/unity8/fix_snap_decision_test-rtm |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity Team | Pending | ||
Review via email: mp+238274@code.launchpad.net |
This proposal supersedes a proposal from 2014-10-14.
This proposal has been superseded by a proposal from 2014-10-14.
Commit message
Fix lp:1370240 by making stages interactive when a snap decision is dismissed.
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
no
* Did you perform an exploratory manual test run of your code change and any related functionality?
yes
* Did you make sure that your branch does not contain spurious tags?
yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
no
* If you changed the UI, has there been a design review?
no
- 1325. By Michael Zanetti
-
rebase once more
- 1326. By Michael Zanetti
-
revert to activeFocus, make it a bit more robust
- 1327. By Michael Zanetti
-
s/compare/
tryCompare/ - 1328. By Michael Zanetti
-
add more waitForRending
- 1329. By Michael Zanetti
-
cherry-pick over fixes
Unmerged revisions
- 1329. By Michael Zanetti
-
cherry-pick over fixes
- 1328. By Michael Zanetti
-
add more waitForRending
- 1327. By Michael Zanetti
-
s/compare/
tryCompare/ - 1326. By Michael Zanetti
-
revert to activeFocus, make it a bit more robust
- 1325. By Michael Zanetti
-
rebase once more
- 1324. By Michael Zanetti
-
merge with rtm and fix tests
Preview Diff
1 | === modified file 'plugins/AccountsService/AccountsService.qmltypes' |
2 | --- plugins/AccountsService/AccountsService.qmltypes 2014-09-01 12:18:53 +0000 |
3 | +++ plugins/AccountsService/AccountsService.qmltypes 2014-10-14 11:43:16 +0000 |
4 | @@ -23,6 +23,8 @@ |
5 | } |
6 | Property { name: "user"; type: "string" } |
7 | Property { name: "demoEdges"; type: "bool" } |
8 | + Property { name: "enableLauncherWhileLocked"; type: "bool"; isReadonly: true } |
9 | + Property { name: "enableIndicatorsWhileLocked"; type: "bool"; isReadonly: true } |
10 | Property { name: "backgroundFile"; type: "string"; isReadonly: true } |
11 | Property { name: "statsWelcomeScreen"; type: "bool"; isReadonly: true } |
12 | Property { name: "passwordDisplayHint"; type: "PasswordDisplayHint"; isReadonly: true } |
13 | |
14 | === modified file 'plugins/Dash/Dash.qmltypes' |
15 | --- plugins/Dash/Dash.qmltypes 2014-08-14 01:28:06 +0000 |
16 | +++ plugins/Dash/Dash.qmltypes 2014-10-14 11:43:16 +0000 |
17 | @@ -40,9 +40,12 @@ |
18 | Property { name: "forceNoClip"; type: "bool" } |
19 | Property { name: "stickyHeaderHeight"; type: "int"; isReadonly: true } |
20 | Property { name: "headerItemShownHeight"; type: "double"; isReadonly: true } |
21 | + Property { name: "cacheBuffer"; type: "double" } |
22 | Signal { name: "headerChanged" } |
23 | Method { name: "positionAtBeginning" } |
24 | Method { name: "showHeader" } |
25 | + Method { name: "firstCreatedIndex"; type: "int" } |
26 | + Method { name: "createdItemCount"; type: "int" } |
27 | Method { |
28 | name: "item" |
29 | type: "QQuickItem*" |
30 | |
31 | === modified file 'plugins/LightDM/LightDM.qmltypes' |
32 | --- plugins/LightDM/LightDM.qmltypes 2014-09-01 12:18:53 +0000 |
33 | +++ plugins/LightDM/LightDM.qmltypes 2014-10-14 11:43:16 +0000 |
34 | @@ -37,6 +37,7 @@ |
35 | Signal { name: "isActiveChanged" } |
36 | Signal { name: "isAuthenticatedChanged" } |
37 | Signal { name: "showGreeter" } |
38 | + Signal { name: "hideGreeter" } |
39 | Signal { |
40 | name: "requestAuthenticationUser" |
41 | Parameter { name: "user"; type: "string" } |
42 | |
43 | === modified file 'plugins/Ubuntu/Payments/Payments.qmltypes' |
44 | --- plugins/Ubuntu/Payments/Payments.qmltypes 2014-06-27 20:53:24 +0000 |
45 | +++ plugins/Ubuntu/Payments/Payments.qmltypes 2014-10-14 11:43:16 +0000 |
46 | @@ -37,6 +37,7 @@ |
47 | Parameter { name: "error"; type: "string" } |
48 | } |
49 | Signal { name: "purchaseCompleted" } |
50 | + Signal { name: "purchaseCancelled" } |
51 | Method { name: "start" } |
52 | } |
53 | } |
54 | |
55 | === modified file 'plugins/Unity/DashCommunicator/DashCommunicator.qmltypes' |
56 | --- plugins/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-08-14 13:33:28 +0000 |
57 | +++ plugins/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-10-14 11:43:16 +0000 |
58 | @@ -9,14 +9,14 @@ |
59 | Module { |
60 | Component { |
61 | name: "DashCommunicator" |
62 | - prototype: "QObject" |
63 | + prototype: "QThread" |
64 | exports: ["Unity.DashCommunicator/DashCommunicator 0.1"] |
65 | exportMetaObjectRevisions: [0] |
66 | Method { |
67 | name: "setCurrentScope" |
68 | Parameter { name: "scopeId"; type: "string" } |
69 | Parameter { name: "animate"; type: "bool" } |
70 | - Parameter { name: "reset"; type: "bool" } |
71 | + Parameter { name: "isSwipe"; type: "bool" } |
72 | } |
73 | } |
74 | Component { |
75 | @@ -28,7 +28,20 @@ |
76 | name: "setCurrentScopeRequested" |
77 | Parameter { name: "scopeId"; type: "string" } |
78 | Parameter { name: "animate"; type: "bool" } |
79 | - Parameter { name: "reset"; type: "bool" } |
80 | - } |
81 | + Parameter { name: "isSwipe"; type: "bool" } |
82 | + } |
83 | + } |
84 | + Component { |
85 | + name: "QThread" |
86 | + prototype: "QObject" |
87 | + Signal { name: "started" } |
88 | + Signal { name: "finished" } |
89 | + Method { |
90 | + name: "start" |
91 | + Parameter { type: "Priority" } |
92 | + } |
93 | + Method { name: "start" } |
94 | + Method { name: "terminate" } |
95 | + Method { name: "quit" } |
96 | } |
97 | } |
98 | |
99 | === modified file 'plugins/Unity/Indicators/CMakeLists.txt' |
100 | --- plugins/Unity/Indicators/CMakeLists.txt 2014-07-30 16:00:55 +0000 |
101 | +++ plugins/Unity/Indicators/CMakeLists.txt 2014-10-14 11:43:16 +0000 |
102 | @@ -24,6 +24,7 @@ |
103 | modelprinter.cpp |
104 | plugin.cpp |
105 | rootactionstate.cpp |
106 | + sharedunitymenumodel.cpp |
107 | unitymenumodelcache.cpp |
108 | unitymenumodelstack.cpp |
109 | visibleindicatorsmodel.cpp |
110 | |
111 | === modified file 'plugins/Unity/Indicators/Indicators.qmltypes' |
112 | --- plugins/Unity/Indicators/Indicators.qmltypes 2014-09-01 12:18:53 +0000 |
113 | +++ plugins/Unity/Indicators/Indicators.qmltypes 2014-10-14 11:43:16 +0000 |
114 | @@ -210,6 +210,16 @@ |
115 | Signal { name: "indexChanged" } |
116 | } |
117 | Component { |
118 | + name: "SharedUnityMenuModel" |
119 | + prototype: "QObject" |
120 | + exports: ["Unity.Indicators/SharedUnityMenuModel 0.1"] |
121 | + exportMetaObjectRevisions: [0] |
122 | + Property { name: "busName"; type: "QByteArray" } |
123 | + Property { name: "menuObjectPath"; type: "QByteArray" } |
124 | + Property { name: "actions"; type: "QVariantMap" } |
125 | + Property { name: "model"; type: "UnityMenuModel"; isReadonly: true; isPointer: true } |
126 | + } |
127 | + Component { |
128 | name: "UnityMenuModelCache" |
129 | prototype: "QObject" |
130 | exports: ["Unity.Indicators/UnityMenuModelCache 0.1"] |
131 | @@ -217,13 +227,6 @@ |
132 | isSingleton: true |
133 | exportMetaObjectRevisions: [0] |
134 | Method { |
135 | - name: "model" |
136 | - type: "UnityMenuModel*" |
137 | - Parameter { name: "bus"; type: "QByteArray" } |
138 | - Parameter { name: "path"; type: "QByteArray" } |
139 | - Parameter { name: "actions"; type: "QVariantMap" } |
140 | - } |
141 | - Method { |
142 | name: "contains" |
143 | type: "bool" |
144 | Parameter { name: "path"; type: "QByteArray" } |
145 | |
146 | === modified file 'plugins/Unity/Indicators/plugin.cpp' |
147 | --- plugins/Unity/Indicators/plugin.cpp 2014-07-30 16:00:55 +0000 |
148 | +++ plugins/Unity/Indicators/plugin.cpp 2014-10-14 11:43:16 +0000 |
149 | @@ -30,18 +30,23 @@ |
150 | #include "menucontentactivator.h" |
151 | #include "modelprinter.h" |
152 | #include "rootactionstate.h" |
153 | +#include "sharedunitymenumodel.h" |
154 | #include "unitymenumodelcache.h" |
155 | #include "unitymenumodelstack.h" |
156 | #include "visibleindicatorsmodel.h" |
157 | |
158 | +#include <unitymenumodel.h> |
159 | + |
160 | static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) { |
161 | Q_UNUSED(engine); |
162 | Q_UNUSED(scriptEngine); |
163 | - return new UnityMenuModelCache; |
164 | + return UnityMenuModelCache::singleton(); |
165 | } |
166 | |
167 | -void Indicators2Plugin::registerTypes(const char *uri) |
168 | +void IndicatorsPlugin::registerTypes(const char *uri) |
169 | { |
170 | + qRegisterMetaType<UnityMenuModel*>("UnityMenuModel*"); |
171 | + |
172 | qmlRegisterType<IndicatorsManager>(uri, 0, 1, "IndicatorsManager"); |
173 | qmlRegisterType<IndicatorsModel>(uri, 0, 1, "IndicatorsModel"); |
174 | qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator"); |
175 | @@ -49,6 +54,7 @@ |
176 | qmlRegisterType<RootActionState>(uri, 0, 1, "RootActionState"); |
177 | qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter"); |
178 | qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel"); |
179 | + qmlRegisterType<SharedUnityMenuModel>(uri, 0, 1, "SharedUnityMenuModel"); |
180 | |
181 | qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton); |
182 | |
183 | |
184 | === modified file 'plugins/Unity/Indicators/plugin.h' |
185 | --- plugins/Unity/Indicators/plugin.h 2013-08-14 09:07:45 +0000 |
186 | +++ plugins/Unity/Indicators/plugin.h 2014-10-14 11:43:16 +0000 |
187 | @@ -22,7 +22,7 @@ |
188 | |
189 | #include <QtQml/QQmlExtensionPlugin> |
190 | |
191 | -class Indicators2Plugin : public QQmlExtensionPlugin |
192 | +class IndicatorsPlugin : public QQmlExtensionPlugin |
193 | { |
194 | Q_OBJECT |
195 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") |
196 | |
197 | === added file 'plugins/Unity/Indicators/sharedunitymenumodel.cpp' |
198 | --- plugins/Unity/Indicators/sharedunitymenumodel.cpp 1970-01-01 00:00:00 +0000 |
199 | +++ plugins/Unity/Indicators/sharedunitymenumodel.cpp 2014-10-14 11:43:16 +0000 |
200 | @@ -0,0 +1,87 @@ |
201 | +/* |
202 | + * Copyright 2014 Canonical Ltd. |
203 | + * |
204 | + * This program is free software; you can redistribute it and/or modify |
205 | + * it under the terms of the GNU Lesser General Public License as published by |
206 | + * the Free Software Foundation; version 3. |
207 | + * |
208 | + * This program is distributed in the hope that it will be useful, |
209 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
210 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
211 | + * GNU Lesser General Public License for more details. |
212 | + * |
213 | + * You should have received a copy of the GNU Lesser General Public License |
214 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
215 | + * |
216 | + */ |
217 | + |
218 | +#include "sharedunitymenumodel.h" |
219 | +#include "unitymenumodelcache.h" |
220 | + |
221 | +SharedUnityMenuModel::SharedUnityMenuModel(QObject* parent) |
222 | + : QObject(parent) |
223 | +{ |
224 | +} |
225 | + |
226 | +QByteArray SharedUnityMenuModel::busName() const |
227 | +{ |
228 | + return m_busName; |
229 | +} |
230 | + |
231 | +void SharedUnityMenuModel::setBusName(const QByteArray& busName) |
232 | +{ |
233 | + if (m_busName != busName) { |
234 | + m_busName = busName; |
235 | + Q_EMIT busNameChanged(); |
236 | + initialize(); |
237 | + } |
238 | +} |
239 | + |
240 | +QByteArray SharedUnityMenuModel::menuObjectPath() const |
241 | +{ |
242 | + return m_menuObjectPath; |
243 | +} |
244 | + |
245 | +void SharedUnityMenuModel::setMenuObjectPath(const QByteArray& menuObjectPath) |
246 | +{ |
247 | + if (m_menuObjectPath != menuObjectPath) { |
248 | + m_menuObjectPath = menuObjectPath; |
249 | + Q_EMIT menuObjectPathChanged(); |
250 | + initialize(); |
251 | + } |
252 | +} |
253 | + |
254 | +QVariantMap SharedUnityMenuModel::actions() const |
255 | +{ |
256 | + return m_actions; |
257 | +} |
258 | + |
259 | +void SharedUnityMenuModel::setActions(const QVariantMap& actions) |
260 | +{ |
261 | + if (m_actions != actions) { |
262 | + m_actions = actions; |
263 | + Q_EMIT actionsChanged(); |
264 | + initialize(); |
265 | + } |
266 | +} |
267 | + |
268 | +UnityMenuModel* SharedUnityMenuModel::model() const |
269 | +{ |
270 | + return m_model ? m_model.data() : nullptr; |
271 | +} |
272 | + |
273 | +void SharedUnityMenuModel::initialize() |
274 | +{ |
275 | + if (m_busName.isEmpty() || m_menuObjectPath.isEmpty() || m_actions.isEmpty()) { |
276 | + if (!m_model.isNull()) { |
277 | + m_model.clear(); |
278 | + Q_EMIT modelChanged(); |
279 | + } |
280 | + } else { |
281 | + QSharedPointer<UnityMenuModel> model = UnityMenuModelCache::singleton()->model(m_busName, m_menuObjectPath, m_actions); |
282 | + if (model != m_model) { |
283 | + m_model = model; |
284 | + Q_EMIT modelChanged(); |
285 | + } |
286 | + } |
287 | +} |
288 | |
289 | === added file 'plugins/Unity/Indicators/sharedunitymenumodel.h' |
290 | --- plugins/Unity/Indicators/sharedunitymenumodel.h 1970-01-01 00:00:00 +0000 |
291 | +++ plugins/Unity/Indicators/sharedunitymenumodel.h 2014-10-14 11:43:16 +0000 |
292 | @@ -0,0 +1,66 @@ |
293 | +/* |
294 | + * Copyright 2014 Canonical Ltd. |
295 | + * |
296 | + * This program is free software; you can redistribute it and/or modify |
297 | + * it under the terms of the GNU Lesser General Public License as published by |
298 | + * the Free Software Foundation; version 3. |
299 | + * |
300 | + * This program is distributed in the hope that it will be useful, |
301 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
302 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
303 | + * GNU Lesser General Public License for more details. |
304 | + * |
305 | + * You should have received a copy of the GNU Lesser General Public License |
306 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
307 | + * |
308 | + */ |
309 | + |
310 | +#ifndef SHAREDUNITYMENUMODEL_H |
311 | +#define SHAREDUNITYMENUMODEL_H |
312 | + |
313 | +#include "unityindicatorsglobal.h" |
314 | + |
315 | +#include <QObject> |
316 | +#include <QSharedPointer> |
317 | +#include <QVariantMap> |
318 | + |
319 | +class UnityMenuModel; |
320 | + |
321 | +class UNITYINDICATORS_EXPORT SharedUnityMenuModel : public QObject |
322 | +{ |
323 | + Q_OBJECT |
324 | + Q_PROPERTY(QByteArray busName READ busName WRITE setBusName NOTIFY busNameChanged) |
325 | + Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath WRITE setMenuObjectPath NOTIFY menuObjectPathChanged) |
326 | + Q_PROPERTY(QVariantMap actions READ actions WRITE setActions NOTIFY actionsChanged) |
327 | + Q_PROPERTY(UnityMenuModel* model READ model NOTIFY modelChanged) |
328 | + |
329 | +public: |
330 | + SharedUnityMenuModel(QObject* parent = nullptr); |
331 | + |
332 | + QByteArray busName() const; |
333 | + void setBusName(const QByteArray&); |
334 | + |
335 | + QByteArray menuObjectPath() const; |
336 | + void setMenuObjectPath(const QByteArray&); |
337 | + |
338 | + QVariantMap actions() const; |
339 | + void setActions(const QVariantMap&); |
340 | + |
341 | + UnityMenuModel* model() const; |
342 | + |
343 | +Q_SIGNALS: |
344 | + void busNameChanged(); |
345 | + void menuObjectPathChanged(); |
346 | + void actionsChanged(); |
347 | + void modelChanged(); |
348 | + |
349 | +private: |
350 | + void initialize(); |
351 | + |
352 | + QByteArray m_busName; |
353 | + QByteArray m_menuObjectPath; |
354 | + QVariantMap m_actions; |
355 | + QSharedPointer<UnityMenuModel> m_model; |
356 | +}; |
357 | + |
358 | +#endif // SHAREDUNITYMENUMODEL_H |
359 | |
360 | === modified file 'plugins/Unity/Indicators/unitymenumodelcache.cpp' |
361 | --- plugins/Unity/Indicators/unitymenumodelcache.cpp 2014-08-20 09:16:28 +0000 |
362 | +++ plugins/Unity/Indicators/unitymenumodelcache.cpp 2014-10-14 11:43:16 +0000 |
363 | @@ -20,30 +20,45 @@ |
364 | #include "unitymenumodelcache.h" |
365 | #include <unitymenumodel.h> |
366 | |
367 | +#include <QQmlEngine> |
368 | + |
369 | +UnityMenuModelCache* UnityMenuModelCache::theCache = nullptr; |
370 | + |
371 | +UnityMenuModelCache* UnityMenuModelCache::singleton() |
372 | +{ |
373 | + if (!theCache) { |
374 | + theCache = new UnityMenuModelCache(); |
375 | + } |
376 | + return theCache; |
377 | +} |
378 | + |
379 | UnityMenuModelCache::UnityMenuModelCache(QObject* parent) |
380 | : QObject(parent) |
381 | { |
382 | } |
383 | |
384 | -UnityMenuModelCache::~UnityMenuModelCache() |
385 | -{ |
386 | -} |
387 | - |
388 | -UnityMenuModel* UnityMenuModelCache::model(const QByteArray& bus, |
389 | - const QByteArray& path, |
390 | - const QVariantMap& actions) |
391 | +QSharedPointer<UnityMenuModel> UnityMenuModelCache::model(const QByteArray& bus, |
392 | + const QByteArray& path, |
393 | + const QVariantMap& actions) |
394 | { |
395 | if (m_registry.contains(path)) |
396 | return m_registry[path]; |
397 | |
398 | - UnityMenuModel* menuModel = new UnityMenuModel; |
399 | - connect(menuModel, &QObject::destroyed, this, [menuModel, this](QObject*) { |
400 | - QList<QByteArray> keys = m_registry.keys(menuModel); |
401 | - Q_FOREACH(const QByteArray& key, keys) { |
402 | - m_registry.remove(key); |
403 | + UnityMenuModel* model = new UnityMenuModel; |
404 | + QQmlEngine::setObjectOwnership(model, QQmlEngine::CppOwnership); |
405 | + |
406 | + QSharedPointer<UnityMenuModel> menuModel(model); |
407 | + connect(model, &QObject::destroyed, this, [this] { |
408 | + QMutableHashIterator<QByteArray, QWeakPointer<UnityMenuModel>> iter(m_registry); |
409 | + while(iter.hasNext()) { |
410 | + auto keyVal = iter.next(); |
411 | + if (keyVal.value().isNull()) { |
412 | + iter.remove(); |
413 | + break; |
414 | + } |
415 | } |
416 | }); |
417 | - m_registry[path] = menuModel; |
418 | + m_registry[path] = menuModel.toWeakRef(); |
419 | |
420 | menuModel->setBusName(bus); |
421 | menuModel->setMenuObjectPath(path); |
422 | |
423 | === modified file 'plugins/Unity/Indicators/unitymenumodelcache.h' |
424 | --- plugins/Unity/Indicators/unitymenumodelcache.h 2014-08-26 08:14:44 +0000 |
425 | +++ plugins/Unity/Indicators/unitymenumodelcache.h 2014-10-14 11:43:16 +0000 |
426 | @@ -24,6 +24,7 @@ |
427 | |
428 | #include <QObject> |
429 | #include <QHash> |
430 | +#include <QWeakPointer> |
431 | |
432 | class UnityMenuModel; |
433 | |
434 | @@ -32,15 +33,19 @@ |
435 | Q_OBJECT |
436 | public: |
437 | UnityMenuModelCache(QObject*parent=nullptr); |
438 | - ~UnityMenuModelCache(); |
439 | - |
440 | - Q_INVOKABLE UnityMenuModel* model(const QByteArray& bus, |
441 | - const QByteArray& path, |
442 | - const QVariantMap& actions); |
443 | - Q_INVOKABLE bool contains(const QByteArray& path); |
444 | - |
445 | -private: |
446 | - QHash<QByteArray, UnityMenuModel*> m_registry; |
447 | + |
448 | + static UnityMenuModelCache* singleton(); |
449 | + |
450 | + virtual QSharedPointer<UnityMenuModel> model(const QByteArray& bus, |
451 | + const QByteArray& path, |
452 | + const QVariantMap& actions); |
453 | + |
454 | + // for tests use |
455 | + Q_INVOKABLE virtual bool contains(const QByteArray& path); |
456 | + |
457 | +protected: |
458 | + QHash<QByteArray, QWeakPointer<UnityMenuModel>> m_registry; |
459 | + static UnityMenuModelCache* theCache; |
460 | }; |
461 | |
462 | #endif // UNITYMENUMODELCACHE_H |
463 | |
464 | === modified file 'plugins/Unity/Launcher/Launcher.qmltypes' |
465 | --- plugins/Unity/Launcher/Launcher.qmltypes 2014-06-26 07:47:57 +0000 |
466 | +++ plugins/Unity/Launcher/Launcher.qmltypes 2014-10-14 11:43:16 +0000 |
467 | @@ -13,14 +13,6 @@ |
468 | exports: ["Unity.Launcher/LauncherItem 0.1"] |
469 | isCreatable: false |
470 | exportMetaObjectRevisions: [0] |
471 | - Signal { |
472 | - name: "favoriteChanged" |
473 | - Parameter { name: "favorite"; type: "bool" } |
474 | - } |
475 | - Signal { |
476 | - name: "runningChanged" |
477 | - Parameter { name: "running"; type: "bool" } |
478 | - } |
479 | } |
480 | Component { |
481 | name: "LauncherModel" |
482 | @@ -30,6 +22,10 @@ |
483 | isSingleton: true |
484 | exportMetaObjectRevisions: [0] |
485 | Method { |
486 | + name: "requestRemove" |
487 | + Parameter { name: "appId"; type: "string" } |
488 | + } |
489 | + Method { |
490 | name: "get" |
491 | type: "unity::shell::launcher::LauncherItemInterface*" |
492 | Parameter { name: "index"; type: "int" } |
493 | @@ -49,10 +45,6 @@ |
494 | Parameter { name: "appId"; type: "string" } |
495 | } |
496 | Method { |
497 | - name: "requestRemove" |
498 | - Parameter { name: "appId"; type: "string" } |
499 | - } |
500 | - Method { |
501 | name: "quickListActionInvoked" |
502 | Parameter { name: "appId"; type: "string" } |
503 | Parameter { name: "actionIndex"; type: "int" } |
504 | @@ -88,6 +80,7 @@ |
505 | Property { name: "recent"; type: "bool"; isReadonly: true } |
506 | Property { name: "progress"; type: "int"; isReadonly: true } |
507 | Property { name: "count"; type: "int"; isReadonly: true } |
508 | + Property { name: "countVisible"; type: "bool"; isReadonly: true } |
509 | Property { name: "focused"; type: "bool"; isReadonly: true } |
510 | Property { |
511 | name: "quickList" |
512 | @@ -96,6 +89,14 @@ |
513 | isPointer: true |
514 | } |
515 | Signal { |
516 | + name: "nameChanged" |
517 | + Parameter { name: "name"; type: "string" } |
518 | + } |
519 | + Signal { |
520 | + name: "iconChanged" |
521 | + Parameter { name: "icon"; type: "string" } |
522 | + } |
523 | + Signal { |
524 | name: "pinnedChanged" |
525 | Parameter { name: "pinned"; type: "bool" } |
526 | } |
527 | @@ -116,6 +117,10 @@ |
528 | Parameter { name: "count"; type: "int" } |
529 | } |
530 | Signal { |
531 | + name: "countVisibleChanged" |
532 | + Parameter { name: "countVisible"; type: "bool" } |
533 | + } |
534 | + Signal { |
535 | name: "focusedChanged" |
536 | Parameter { name: "focused"; type: "bool" } |
537 | } |
538 | |
539 | === modified file 'plugins/Unity/Session/Session.qmltypes' |
540 | --- plugins/Unity/Session/Session.qmltypes 2014-08-14 01:28:06 +0000 |
541 | +++ plugins/Unity/Session/Session.qmltypes 2014-10-14 11:43:16 +0000 |
542 | @@ -34,4 +34,14 @@ |
543 | Method { name: "RequestReboot" } |
544 | Method { name: "RequestShutdown" } |
545 | } |
546 | + Component { |
547 | + name: "OrientationLock" |
548 | + prototype: "QObject" |
549 | + exports: ["Unity.Session/OrientationLock 0.1"] |
550 | + isCreatable: false |
551 | + isSingleton: true |
552 | + exportMetaObjectRevisions: [0] |
553 | + Property { name: "enabled"; type: "bool"; isReadonly: true } |
554 | + Property { name: "savedOrientation"; type: "Qt::ScreenOrientation" } |
555 | + } |
556 | } |
557 | |
558 | === modified file 'plugins/Utils/Utils.qmltypes' |
559 | --- plugins/Utils/Utils.qmltypes 2014-08-14 01:28:06 +0000 |
560 | +++ plugins/Utils/Utils.qmltypes 2014-10-14 11:43:16 +0000 |
561 | @@ -107,6 +107,12 @@ |
562 | } |
563 | } |
564 | Component { |
565 | + name: "RelativeTimeFormatter" |
566 | + prototype: "TimeFormatter" |
567 | + exports: ["Utils/RelativeTimeFormatter 0.1"] |
568 | + exportMetaObjectRevisions: [0] |
569 | + } |
570 | + Component { |
571 | name: "TimeFormatter" |
572 | prototype: "QObject" |
573 | exports: ["Utils/GDateTimeFormatter 0.1", "Utils/TimeFormatter 0.1"] |
574 | |
575 | === modified file 'po/ast.po' |
576 | --- po/ast.po 2014-10-09 06:37:11 +0000 |
577 | +++ po/ast.po 2014-10-14 11:43:16 +0000 |
578 | @@ -8,14 +8,14 @@ |
579 | "Project-Id-Version: unity8\n" |
580 | "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
581 | "POT-Creation-Date: 2014-10-07 11:37+0300\n" |
582 | -"PO-Revision-Date: 2014-10-03 22:20+0000\n" |
583 | -"Last-Translator: Xuacu Saturio <xuacusk8@gmail.com>\n" |
584 | +"PO-Revision-Date: 2014-10-09 09:49+0000\n" |
585 | +"Last-Translator: ivarela <ivarela@ubuntu.com>\n" |
586 | "Language-Team: Asturian <ast@li.org>\n" |
587 | "MIME-Version: 1.0\n" |
588 | "Content-Type: text/plain; charset=UTF-8\n" |
589 | "Content-Transfer-Encoding: 8bit\n" |
590 | "Plural-Forms: nplurals=2; plural=n != 1;\n" |
591 | -"X-Launchpad-Export-Date: 2014-10-09 06:36+0000\n" |
592 | +"X-Launchpad-Export-Date: 2014-10-10 05:23+0000\n" |
593 | "X-Generator: Launchpad (build 17196)\n" |
594 | |
595 | #: plugins/LightDM/Greeter.cpp:130 |
596 | @@ -37,11 +37,12 @@ |
597 | |
598 | #: qml/Components/DelayedLockscreen.qml:62 |
599 | msgid "You have been locked out due to too many failed passphrase attempts." |
600 | -msgstr "" |
601 | +msgstr "Quedasti bloquiáu polos escesivos intentos fallíos de frase de pasu." |
602 | |
603 | #: qml/Components/DelayedLockscreen.qml:63 |
604 | msgid "You have been locked out due to too many failed passcode attempts." |
605 | msgstr "" |
606 | +"Quedasti bloquiáu polos escesivos intentos fallíos de códigu de pasu." |
607 | |
608 | #: qml/Components/DelayedLockscreen.qml:72 |
609 | #, qt-format |
610 | @@ -213,11 +214,11 @@ |
611 | |
612 | #: qml/Dash/PullToRefreshScopeStyle.qml:55 |
613 | msgid "Pull to refresh…" |
614 | -msgstr "" |
615 | +msgstr "Tirar p'anovar..." |
616 | |
617 | #: qml/Dash/PullToRefreshScopeStyle.qml:60 |
618 | msgid "Release to refresh…" |
619 | -msgstr "" |
620 | +msgstr "Soltar p'anovar..." |
621 | |
622 | #: qml/Dash/ScopesOverview.qml:206 |
623 | msgid "Manage Scopes" |
624 | @@ -313,7 +314,7 @@ |
625 | |
626 | #: qml/Shell.qml:346 |
627 | msgid "Enter passphrase" |
628 | -msgstr "" |
629 | +msgstr "Escribi la frase contraseña" |
630 | |
631 | #: qml/Shell.qml:347 |
632 | msgid "Sorry, incorrect passphrase" |
633 | @@ -325,7 +326,7 @@ |
634 | |
635 | #: qml/Shell.qml:350 |
636 | msgid "Enter passcode" |
637 | -msgstr "" |
638 | +msgstr "Escribi'l códigu de pasu" |
639 | |
640 | #: qml/Shell.qml:351 |
641 | msgid "Sorry, incorrect passcode" |
642 | |
643 | === modified file 'po/en_AU.po' |
644 | --- po/en_AU.po 2014-10-09 06:37:11 +0000 |
645 | +++ po/en_AU.po 2014-10-14 11:43:16 +0000 |
646 | @@ -8,14 +8,14 @@ |
647 | "Project-Id-Version: unity\n" |
648 | "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
649 | "POT-Creation-Date: 2014-10-07 11:37+0300\n" |
650 | -"PO-Revision-Date: 2014-09-23 01:24+0000\n" |
651 | +"PO-Revision-Date: 2014-10-12 09:41+0000\n" |
652 | "Last-Translator: Jared Norris <jarednorris@ubuntu.com>\n" |
653 | "Language-Team: English (Australia) <en_AU@li.org>\n" |
654 | "MIME-Version: 1.0\n" |
655 | "Content-Type: text/plain; charset=UTF-8\n" |
656 | "Content-Transfer-Encoding: 8bit\n" |
657 | "Plural-Forms: nplurals=2; plural=n != 1;\n" |
658 | -"X-Launchpad-Export-Date: 2014-10-09 06:37+0000\n" |
659 | +"X-Launchpad-Export-Date: 2014-10-13 06:15+0000\n" |
660 | "X-Generator: Launchpad (build 17196)\n" |
661 | |
662 | #: plugins/LightDM/Greeter.cpp:130 |
663 | @@ -33,22 +33,22 @@ |
664 | |
665 | #: qml/Components/DelayedLockscreen.qml:47 |
666 | msgid "Device Locked" |
667 | -msgstr "" |
668 | +msgstr "Device Locked" |
669 | |
670 | #: qml/Components/DelayedLockscreen.qml:62 |
671 | msgid "You have been locked out due to too many failed passphrase attempts." |
672 | -msgstr "" |
673 | +msgstr "You have been locked out due to too many failed passphrase attempts." |
674 | |
675 | #: qml/Components/DelayedLockscreen.qml:63 |
676 | msgid "You have been locked out due to too many failed passcode attempts." |
677 | -msgstr "" |
678 | +msgstr "You have been locked out due to too many failed passcode attempts." |
679 | |
680 | #: qml/Components/DelayedLockscreen.qml:72 |
681 | #, qt-format |
682 | msgid "Please wait %1 minute and then try again…" |
683 | msgid_plural "Please wait %1 minutes and then try again…" |
684 | -msgstr[0] "" |
685 | -msgstr[1] "" |
686 | +msgstr[0] "Please wait %1 minute and then try again…" |
687 | +msgstr[1] "Please wait %1 minutes and then try again…" |
688 | |
689 | #: qml/Components/Dialogs.qml:70 |
690 | msgid "Log out" |
691 | @@ -211,15 +211,15 @@ |
692 | |
693 | #: qml/Dash/PullToRefreshScopeStyle.qml:55 |
694 | msgid "Pull to refresh…" |
695 | -msgstr "" |
696 | +msgstr "Pull to refresh…" |
697 | |
698 | #: qml/Dash/PullToRefreshScopeStyle.qml:60 |
699 | msgid "Release to refresh…" |
700 | -msgstr "" |
701 | +msgstr "Release to refresh…" |
702 | |
703 | #: qml/Dash/ScopesOverview.qml:206 |
704 | msgid "Manage Scopes" |
705 | -msgstr "" |
706 | +msgstr "Manage Scopes" |
707 | |
708 | #: qml/Dash/ScopesOverview.qml:428 |
709 | msgid "Done" |
710 | @@ -239,7 +239,7 @@ |
711 | |
712 | #: qml/Greeter/Greeter.qml:157 |
713 | msgid "Unlock" |
714 | -msgstr "" |
715 | +msgstr "Unlock" |
716 | |
717 | #: qml/Hud/HudParametrizedActionsPage.qml:139 |
718 | msgid "Confirm" |
719 | @@ -275,7 +275,7 @@ |
720 | |
721 | #: qml/Panel/Indicators/MenuItemFactory.qml:600 |
722 | msgid "Nothing is playing" |
723 | -msgstr "" |
724 | +msgstr "Nothing is playing" |
725 | |
726 | #: qml/Panel/Indicators/MenuItemFactory.qml:748 |
727 | msgid "In queue…" |
728 | @@ -311,7 +311,7 @@ |
729 | |
730 | #: qml/Shell.qml:346 |
731 | msgid "Enter passphrase" |
732 | -msgstr "" |
733 | +msgstr "Enter passphrase" |
734 | |
735 | #: qml/Shell.qml:347 |
736 | msgid "Sorry, incorrect passphrase" |
737 | @@ -319,11 +319,11 @@ |
738 | |
739 | #: qml/Shell.qml:348 |
740 | msgid "Please re-enter" |
741 | -msgstr "" |
742 | +msgstr "Please re-enter" |
743 | |
744 | #: qml/Shell.qml:350 |
745 | msgid "Enter passcode" |
746 | -msgstr "" |
747 | +msgstr "Enter passcode" |
748 | |
749 | #: qml/Shell.qml:351 |
750 | msgid "Sorry, incorrect passcode" |
751 | @@ -332,7 +332,7 @@ |
752 | #: qml/Shell.qml:354 |
753 | #, qt-format |
754 | msgid "Enter %1" |
755 | -msgstr "" |
756 | +msgstr "Enter %1" |
757 | |
758 | #: qml/Shell.qml:355 |
759 | #, qt-format |
760 | @@ -366,9 +366,3 @@ |
761 | msgstr "" |
762 | "If passcode is entered incorrectly, your phone will conduct a factory reset " |
763 | "and all personal data will be deleted." |
764 | - |
765 | -#~ msgid "Sorry, incorrect PIN" |
766 | -#~ msgstr "Sorry, incorrect PIN" |
767 | - |
768 | -#~ msgid "Enter SIM PIN" |
769 | -#~ msgstr "Enter SIM PIN" |
770 | |
771 | === modified file 'po/es.po' |
772 | --- po/es.po 2014-10-09 06:37:11 +0000 |
773 | +++ po/es.po 2014-10-14 11:43:16 +0000 |
774 | @@ -8,14 +8,14 @@ |
775 | "Project-Id-Version: unity\n" |
776 | "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
777 | "POT-Creation-Date: 2014-10-07 11:37+0300\n" |
778 | -"PO-Revision-Date: 2014-10-05 08:50+0000\n" |
779 | -"Last-Translator: Paco Molinero <paco@byasl.com>\n" |
780 | +"PO-Revision-Date: 2014-10-09 07:43+0000\n" |
781 | +"Last-Translator: Adolfo Jayme <fitoschido@gmail.com>\n" |
782 | "Language-Team: Spanish <es@li.org>\n" |
783 | "MIME-Version: 1.0\n" |
784 | "Content-Type: text/plain; charset=UTF-8\n" |
785 | "Content-Transfer-Encoding: 8bit\n" |
786 | "Plural-Forms: nplurals=2; plural=n != 1;\n" |
787 | -"X-Launchpad-Export-Date: 2014-10-09 06:36+0000\n" |
788 | +"X-Launchpad-Export-Date: 2014-10-10 05:23+0000\n" |
789 | "X-Generator: Launchpad (build 17196)\n" |
790 | |
791 | #: plugins/LightDM/Greeter.cpp:130 |
792 | @@ -218,11 +218,11 @@ |
793 | |
794 | #: qml/Dash/PullToRefreshScopeStyle.qml:55 |
795 | msgid "Pull to refresh…" |
796 | -msgstr "" |
797 | +msgstr "Deslice para actualizar…" |
798 | |
799 | #: qml/Dash/PullToRefreshScopeStyle.qml:60 |
800 | msgid "Release to refresh…" |
801 | -msgstr "" |
802 | +msgstr "Suelte para actualizar…" |
803 | |
804 | #: qml/Dash/ScopesOverview.qml:206 |
805 | msgid "Manage Scopes" |
806 | |
807 | === modified file 'po/fa.po' |
808 | --- po/fa.po 2014-10-09 06:37:11 +0000 |
809 | +++ po/fa.po 2014-10-14 11:43:16 +0000 |
810 | @@ -8,14 +8,14 @@ |
811 | "Project-Id-Version: unity8\n" |
812 | "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
813 | "POT-Creation-Date: 2014-10-07 11:37+0300\n" |
814 | -"PO-Revision-Date: 2014-10-02 23:07+0000\n" |
815 | +"PO-Revision-Date: 2014-10-11 23:41+0000\n" |
816 | "Last-Translator: Danial Behzadi <dani.behzi@gmail.com>\n" |
817 | "Language-Team: Persian <fa@li.org>\n" |
818 | "MIME-Version: 1.0\n" |
819 | "Content-Type: text/plain; charset=UTF-8\n" |
820 | "Content-Transfer-Encoding: 8bit\n" |
821 | "Plural-Forms: nplurals=1; plural=0;\n" |
822 | -"X-Launchpad-Export-Date: 2014-10-09 06:36+0000\n" |
823 | +"X-Launchpad-Export-Date: 2014-10-12 06:55+0000\n" |
824 | "X-Generator: Launchpad (build 17196)\n" |
825 | |
826 | #: plugins/LightDM/Greeter.cpp:130 |
827 | @@ -211,11 +211,11 @@ |
828 | |
829 | #: qml/Dash/PullToRefreshScopeStyle.qml:55 |
830 | msgid "Pull to refresh…" |
831 | -msgstr "" |
832 | +msgstr "برای تازهسازی بکشید…" |
833 | |
834 | #: qml/Dash/PullToRefreshScopeStyle.qml:60 |
835 | msgid "Release to refresh…" |
836 | -msgstr "" |
837 | +msgstr "برای تازهسازی رها کنید…" |
838 | |
839 | #: qml/Dash/ScopesOverview.qml:206 |
840 | msgid "Manage Scopes" |
841 | @@ -366,9 +366,3 @@ |
842 | msgstr "" |
843 | "اگر رمزعبور نادرست وارد شود، تلفن شما بازنشانی کارخانه خواهد شد و تمامی " |
844 | "اطّلاعات شخصی حذف خواهند شد." |
845 | - |
846 | -#~ msgid "Sorry, incorrect PIN" |
847 | -#~ msgstr "متأسّفیم، PIN نادرست بود" |
848 | - |
849 | -#~ msgid "Enter SIM PIN" |
850 | -#~ msgstr "PIN سیمکارت را وارد کنید" |
851 | |
852 | === modified file 'po/fr.po' |
853 | --- po/fr.po 2014-10-09 06:37:11 +0000 |
854 | +++ po/fr.po 2014-10-14 11:43:16 +0000 |
855 | @@ -8,14 +8,14 @@ |
856 | "Project-Id-Version: unity\n" |
857 | "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
858 | "POT-Creation-Date: 2014-10-07 11:37+0300\n" |
859 | -"PO-Revision-Date: 2014-10-06 19:06+0000\n" |
860 | -"Last-Translator: Jean Marc <Unknown>\n" |
861 | +"PO-Revision-Date: 2014-10-09 19:00+0000\n" |
862 | +"Last-Translator: Anne <anneonyme017@gmail.com>\n" |
863 | "Language-Team: French <fr@li.org>\n" |
864 | "MIME-Version: 1.0\n" |
865 | "Content-Type: text/plain; charset=UTF-8\n" |
866 | "Content-Transfer-Encoding: 8bit\n" |
867 | "Plural-Forms: nplurals=2; plural=n > 1;\n" |
868 | -"X-Launchpad-Export-Date: 2014-10-09 06:36+0000\n" |
869 | +"X-Launchpad-Export-Date: 2014-10-10 05:23+0000\n" |
870 | "X-Generator: Launchpad (build 17196)\n" |
871 | |
872 | #: plugins/LightDM/Greeter.cpp:130 |
873 | @@ -222,11 +222,11 @@ |
874 | |
875 | #: qml/Dash/PullToRefreshScopeStyle.qml:55 |
876 | msgid "Pull to refresh…" |
877 | -msgstr "" |
878 | +msgstr "Tirer pour actualiser..." |
879 | |
880 | #: qml/Dash/PullToRefreshScopeStyle.qml:60 |
881 | msgid "Release to refresh…" |
882 | -msgstr "" |
883 | +msgstr "Relâcher pour actualiser..." |
884 | |
885 | #: qml/Dash/ScopesOverview.qml:206 |
886 | msgid "Manage Scopes" |
887 | |
888 | === modified file 'po/gd.po' |
889 | --- po/gd.po 2014-10-09 06:37:11 +0000 |
890 | +++ po/gd.po 2014-10-14 11:43:16 +0000 |
891 | @@ -8,7 +8,7 @@ |
892 | "Project-Id-Version: unity8\n" |
893 | "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
894 | "POT-Creation-Date: 2014-10-07 11:37+0300\n" |
895 | -"PO-Revision-Date: 2014-10-03 19:54+0000\n" |
896 | +"PO-Revision-Date: 2014-10-09 18:09+0000\n" |
897 | "Last-Translator: GunChleoc <Unknown>\n" |
898 | "Language-Team: Fòram na Gàidhlig\n" |
899 | "MIME-Version: 1.0\n" |
900 | @@ -16,7 +16,7 @@ |
901 | "Content-Transfer-Encoding: 8bit\n" |
902 | "Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : " |
903 | "(n > 2 && n < 20) ? 2 : 3;\n" |
904 | -"X-Launchpad-Export-Date: 2014-10-09 06:36+0000\n" |
905 | +"X-Launchpad-Export-Date: 2014-10-10 05:23+0000\n" |
906 | "X-Generator: Launchpad (build 17196)\n" |
907 | "Language: gd\n" |
908 | |
909 | @@ -225,11 +225,11 @@ |
910 | |
911 | #: qml/Dash/PullToRefreshScopeStyle.qml:55 |
912 | msgid "Pull to refresh…" |
913 | -msgstr "" |
914 | +msgstr "Tarraing airson ath-nuadhachadh…" |
915 | |
916 | #: qml/Dash/PullToRefreshScopeStyle.qml:60 |
917 | msgid "Release to refresh…" |
918 | -msgstr "" |
919 | +msgstr "Leig às airson ath-nuadhachadh…" |
920 | |
921 | #: qml/Dash/ScopesOverview.qml:206 |
922 | msgid "Manage Scopes" |
923 | |
924 | === modified file 'po/hu.po' |
925 | --- po/hu.po 2014-10-09 06:37:11 +0000 |
926 | +++ po/hu.po 2014-10-14 11:43:16 +0000 |
927 | @@ -8,14 +8,14 @@ |
928 | "Project-Id-Version: unity\n" |
929 | "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
930 | "POT-Creation-Date: 2014-10-07 11:37+0300\n" |
931 | -"PO-Revision-Date: 2014-10-08 08:13+0000\n" |
932 | +"PO-Revision-Date: 2014-10-11 10:50+0000\n" |
933 | "Last-Translator: Richard Somlói <ricsipontaz@gmail.com>\n" |
934 | "Language-Team: Hungarian <hu@li.org>\n" |
935 | "MIME-Version: 1.0\n" |
936 | "Content-Type: text/plain; charset=UTF-8\n" |
937 | "Content-Transfer-Encoding: 8bit\n" |
938 | "Plural-Forms: nplurals=2; plural=n != 1;\n" |
939 | -"X-Launchpad-Export-Date: 2014-10-09 06:36+0000\n" |
940 | +"X-Launchpad-Export-Date: 2014-10-12 06:55+0000\n" |
941 | "X-Generator: Launchpad (build 17196)\n" |
942 | |
943 | #: plugins/LightDM/Greeter.cpp:130 |
944 | @@ -321,7 +321,7 @@ |
945 | |
946 | #: qml/Shell.qml:348 |
947 | msgid "Please re-enter" |
948 | -msgstr "Kérjük adja meg újra" |
949 | +msgstr "Kérjük próbálja újra" |
950 | |
951 | #: qml/Shell.qml:350 |
952 | msgid "Enter passcode" |
953 | @@ -368,9 +368,3 @@ |
954 | msgstr "" |
955 | "Ha helytelen jelkódot ad meg, a telefonja visszaállítja a gyári " |
956 | "beállításokat és törli minden személyes adatát." |
957 | - |
958 | -#~ msgid "Sorry, incorrect PIN" |
959 | -#~ msgstr "Sajnáljuk, helytelen PIN" |
960 | - |
961 | -#~ msgid "Enter SIM PIN" |
962 | -#~ msgstr "Adja meg a SIM PIN kódját" |
963 | |
964 | === modified file 'po/is.po' |
965 | --- po/is.po 2014-10-09 06:37:11 +0000 |
966 | +++ po/is.po 2014-10-14 11:43:16 +0000 |
967 | @@ -10,14 +10,14 @@ |
968 | "Project-Id-Version: po_unity8-is\n" |
969 | "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
970 | "POT-Creation-Date: 2014-10-07 11:37+0300\n" |
971 | -"PO-Revision-Date: 2014-10-05 08:44+0000\n" |
972 | +"PO-Revision-Date: 2014-10-09 10:49+0000\n" |
973 | "Last-Translator: Sveinn í Felli <sv1@fellsnet.is>\n" |
974 | "Language-Team: Icelandic <translation-team-is@lists.sourceforge.net>\n" |
975 | "MIME-Version: 1.0\n" |
976 | "Content-Type: text/plain; charset=UTF-8\n" |
977 | "Content-Transfer-Encoding: 8bit\n" |
978 | "Plural-Forms: nplurals=2; plural=n != 1;\n" |
979 | -"X-Launchpad-Export-Date: 2014-10-09 06:36+0000\n" |
980 | +"X-Launchpad-Export-Date: 2014-10-10 05:23+0000\n" |
981 | "X-Generator: Launchpad (build 17196)\n" |
982 | "Language: is\n" |
983 | |
984 | @@ -36,7 +36,7 @@ |
985 | |
986 | #: qml/Components/DelayedLockscreen.qml:47 |
987 | msgid "Device Locked" |
988 | -msgstr "" |
989 | +msgstr "Tæki læst" |
990 | |
991 | #: qml/Components/DelayedLockscreen.qml:62 |
992 | msgid "You have been locked out due to too many failed passphrase attempts." |
993 | @@ -50,8 +50,8 @@ |
994 | #, qt-format |
995 | msgid "Please wait %1 minute and then try again…" |
996 | msgid_plural "Please wait %1 minutes and then try again…" |
997 | -msgstr[0] "" |
998 | -msgstr[1] "" |
999 | +msgstr[0] "Bíddu í %1 mínútu og reyndu svo aftur" |
1000 | +msgstr[1] "Bíddu í %1 mínútur og reyndu svo aftur" |
1001 | |
1002 | #: qml/Components/Dialogs.qml:70 |
1003 | msgid "Log out" |
1004 | @@ -219,7 +219,7 @@ |
1005 | |
1006 | #: qml/Dash/PullToRefreshScopeStyle.qml:60 |
1007 | msgid "Release to refresh…" |
1008 | -msgstr "" |
1009 | +msgstr "Slepptu til að endurlesa..." |
1010 | |
1011 | #: qml/Dash/ScopesOverview.qml:206 |
1012 | msgid "Manage Scopes" |
1013 | @@ -243,7 +243,7 @@ |
1014 | |
1015 | #: qml/Greeter/Greeter.qml:157 |
1016 | msgid "Unlock" |
1017 | -msgstr "" |
1018 | +msgstr "Aflæsa" |
1019 | |
1020 | #: qml/Hud/HudParametrizedActionsPage.qml:139 |
1021 | msgid "Confirm" |
1022 | @@ -323,7 +323,7 @@ |
1023 | |
1024 | #: qml/Shell.qml:348 |
1025 | msgid "Please re-enter" |
1026 | -msgstr "" |
1027 | +msgstr "Settu aftur inn" |
1028 | |
1029 | #: qml/Shell.qml:350 |
1030 | msgid "Enter passcode" |
1031 | @@ -336,7 +336,7 @@ |
1032 | #: qml/Shell.qml:354 |
1033 | #, qt-format |
1034 | msgid "Enter %1" |
1035 | -msgstr "" |
1036 | +msgstr "Settu inn %1" |
1037 | |
1038 | #: qml/Shell.qml:355 |
1039 | #, qt-format |
1040 | |
1041 | === modified file 'qml/Greeter/Clock.qml' |
1042 | --- qml/Greeter/Clock.qml 2014-08-20 08:39:09 +0000 |
1043 | +++ qml/Greeter/Clock.qml 2014-10-14 11:43:16 +0000 |
1044 | @@ -34,21 +34,21 @@ |
1045 | } |
1046 | } |
1047 | |
1048 | - CachedUnityMenuModel { |
1049 | + Indicators.SharedUnityMenuModel { |
1050 | id: timeModel |
1051 | objectName: "timeModel" |
1052 | |
1053 | busName: "com.canonical.indicator.datetime" |
1054 | - actionsObjectPath: "/com/canonical/indicator/datetime" |
1055 | + actions: { "indicator": "/com/canonical/indicator/datetime" } |
1056 | menuObjectPath: clock.visible ? "/com/canonical/indicator/datetime/phone" : "" |
1057 | + } |
1058 | |
1059 | - Indicators.RootActionState { |
1060 | - menu: timeModel.model |
1061 | - onUpdated: { |
1062 | - if (timeLabel.text != rightLabel) { |
1063 | - timeLabel.text = rightLabel; |
1064 | - clock.currentDate = new Date(); |
1065 | - } |
1066 | + Indicators.RootActionState { |
1067 | + menu: timeModel.model |
1068 | + onUpdated: { |
1069 | + if (timeLabel.text != rightLabel) { |
1070 | + if (rightLabel != "") timeLabel.text = rightLabel; |
1071 | + clock.currentDate = new Date(); |
1072 | } |
1073 | } |
1074 | } |
1075 | |
1076 | === modified file 'qml/Notifications/Notifications.qml' |
1077 | --- qml/Notifications/Notifications.qml 2014-08-25 11:31:05 +0000 |
1078 | +++ qml/Notifications/Notifications.qml 2014-10-14 11:43:16 +0000 |
1079 | @@ -31,6 +31,7 @@ |
1080 | |
1081 | SortFilterProxyModel { |
1082 | id: snapDecisionProxyModel |
1083 | + objectName: "snapDecisionProxyModel" |
1084 | |
1085 | model: notificationList.model |
1086 | filterRole: UnityNotifications.ModelInterface != undefined ? UnityNotifications.ModelInterface.RoleType : 0 |
1087 | |
1088 | === removed file 'qml/Panel/Indicators/CachedUnityMenuModel.qml' |
1089 | --- qml/Panel/Indicators/CachedUnityMenuModel.qml 2014-08-20 08:39:09 +0000 |
1090 | +++ qml/Panel/Indicators/CachedUnityMenuModel.qml 1970-01-01 00:00:00 +0000 |
1091 | @@ -1,39 +0,0 @@ |
1092 | -/* |
1093 | - * Copyright 2013 Canonical Ltd. |
1094 | - * |
1095 | - * This program is free software; you can redistribute it and/or modify |
1096 | - * it under the terms of the GNU Lesser General Public License as published by |
1097 | - * the Free Software Foundation; version 3. |
1098 | - * |
1099 | - * This program is distributed in the hope that it will be useful, |
1100 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1101 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1102 | - * GNU Lesser General Public License for more details. |
1103 | - * |
1104 | - * You should have received a copy of the GNU Lesser General Public License |
1105 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1106 | - * |
1107 | - * Authors: |
1108 | - * Nick Dedekind <nick.dedekind@canonical.com> |
1109 | - */ |
1110 | - |
1111 | -import QtQuick 2.0 |
1112 | -import QMenuModel 0.1 |
1113 | -import Unity.Indicators 0.1 as Indicators |
1114 | - |
1115 | -// Make sure we don't duplicate models. |
1116 | -Item { |
1117 | - id: cachedModel |
1118 | - property string busName |
1119 | - property string actionsObjectPath |
1120 | - property string menuObjectPath |
1121 | - readonly property bool ready: busName!=="" && actionsObjectPath!=="" && menuObjectPath!=="" |
1122 | - |
1123 | - property var model: { |
1124 | - if (!ready) return null; |
1125 | - |
1126 | - return Indicators.UnityMenuModelCache.model(cachedModel.busName, |
1127 | - cachedModel.menuObjectPath, |
1128 | - { "indicator": cachedModel.actionsObjectPath }); |
1129 | - } |
1130 | -} |
1131 | |
1132 | === modified file 'qml/Panel/Indicators/IndicatorBase.qml' |
1133 | --- qml/Panel/Indicators/IndicatorBase.qml 2014-09-29 10:24:58 +0000 |
1134 | +++ qml/Panel/Indicators/IndicatorBase.qml 2014-10-14 11:43:16 +0000 |
1135 | @@ -37,10 +37,10 @@ |
1136 | property alias menuModel: cachedModel.model |
1137 | property alias rootActionState: rootAction |
1138 | |
1139 | - CachedUnityMenuModel { |
1140 | + SharedUnityMenuModel { |
1141 | id: cachedModel |
1142 | busName: indicatorItem.busName |
1143 | - actionsObjectPath: indicatorItem.actionsObjectPath |
1144 | + actions: { "indicator": indicatorItem.actionsObjectPath } |
1145 | menuObjectPath: indicatorItem.deviceMenuObjectPath |
1146 | } |
1147 | |
1148 | |
1149 | === modified file 'qml/Shell.qml' |
1150 | --- qml/Shell.qml 2014-10-08 20:36:48 +0000 |
1151 | +++ qml/Shell.qml 2014-10-14 11:43:16 +0000 |
1152 | @@ -240,7 +240,7 @@ |
1153 | Binding { |
1154 | target: applicationsDisplayLoader.item |
1155 | property: "interactive" |
1156 | - value: edgeDemo.stagesEnabled && !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0 |
1157 | + value: edgeDemo.stagesEnabled && !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0 && !notifications.useModal |
1158 | } |
1159 | Binding { |
1160 | target: applicationsDisplayLoader.item |
1161 | |
1162 | === modified file 'tests/mocks/AccountsService/AccountsService.qmltypes' |
1163 | --- tests/mocks/AccountsService/AccountsService.qmltypes 2014-09-01 12:18:53 +0000 |
1164 | +++ tests/mocks/AccountsService/AccountsService.qmltypes 2014-10-14 11:43:16 +0000 |
1165 | @@ -23,6 +23,8 @@ |
1166 | } |
1167 | Property { name: "user"; type: "string" } |
1168 | Property { name: "demoEdges"; type: "bool" } |
1169 | + Property { name: "enableLauncherWhileLocked"; type: "bool" } |
1170 | + Property { name: "enableIndicatorsWhileLocked"; type: "bool" } |
1171 | Property { name: "backgroundFile"; type: "string" } |
1172 | Property { name: "statsWelcomeScreen"; type: "bool" } |
1173 | Property { name: "passwordDisplayHint"; type: "PasswordDisplayHint"; isReadonly: true } |
1174 | |
1175 | === modified file 'tests/mocks/LightDM/LightDM.qmltypes' |
1176 | --- tests/mocks/LightDM/LightDM.qmltypes 2014-09-01 12:18:53 +0000 |
1177 | +++ tests/mocks/LightDM/LightDM.qmltypes 2014-10-14 11:43:16 +0000 |
1178 | @@ -37,6 +37,7 @@ |
1179 | Signal { name: "isActiveChanged" } |
1180 | Signal { name: "isAuthenticatedChanged" } |
1181 | Signal { name: "showGreeter" } |
1182 | + Signal { name: "hideGreeter" } |
1183 | Signal { |
1184 | name: "requestAuthenticationUser" |
1185 | Parameter { name: "user"; type: "string" } |
1186 | |
1187 | === modified file 'tests/mocks/QMenuModel/QMenuModel.qmltypes' |
1188 | --- tests/mocks/QMenuModel/QMenuModel.qmltypes 2014-08-14 01:28:06 +0000 |
1189 | +++ tests/mocks/QMenuModel/QMenuModel.qmltypes 2014-10-14 11:43:16 +0000 |
1190 | @@ -18,12 +18,12 @@ |
1191 | prototype: "QAbstractListModel" |
1192 | exports: ["QMenuModel/UnityMenuModel 0.1"] |
1193 | exportMetaObjectRevisions: [0] |
1194 | - Property { name: "modelData"; type: "QVariant" } |
1195 | Property { name: "busName"; type: "QByteArray" } |
1196 | Property { name: "actions"; type: "QVariantMap" } |
1197 | Property { name: "menuObjectPath"; type: "QByteArray" } |
1198 | Property { name: "actionStateParser"; type: "ActionStateParser"; isPointer: true } |
1199 | Property { name: "nameOwner"; type: "string"; isReadonly: true } |
1200 | + Property { name: "modelData"; type: "QVariant" } |
1201 | Method { |
1202 | name: "insertRow" |
1203 | Parameter { name: "row"; type: "int" } |
1204 | |
1205 | === modified file 'tests/mocks/QMenuModel/unitymenumodel.cpp' |
1206 | --- tests/mocks/QMenuModel/unitymenumodel.cpp 2014-08-26 08:14:44 +0000 |
1207 | +++ tests/mocks/QMenuModel/unitymenumodel.cpp 2014-10-14 11:43:16 +0000 |
1208 | @@ -50,13 +50,12 @@ |
1209 | { |
1210 | beginResetModel(); |
1211 | |
1212 | - m_modelData.clear(); |
1213 | m_modelData = data.toList(); |
1214 | + Q_EMIT modelDataChanged(); |
1215 | |
1216 | endResetModel(); |
1217 | } |
1218 | |
1219 | - |
1220 | void UnityMenuModel::insertRow(int row, const QVariant& data) |
1221 | { |
1222 | row = qMin(row, rowCount()); |
1223 | |
1224 | === modified file 'tests/mocks/QMenuModel/unitymenumodel.h' |
1225 | --- tests/mocks/QMenuModel/unitymenumodel.h 2014-08-26 08:14:44 +0000 |
1226 | +++ tests/mocks/QMenuModel/unitymenumodel.h 2014-10-14 11:43:16 +0000 |
1227 | @@ -27,13 +27,15 @@ |
1228 | class Q_DECL_EXPORT UnityMenuModel : public QAbstractListModel |
1229 | { |
1230 | Q_OBJECT |
1231 | - Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged) |
1232 | Q_PROPERTY(QByteArray busName READ busName WRITE setBusName NOTIFY busNameChanged) |
1233 | Q_PROPERTY(QVariantMap actions READ actions WRITE setActions NOTIFY actionsChanged) |
1234 | Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath WRITE setMenuObjectPath NOTIFY menuObjectPathChanged) |
1235 | Q_PROPERTY(ActionStateParser* actionStateParser READ actionStateParser WRITE setActionStateParser NOTIFY actionStateParserChanged) |
1236 | Q_PROPERTY(QString nameOwner READ nameOwner NOTIFY nameOwnerChanged) |
1237 | |
1238 | + // internal mock properties |
1239 | + Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged) |
1240 | + |
1241 | public: |
1242 | UnityMenuModel(QObject *parent = nullptr); |
1243 | virtual ~UnityMenuModel(); |
1244 | @@ -81,8 +83,10 @@ |
1245 | void actionsChanged(); |
1246 | void menuObjectPathChanged(); |
1247 | void actionStateParserChanged(); |
1248 | + void nameOwnerChanged(); |
1249 | + |
1250 | + // Internal mock usage |
1251 | void modelDataChanged(); |
1252 | - void nameOwnerChanged(); |
1253 | |
1254 | private: |
1255 | QVariantMap rowData(int row) const; |
1256 | |
1257 | === modified file 'tests/mocks/Ubuntu/Payments/Payments.qmltypes' |
1258 | --- tests/mocks/Ubuntu/Payments/Payments.qmltypes 2014-06-27 20:53:24 +0000 |
1259 | +++ tests/mocks/Ubuntu/Payments/Payments.qmltypes 2014-10-14 11:43:16 +0000 |
1260 | @@ -37,6 +37,8 @@ |
1261 | Parameter { name: "error"; type: "string" } |
1262 | } |
1263 | Signal { name: "purchaseCompleted" } |
1264 | + Signal { name: "purchaseCancelled" } |
1265 | Method { name: "start" } |
1266 | + Method { name: "process" } |
1267 | } |
1268 | } |
1269 | |
1270 | === modified file 'tests/mocks/Ubuntu/Telephony/Telephony.qmltypes' |
1271 | --- tests/mocks/Ubuntu/Telephony/Telephony.qmltypes 2014-08-14 13:33:28 +0000 |
1272 | +++ tests/mocks/Ubuntu/Telephony/Telephony.qmltypes 2014-10-14 11:43:16 +0000 |
1273 | @@ -22,7 +22,8 @@ |
1274 | exportMetaObjectRevisions: [0] |
1275 | Property { name: "phoneNumber"; type: "string" } |
1276 | Property { name: "isConference"; type: "bool" } |
1277 | - Property { name: "elapsedTime"; type: "int"; isReadonly: true } |
1278 | + Property { name: "elapsedTime"; type: "int" } |
1279 | + Property { name: "elapsedTimerRunning"; type: "bool" } |
1280 | } |
1281 | Component { |
1282 | name: "MockCallManager" |
1283 | |
1284 | === modified file 'tests/mocks/Unity/Application/Application.qmltypes' |
1285 | --- tests/mocks/Unity/Application/Application.qmltypes 2014-09-01 12:24:06 +0000 |
1286 | +++ tests/mocks/Unity/Application/Application.qmltypes 2014-10-14 11:43:16 +0000 |
1287 | @@ -238,6 +238,7 @@ |
1288 | Property { name: "state"; type: "State"; isReadonly: true } |
1289 | Property { name: "name"; type: "string"; isReadonly: true } |
1290 | Property { name: "live"; type: "bool"; isReadonly: true } |
1291 | + Property { name: "orientation"; type: "Qt::ScreenOrientation" } |
1292 | Signal { |
1293 | name: "typeChanged" |
1294 | Parameter { type: "Type" } |
1295 | @@ -268,10 +269,15 @@ |
1296 | exportMetaObjectRevisions: [0] |
1297 | Property { name: "name"; type: "string"; isReadonly: true } |
1298 | Property { name: "surface"; type: "MirSurfaceItem"; isReadonly: true; isPointer: true } |
1299 | + Property { name: "application"; type: "ApplicationInfo"; isReadonly: true; isPointer: true } |
1300 | Property { name: "parentSession"; type: "Session"; isReadonly: true; isPointer: true } |
1301 | Property { name: "childSessions"; type: "SessionModel"; isReadonly: true; isPointer: true } |
1302 | Property { name: "live"; type: "bool"; isReadonly: true } |
1303 | Signal { |
1304 | + name: "applicationChanged" |
1305 | + Parameter { type: "ApplicationInfo"; isPointer: true } |
1306 | + } |
1307 | + Signal { |
1308 | name: "surfaceChanged" |
1309 | Parameter { type: "MirSurfaceItem"; isPointer: true } |
1310 | } |
1311 | @@ -368,6 +374,12 @@ |
1312 | Property { name: "stage"; type: "Stage"; isReadonly: true } |
1313 | Property { name: "state"; type: "State"; isReadonly: true } |
1314 | Property { name: "focused"; type: "bool"; isReadonly: true } |
1315 | + Property { name: "splashTitle"; type: "string"; isReadonly: true } |
1316 | + Property { name: "splashImage"; type: "QUrl"; isReadonly: true } |
1317 | + Property { name: "splashShowHeader"; type: "bool"; isReadonly: true } |
1318 | + Property { name: "splashColor"; type: "QColor"; isReadonly: true } |
1319 | + Property { name: "splashColorHeader"; type: "QColor"; isReadonly: true } |
1320 | + Property { name: "splashColorFooter"; type: "QColor"; isReadonly: true } |
1321 | Signal { |
1322 | name: "nameChanged" |
1323 | Parameter { name: "name"; type: "string" } |
1324 | @@ -414,6 +426,7 @@ |
1325 | Property { name: "count"; type: "int"; isReadonly: true } |
1326 | Property { name: "focusedApplicationId"; type: "string"; isReadonly: true } |
1327 | Property { name: "suspended"; type: "bool" } |
1328 | + Property { name: "forceDashActive"; type: "bool" } |
1329 | Signal { |
1330 | name: "focusRequested" |
1331 | Parameter { name: "appId"; type: "string" } |
1332 | |
1333 | === modified file 'tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes' |
1334 | --- tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-08-14 13:33:28 +0000 |
1335 | +++ tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-10-14 11:43:16 +0000 |
1336 | @@ -34,13 +34,13 @@ |
1337 | name: "setCurrentScopeRequested" |
1338 | Parameter { name: "scopeId"; type: "string" } |
1339 | Parameter { name: "animate"; type: "bool" } |
1340 | - Parameter { name: "reset"; type: "bool" } |
1341 | + Parameter { name: "isSwipe"; type: "bool" } |
1342 | } |
1343 | Method { |
1344 | name: "mockSetCurrentScope" |
1345 | Parameter { name: "scopeId"; type: "string" } |
1346 | Parameter { name: "animate"; type: "bool" } |
1347 | - Parameter { name: "reset"; type: "bool" } |
1348 | + Parameter { name: "isSwipe"; type: "bool" } |
1349 | } |
1350 | } |
1351 | } |
1352 | |
1353 | === modified file 'tests/mocks/Unity/Indicators/CMakeLists.txt' |
1354 | --- tests/mocks/Unity/Indicators/CMakeLists.txt 2014-08-20 08:39:09 +0000 |
1355 | +++ tests/mocks/Unity/Indicators/CMakeLists.txt 2014-10-14 11:43:16 +0000 |
1356 | @@ -12,24 +12,17 @@ |
1357 | |
1358 | set(IndicatorsFakeQml_SOURCES |
1359 | fakeplugin.cpp |
1360 | + fakeindicatorsmodel.cpp |
1361 | + fakeunitymenumodelcache.cpp |
1362 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/indicators.h |
1363 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/menucontentactivator.cpp |
1364 | + ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/sharedunitymenumodel.cpp |
1365 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelcache.cpp |
1366 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelstack.cpp |
1367 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/visibleindicatorsmodel.cpp |
1368 | - fakeindicatorsmodel.cpp |
1369 | -) |
1370 | - |
1371 | -set(IndicatorsFakeQml_RESOURCES |
1372 | - indicators_fake.qrc |
1373 | -) |
1374 | - |
1375 | -qt5_add_resources(IndicatorsFakeQml_RESOURCES_RCC |
1376 | - ${IndicatorsFakeQml_RESOURCES} |
1377 | ) |
1378 | |
1379 | add_library(IndicatorsFakeQml SHARED |
1380 | - ${IndicatorsFakeQml_RESOURCES_RCC} |
1381 | ${IndicatorsFakeQml_SOURCES} |
1382 | ) |
1383 | add_definitions(-DUNITYINDICATORS_LIBRARY) |
1384 | |
1385 | === removed file 'tests/mocks/Unity/Indicators/FakeMenuPage.qml' |
1386 | --- tests/mocks/Unity/Indicators/FakeMenuPage.qml 2014-09-09 15:10:52 +0000 |
1387 | +++ tests/mocks/Unity/Indicators/FakeMenuPage.qml 1970-01-01 00:00:00 +0000 |
1388 | @@ -1,27 +0,0 @@ |
1389 | -/* |
1390 | - * Copyright 2013 Canonical Ltd. |
1391 | - * |
1392 | - * This program is free software; you can redistribute it and/or modify |
1393 | - * it under the terms of the GNU General Public License as published by |
1394 | - * the Free Software Foundation; version 3. |
1395 | - * |
1396 | - * This program is distributed in the hope that it will be useful, |
1397 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1398 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1399 | - * GNU General Public License for more details. |
1400 | - * |
1401 | - * You should have received a copy of the GNU General Public License |
1402 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1403 | - */ |
1404 | - |
1405 | -import QtQuick 2.0 |
1406 | - |
1407 | -Flickable { |
1408 | - objectName: "fakeMenuPlugin" |
1409 | - // Make it compatible with the PluginItem interface |
1410 | - function reset() { |
1411 | - if (shell != undefined && shell.indicator_status != undefined) { |
1412 | - shell.indicator_status[objectName].reset++; |
1413 | - } |
1414 | - } |
1415 | -} |
1416 | |
1417 | === modified file 'tests/mocks/Unity/Indicators/Indicators.qmltypes' |
1418 | --- tests/mocks/Unity/Indicators/Indicators.qmltypes 2014-09-01 12:18:53 +0000 |
1419 | +++ tests/mocks/Unity/Indicators/Indicators.qmltypes 2014-10-14 11:43:16 +0000 |
1420 | @@ -29,6 +29,7 @@ |
1421 | exports: ["Unity.Indicators/FakeIndicatorsModel 0.1"] |
1422 | exportMetaObjectRevisions: [0] |
1423 | Property { name: "count"; type: "int"; isReadonly: true } |
1424 | + Property { name: "modelData"; type: "QVariant" } |
1425 | Method { |
1426 | name: "load" |
1427 | Parameter { name: "profile"; type: "string" } |
1428 | @@ -39,6 +40,15 @@ |
1429 | Parameter { name: "row"; type: "QVariantMap" } |
1430 | } |
1431 | Method { |
1432 | + name: "insert" |
1433 | + Parameter { name: "row"; type: "int" } |
1434 | + Parameter { name: "data"; type: "QVariantMap" } |
1435 | + } |
1436 | + Method { |
1437 | + name: "remove" |
1438 | + Parameter { name: "row"; type: "int" } |
1439 | + } |
1440 | + Method { |
1441 | name: "data" |
1442 | type: "QVariant" |
1443 | Parameter { name: "row"; type: "int" } |
1444 | @@ -46,6 +56,27 @@ |
1445 | } |
1446 | } |
1447 | Component { |
1448 | + name: "FakeUnityMenuModelCache" |
1449 | + prototype: "UnityMenuModelCache" |
1450 | + exports: ["Unity.Indicators/UnityMenuModelCache 0.1"] |
1451 | + isCreatable: false |
1452 | + isSingleton: true |
1453 | + exportMetaObjectRevisions: [0] |
1454 | + Method { |
1455 | + name: "setCachedModelData" |
1456 | + Parameter { name: "bus"; type: "QByteArray" } |
1457 | + Parameter { name: "path"; type: "QByteArray" } |
1458 | + Parameter { name: "actions"; type: "QVariantMap" } |
1459 | + Parameter { name: "data"; type: "QVariant" } |
1460 | + } |
1461 | + Method { |
1462 | + name: "setCachedModelData" |
1463 | + Parameter { name: "bus"; type: "QByteArray" } |
1464 | + Parameter { name: "path"; type: "QByteArray" } |
1465 | + Parameter { name: "actions"; type: "QVariantMap" } |
1466 | + } |
1467 | + } |
1468 | + Component { |
1469 | name: "FlatMenuProxyModelRole" |
1470 | prototype: "QObject" |
1471 | exports: ["Unity.Indicators/FlatMenuProxyModelRole 0.1"] |
1472 | @@ -160,19 +191,18 @@ |
1473 | } |
1474 | Component { name: "QIdentityProxyModel"; prototype: "QAbstractProxyModel" } |
1475 | Component { |
1476 | + name: "SharedUnityMenuModel" |
1477 | + prototype: "QObject" |
1478 | + exports: ["Unity.Indicators/SharedUnityMenuModel 0.1"] |
1479 | + exportMetaObjectRevisions: [0] |
1480 | + Property { name: "busName"; type: "QByteArray" } |
1481 | + Property { name: "menuObjectPath"; type: "QByteArray" } |
1482 | + Property { name: "actions"; type: "QVariantMap" } |
1483 | + Property { name: "model"; type: "UnityMenuModel"; isReadonly: true; isPointer: true } |
1484 | + } |
1485 | + Component { |
1486 | name: "UnityMenuModelCache" |
1487 | prototype: "QObject" |
1488 | - exports: ["Unity.Indicators/UnityMenuModelCache 0.1"] |
1489 | - isCreatable: false |
1490 | - isSingleton: true |
1491 | - exportMetaObjectRevisions: [0] |
1492 | - Method { |
1493 | - name: "model" |
1494 | - type: "UnityMenuModel*" |
1495 | - Parameter { name: "bus"; type: "QByteArray" } |
1496 | - Parameter { name: "path"; type: "QByteArray" } |
1497 | - Parameter { name: "actions"; type: "QVariantMap" } |
1498 | - } |
1499 | Method { |
1500 | name: "contains" |
1501 | type: "bool" |
1502 | |
1503 | === modified file 'tests/mocks/Unity/Indicators/IndicatorsModel.qml' |
1504 | --- tests/mocks/Unity/Indicators/IndicatorsModel.qml 2014-03-03 11:55:00 +0000 |
1505 | +++ tests/mocks/Unity/Indicators/IndicatorsModel.qml 2014-10-14 11:43:16 +0000 |
1506 | @@ -18,43 +18,151 @@ |
1507 | import Unity.Indicators 0.1 as Indicators |
1508 | |
1509 | Indicators.FakeIndicatorsModel { |
1510 | + id: root |
1511 | + |
1512 | + Component.onCompleted: { |
1513 | + Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake1", |
1514 | + "/com/canonical/indicators/fake1", |
1515 | + "/com/canonical/indicators/fake1", |
1516 | + getUnityMenuModelData("fake-indicator-bluetooth", |
1517 | + "Bluetooth (F)", |
1518 | + "", |
1519 | + [ "image://theme/bluetooth-active" ])); |
1520 | + Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake2", |
1521 | + "/com/canonical/indicators/fake2", |
1522 | + "/com/canonical/indicators/fake2", |
1523 | + getUnityMenuModelData("fake-indicator-network", |
1524 | + "Network (F)", |
1525 | + "", |
1526 | + [ "image://theme/simcard-error", "image://theme/wifi-high" ])); |
1527 | + Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake3", |
1528 | + "/com/canonical/indicators/fake3", |
1529 | + "/com/canonical/indicators/fake3", |
1530 | + getUnityMenuModelData("fake-indicator-sound", |
1531 | + "Messages (F)", |
1532 | + "", |
1533 | + [ "image://theme/messages-new" ])); |
1534 | + Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake4", |
1535 | + "/com/canonical/indicators/fake4", |
1536 | + "/com/canonical/indicators/fake4", |
1537 | + getUnityMenuModelData("fake-indicator-power", |
1538 | + "Sound (F)", |
1539 | + "", |
1540 | + [ "image://theme/audio-volume-high" ])); |
1541 | + Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake5", |
1542 | + "/com/canonical/indicators/fake5", |
1543 | + "/com/canonical/indicators/fake5", |
1544 | + getUnityMenuModelData("fake-indicator-power", |
1545 | + "Battery (F)", |
1546 | + "", |
1547 | + [ "image://theme/battery-020" ])); |
1548 | + } |
1549 | + |
1550 | + function getUnityMenuModelData(identifier, title, label, icons) { |
1551 | + var root = [{ |
1552 | + "rowData": { // 1 |
1553 | + "label": "", |
1554 | + "sensitive": true, |
1555 | + "isSeparator": false, |
1556 | + "icon": "", |
1557 | + "type": "com.canonical.indicator.root", |
1558 | + "ext": {}, |
1559 | + "action": "", |
1560 | + "actionState": { |
1561 | + "title": title, |
1562 | + "label": label, |
1563 | + "icons": icons |
1564 | + }, |
1565 | + "isCheck": false, |
1566 | + "isRadio": false, |
1567 | + "isToggled": false, |
1568 | + }, |
1569 | + "submenu": [] |
1570 | + }]; |
1571 | + |
1572 | + var submenus = []; |
1573 | + for (var i = 0; i < 8; i++) { |
1574 | + var submenu = { |
1575 | + "rowData": { // 1.1 |
1576 | + "label": identifier, |
1577 | + "sensitive": true, |
1578 | + "isSeparator": false, |
1579 | + "icon": "", |
1580 | + "type": undefined, |
1581 | + "ext": {}, |
1582 | + "action": "", |
1583 | + "actionState": {}, |
1584 | + "isCheck": false, |
1585 | + "isRadio": false, |
1586 | + "isToggled": false, |
1587 | + }}; |
1588 | + submenus.push(submenu); |
1589 | + } |
1590 | + root[0]["submenu"] = submenus; |
1591 | + |
1592 | + return root; |
1593 | + } |
1594 | + |
1595 | + property var originalModelData: [ |
1596 | + { |
1597 | + "identifier": "indicator-fake1", |
1598 | + "widgetSource": "Indicators/DefaultIndicatorWidget.qml", |
1599 | + "pageSource": "Indicators/DefaultIndicatorPage.qml", |
1600 | + "indicatorProperties": { |
1601 | + "enabled": true, |
1602 | + "busName": "com.canonical.indicators.fake1", |
1603 | + "menuObjectPath": "/com/canonical/indicators/fake1", |
1604 | + "actionsObjectPath": "/com/canonical/indicators/fake1" |
1605 | + } |
1606 | + }, |
1607 | + { |
1608 | + "identifier": "indicator-fake2", |
1609 | + "widgetSource": "Indicators/DefaultIndicatorWidget.qml", |
1610 | + "pageSource": "Indicators/DefaultIndicatorPage.qml", |
1611 | + "indicatorProperties": { |
1612 | + "enabled": true, |
1613 | + "busName": "com.canonical.indicators.fake2", |
1614 | + "menuObjectPath": "/com/canonical/indicators/fake2", |
1615 | + "actionsObjectPath": "/com/canonical/indicators/fake2" |
1616 | + } |
1617 | + }, |
1618 | + { |
1619 | + "identifier": "indicator-fake3", |
1620 | + "widgetSource": "Indicators/DefaultIndicatorWidget.qml", |
1621 | + "pageSource": "Indicators/DefaultIndicatorPage.qml", |
1622 | + "indicatorProperties": { |
1623 | + "enabled": true, |
1624 | + "busName": "com.canonical.indicators.fake3", |
1625 | + "menuObjectPath": "/com/canonical/indicators/fake3", |
1626 | + "actionsObjectPath": "/com/canonical/indicators/fake3" |
1627 | + } |
1628 | + }, |
1629 | + { |
1630 | + "identifier": "indicator-fake4", |
1631 | + "widgetSource": "Indicators/DefaultIndicatorWidget.qml", |
1632 | + "pageSource": "Indicators/DefaultIndicatorPage.qml", |
1633 | + "indicatorProperties": { |
1634 | + "enabled": true, |
1635 | + "busName": "com.canonical.indicators.fake4", |
1636 | + "menuObjectPath": "/com/canonical/indicators/fake4", |
1637 | + "actionsObjectPath": "/com/canonical/indicators/fake4" |
1638 | + } |
1639 | + }, |
1640 | + { |
1641 | + "identifier": "indicator-fake5", |
1642 | + "widgetSource": "Indicators/DefaultIndicatorWidget.qml", |
1643 | + "pageSource": "Indicators/DefaultIndicatorPage.qml", |
1644 | + "indicatorProperties": { |
1645 | + "enabled": true, |
1646 | + "busName": "com.canonical.indicators.fake5", |
1647 | + "menuObjectPath": "/com/canonical/indicators/fake5", |
1648 | + "actionsObjectPath": "/com/canonical/indicators/fake5" |
1649 | + } |
1650 | + } |
1651 | + ] |
1652 | |
1653 | function load(profile) { |
1654 | unload(); |
1655 | - |
1656 | - append({ "identifier": "indicator-fake1", |
1657 | - "position": 0, |
1658 | - "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget1.qml", |
1659 | - "pageSource": "qrc:/tests/indciators/qml/fake_menu_page1.qml", |
1660 | - "indicatorProperties": { enabled: true } |
1661 | - }); |
1662 | - |
1663 | - append({ "identifier": "indicator-fake2", |
1664 | - "position": 1, |
1665 | - "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget2.qml", |
1666 | - "pageSource": "qrc:/tests/indciators/qml/fake_menu_page2.qml", |
1667 | - "indicatorProperties": { enabled: true } |
1668 | - }); |
1669 | - |
1670 | - append({ "identifier": "indicator-fake3", |
1671 | - "position": 2, |
1672 | - "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget3.qml", |
1673 | - "pageSource": "qrc:/tests/indciators/qml/fake_menu_page3.qml", |
1674 | - "indicatorProperties": { enabled: true } |
1675 | - }); |
1676 | - |
1677 | - append({ "identifier": "indicator-fake4", |
1678 | - "position": 3, |
1679 | - "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget4.qml", |
1680 | - "pageSource": "qrc:/tests/indciators/qml/fake_menu_page4.qml", |
1681 | - "indicatorProperties": { enabled: true } |
1682 | - }); |
1683 | - |
1684 | - append({ "identifier": "indicator-fake5", |
1685 | - "position": 4, |
1686 | - "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget5.qml", |
1687 | - "pageSource": "qrc:/tests/indciators/qml/fake_menu_page5.qml", |
1688 | - "indicatorProperties": { enabled: true } |
1689 | - }); |
1690 | + root.modelData = originalModelData; |
1691 | } |
1692 | } |
1693 | |
1694 | === modified file 'tests/mocks/Unity/Indicators/RootActionState.qml' |
1695 | --- tests/mocks/Unity/Indicators/RootActionState.qml 2013-10-28 18:19:15 +0000 |
1696 | +++ tests/mocks/Unity/Indicators/RootActionState.qml 2014-10-14 11:43:16 +0000 |
1697 | @@ -19,15 +19,23 @@ |
1698 | |
1699 | import QtQuick 2.0 |
1700 | |
1701 | -QtObject { |
1702 | - property var menu |
1703 | - property bool valid: false |
1704 | - property string title |
1705 | - property string leftLabel |
1706 | - property string rightLabel |
1707 | - property var icons |
1708 | - property string accessibleName |
1709 | - property bool visible: true |
1710 | +Item { |
1711 | + property var menu: null |
1712 | + property bool valid: cachedState !== undefined |
1713 | + property string title: cachedState && cachedState.hasOwnProperty("title") ? cachedState["title"] : "" |
1714 | + property string leftLabel: cachedState && cachedState.hasOwnProperty("pre-label") ? cachedState["pre-label"] : "" |
1715 | + property string rightLabel: cachedState && cachedState.hasOwnProperty("label") ? cachedState["label"] : "" |
1716 | + property var icons: cachedState && cachedState.hasOwnProperty("icons") ? cachedState["icons"] : [] |
1717 | + property string accessibleName: cachedState && cachedState.hasOwnProperty("accessible-desc") ? cachedState["accessible-desc"] : "" |
1718 | + visible: cachedState && cachedState.hasOwnProperty("visible") ? cachedState["visible"] : true |
1719 | + |
1720 | + property var cachedState: menu ? menu.get(0, "actionState") : undefined |
1721 | + Connections { |
1722 | + target: menu |
1723 | + onModelDataChanged: { |
1724 | + cachedState = menu.get(0, "actionState"); |
1725 | + } |
1726 | + } |
1727 | |
1728 | signal updated |
1729 | |
1730 | |
1731 | === modified file 'tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp' |
1732 | --- tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp 2014-07-01 09:49:24 +0000 |
1733 | +++ tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp 2014-10-14 11:43:16 +0000 |
1734 | @@ -31,7 +31,6 @@ |
1735 | /*! \internal */ |
1736 | FakeIndicatorsModel::~FakeIndicatorsModel() |
1737 | { |
1738 | - qDeleteAll(m_indicators); |
1739 | } |
1740 | |
1741 | int FakeIndicatorsModel::count() const |
1742 | @@ -47,29 +46,61 @@ |
1743 | { |
1744 | beginResetModel(); |
1745 | |
1746 | - qDeleteAll(m_indicators); |
1747 | - m_indicators.clear(); |
1748 | - |
1749 | - endResetModel(); |
1750 | -} |
1751 | - |
1752 | - |
1753 | -void FakeIndicatorsModel::append(const QVariantMap& row) |
1754 | -{ |
1755 | - Indicator* new_row = new QHash<int, QVariant>(); |
1756 | - for (auto iter = row.begin(); iter != row.end(); ++iter ) |
1757 | - { |
1758 | - int key = roleNames().key(iter.key().toUtf8(), -1); |
1759 | - if (key != -1) { |
1760 | - new_row->insert(key, iter.value()); |
1761 | - } |
1762 | - } |
1763 | - |
1764 | - beginInsertRows(QModelIndex(), m_indicators.count(), m_indicators.count()); |
1765 | - |
1766 | - m_indicators.append(new_row); |
1767 | - |
1768 | - endInsertRows(); |
1769 | + m_modelData.clear(); |
1770 | + Q_EMIT modelDataChanged(); |
1771 | + |
1772 | + endResetModel(); |
1773 | +} |
1774 | + |
1775 | + |
1776 | +void FakeIndicatorsModel::append(const QVariantMap& data) |
1777 | +{ |
1778 | + QList<QVariant> allData = m_modelData.toList(); |
1779 | + beginInsertRows(QModelIndex(), allData.count(), allData.count()); |
1780 | + |
1781 | + allData.append(data); |
1782 | + m_modelData = allData; |
1783 | + Q_EMIT modelDataChanged(); |
1784 | + |
1785 | + endInsertRows(); |
1786 | +} |
1787 | + |
1788 | +void FakeIndicatorsModel::insert(int row, const QVariantMap& data) |
1789 | +{ |
1790 | + QList<QVariant> allData = m_modelData.toList(); |
1791 | + row = qMax(0, qMin(row, allData.count())); |
1792 | + |
1793 | + beginInsertRows(QModelIndex(), row, row); |
1794 | + |
1795 | + allData.insert(row, data); |
1796 | + m_modelData = allData; |
1797 | + Q_EMIT modelDataChanged(); |
1798 | + |
1799 | + endInsertRows(); |
1800 | +} |
1801 | + |
1802 | +void FakeIndicatorsModel::remove(int row) |
1803 | +{ |
1804 | + QList<QVariant> allData = m_modelData.toList(); |
1805 | + row = qMax(0, qMin(row, allData.count())); |
1806 | + |
1807 | + beginRemoveRows(QModelIndex(), row, row); |
1808 | + |
1809 | + allData.removeAt(row); |
1810 | + m_modelData = allData; |
1811 | + Q_EMIT modelDataChanged(); |
1812 | + |
1813 | + endRemoveRows(); |
1814 | +} |
1815 | + |
1816 | +void FakeIndicatorsModel::setModelData(const QVariant& modelData) |
1817 | +{ |
1818 | + beginResetModel(); |
1819 | + |
1820 | + m_modelData = modelData; |
1821 | + Q_EMIT modelDataChanged(); |
1822 | + |
1823 | + endResetModel(); |
1824 | } |
1825 | |
1826 | QHash<int, QByteArray> FakeIndicatorsModel::roleNames() const |
1827 | @@ -91,18 +122,18 @@ |
1828 | return 1; |
1829 | } |
1830 | |
1831 | -Q_INVOKABLE QVariant FakeIndicatorsModel::data(int row, int role) const |
1832 | +QVariant FakeIndicatorsModel::data(int row, int role) const |
1833 | { |
1834 | return data(index(row, 0), role); |
1835 | } |
1836 | |
1837 | QVariant FakeIndicatorsModel::data(const QModelIndex &index, int role) const |
1838 | { |
1839 | - if (!index.isValid() || index.row() >= m_indicators.size()) |
1840 | + QList<QVariant> dataList = m_modelData.toList(); |
1841 | + if (!index.isValid() || index.row() >= dataList.size()) |
1842 | return QVariant(); |
1843 | |
1844 | - Indicator* indicator = m_indicators[index.row()]; |
1845 | - return indicator->value(role, QVariant()); |
1846 | + return dataList[index.row()].toMap()[roleNames()[role]]; |
1847 | } |
1848 | |
1849 | QModelIndex FakeIndicatorsModel::parent(const QModelIndex&) const |
1850 | @@ -112,5 +143,5 @@ |
1851 | |
1852 | int FakeIndicatorsModel::rowCount(const QModelIndex&) const |
1853 | { |
1854 | - return m_indicators.count(); |
1855 | + return m_modelData.toList().count(); |
1856 | } |
1857 | |
1858 | === modified file 'tests/mocks/Unity/Indicators/fakeindicatorsmodel.h' |
1859 | --- tests/mocks/Unity/Indicators/fakeindicatorsmodel.h 2014-03-03 12:01:09 +0000 |
1860 | +++ tests/mocks/Unity/Indicators/fakeindicatorsmodel.h 2014-10-14 11:43:16 +0000 |
1861 | @@ -27,6 +27,7 @@ |
1862 | Q_OBJECT |
1863 | Q_ENUMS(Roles) |
1864 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
1865 | + Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged) |
1866 | public: |
1867 | |
1868 | FakeIndicatorsModel(QObject *parent=0); |
1869 | @@ -36,9 +37,14 @@ |
1870 | Q_INVOKABLE void unload(); |
1871 | |
1872 | Q_INVOKABLE void append(const QVariantMap& row); |
1873 | + Q_INVOKABLE void insert(int row, const QVariantMap& data); |
1874 | + Q_INVOKABLE void remove(int row); |
1875 | |
1876 | Q_INVOKABLE QVariant data(int row, int role) const; |
1877 | |
1878 | + void setModelData(const QVariant& data); |
1879 | + QVariant modelData() const { return m_modelData; } |
1880 | + |
1881 | /* QAbstractItemModel */ |
1882 | QHash<int, QByteArray> roleNames() const; |
1883 | int columnCount(const QModelIndex &parent = QModelIndex()) const; |
1884 | @@ -48,12 +54,12 @@ |
1885 | |
1886 | Q_SIGNALS: |
1887 | void countChanged(); |
1888 | + void modelDataChanged(); |
1889 | |
1890 | private: |
1891 | int count() const; |
1892 | |
1893 | - typedef QHash<int, QVariant> Indicator; |
1894 | - QList<Indicator*> m_indicators; |
1895 | + QVariant m_modelData; |
1896 | }; |
1897 | |
1898 | #endif // FAKE_INDICATORSMODEL_H |
1899 | |
1900 | === modified file 'tests/mocks/Unity/Indicators/fakeplugin.cpp' |
1901 | --- tests/mocks/Unity/Indicators/fakeplugin.cpp 2014-08-20 08:39:09 +0000 |
1902 | +++ tests/mocks/Unity/Indicators/fakeplugin.cpp 2014-10-14 11:43:16 +0000 |
1903 | @@ -26,19 +26,22 @@ |
1904 | #include "fakeindicatorsmodel.h" |
1905 | #include "indicators.h" |
1906 | #include "menucontentactivator.h" |
1907 | -#include "unitymenumodelcache.h" |
1908 | +#include "sharedunitymenumodel.h" |
1909 | +#include "fakeunitymenumodelcache.h" |
1910 | #include "unitymenumodelstack.h" |
1911 | #include "visibleindicatorsmodel.h" |
1912 | |
1913 | +#include <unitymenumodel.h> |
1914 | + |
1915 | static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) { |
1916 | Q_UNUSED(engine); |
1917 | Q_UNUSED(scriptEngine); |
1918 | - return new UnityMenuModelCache; |
1919 | + return FakeUnityMenuModelCache::singleton(); |
1920 | } |
1921 | |
1922 | void IndicatorsFakePlugin::registerTypes(const char * uri) |
1923 | { |
1924 | - Q_INIT_RESOURCE(indicators_fake); |
1925 | + qRegisterMetaType<UnityMenuModel*>("UnityMenuModel*"); |
1926 | |
1927 | // internal |
1928 | qmlRegisterType<FakeIndicatorsModel>(uri, 0, 1, "FakeIndicatorsModel"); |
1929 | @@ -47,8 +50,9 @@ |
1930 | qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator"); |
1931 | qmlRegisterType<UnityMenuModelStack>(uri, 0, 1, "UnityMenuModelStack"); |
1932 | qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel"); |
1933 | + qmlRegisterType<SharedUnityMenuModel>(uri, 0, 1, "SharedUnityMenuModel"); |
1934 | |
1935 | - qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton); |
1936 | + qmlRegisterSingletonType<FakeUnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton); |
1937 | |
1938 | // external uncreatables |
1939 | qmlRegisterUncreatableType<MenuContentState>(uri, 0, 1, "MenuContentState", "Can't create MenuContentState class"); |
1940 | |
1941 | === added file 'tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp' |
1942 | --- tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp 1970-01-01 00:00:00 +0000 |
1943 | +++ tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp 2014-10-14 11:43:16 +0000 |
1944 | @@ -0,0 +1,57 @@ |
1945 | +/* |
1946 | + * Copyright 2014 Canonical Ltd. |
1947 | + * |
1948 | + * This program is free software; you can redistribute it and/or modify |
1949 | + * it under the terms of the GNU Lesser General Public License as published by |
1950 | + * the Free Software Foundation; version 3. |
1951 | + * |
1952 | + * This program is distributed in the hope that it will be useful, |
1953 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1954 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1955 | + * GNU Lesser General Public License for more details. |
1956 | + * |
1957 | + * You should have received a copy of the GNU Lesser General Public License |
1958 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1959 | + */ |
1960 | + |
1961 | +#include "fakeunitymenumodelcache.h" |
1962 | +#include <unitymenumodel.h> |
1963 | + |
1964 | +FakeUnityMenuModelCache* FakeUnityMenuModelCache::theFakeCache = nullptr; |
1965 | + |
1966 | +FakeUnityMenuModelCache* FakeUnityMenuModelCache::singleton() |
1967 | +{ |
1968 | + if (!theFakeCache) { |
1969 | + theFakeCache = new FakeUnityMenuModelCache(); |
1970 | + } |
1971 | + return theFakeCache; |
1972 | +} |
1973 | + |
1974 | +FakeUnityMenuModelCache::FakeUnityMenuModelCache(QObject* parent) |
1975 | + : UnityMenuModelCache(parent) |
1976 | +{ |
1977 | +} |
1978 | + |
1979 | +QSharedPointer<UnityMenuModel> FakeUnityMenuModelCache::model(const QByteArray& bus, |
1980 | + const QByteArray& path, |
1981 | + const QVariantMap& actions) |
1982 | +{ |
1983 | + return UnityMenuModelCache::singleton()->model(bus, path, actions); |
1984 | +} |
1985 | + |
1986 | +bool FakeUnityMenuModelCache::contains(const QByteArray& path) |
1987 | +{ |
1988 | + return UnityMenuModelCache::singleton()->contains(path); |
1989 | +} |
1990 | + |
1991 | +void FakeUnityMenuModelCache::setCachedModelData(const QByteArray& bus, |
1992 | + const QByteArray& path, |
1993 | + const QVariantMap& actions, |
1994 | + const QVariant& data) |
1995 | +{ |
1996 | + // keep a ref forever! |
1997 | + if (!m_models.contains(path)) { |
1998 | + m_models[path] = model(bus, path, actions); |
1999 | + } |
2000 | + m_models[path]->setModelData(data); |
2001 | +} |
2002 | |
2003 | === added file 'tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h' |
2004 | --- tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h 1970-01-01 00:00:00 +0000 |
2005 | +++ tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h 2014-10-14 11:43:16 +0000 |
2006 | @@ -0,0 +1,50 @@ |
2007 | +/* |
2008 | + * Copyright 2014 Canonical Ltd. |
2009 | + * |
2010 | + * This program is free software; you can redistribute it and/or modify |
2011 | + * it under the terms of the GNU Lesser General Public License as published by |
2012 | + * the Free Software Foundation; version 3. |
2013 | + * |
2014 | + * This program is distributed in the hope that it will be useful, |
2015 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2016 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2017 | + * GNU Lesser General Public License for more details. |
2018 | + * |
2019 | + * You should have received a copy of the GNU Lesser General Public License |
2020 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2021 | + */ |
2022 | + |
2023 | +#ifndef FAKEUNITYMENUMODELCACHE_H |
2024 | +#define FAKEUNITYMENUMODELCACHE_H |
2025 | + |
2026 | +#include "unitymenumodelcache.h" |
2027 | + |
2028 | +#include <QHash> |
2029 | +#include <QVariantMap> |
2030 | + |
2031 | +class FakeUnityMenuModelCache : public UnityMenuModelCache |
2032 | +{ |
2033 | + Q_OBJECT |
2034 | +public: |
2035 | + FakeUnityMenuModelCache(QObject* parent = nullptr); |
2036 | + |
2037 | + static FakeUnityMenuModelCache* singleton(); |
2038 | + |
2039 | + QSharedPointer<UnityMenuModel> model(const QByteArray& bus, |
2040 | + const QByteArray& path, |
2041 | + const QVariantMap& actions) override; |
2042 | + bool contains(const QByteArray& path) override; |
2043 | + |
2044 | + |
2045 | + |
2046 | + Q_INVOKABLE void setCachedModelData(const QByteArray& bus, |
2047 | + const QByteArray& path, |
2048 | + const QVariantMap& actions, |
2049 | + const QVariant& data = QVariant()); |
2050 | + |
2051 | +private: |
2052 | + static FakeUnityMenuModelCache* theFakeCache; |
2053 | + QHash<QByteArray, QSharedPointer<UnityMenuModel>> m_models; |
2054 | +}; |
2055 | + |
2056 | +#endif // FAKEUNITYMENUMODELCACHE_H |
2057 | |
2058 | === removed file 'tests/mocks/Unity/Indicators/indicators_fake.qrc' |
2059 | --- tests/mocks/Unity/Indicators/indicators_fake.qrc 2013-06-17 09:02:14 +0000 |
2060 | +++ tests/mocks/Unity/Indicators/indicators_fake.qrc 1970-01-01 00:00:00 +0000 |
2061 | @@ -1,14 +0,0 @@ |
2062 | -<RCC> |
2063 | - <qresource prefix="/tests/indciators"> |
2064 | - <file>qml/fake_menu_widget1.qml</file> |
2065 | - <file>qml/fake_menu_widget2.qml</file> |
2066 | - <file>qml/fake_menu_widget3.qml</file> |
2067 | - <file>qml/fake_menu_widget4.qml</file> |
2068 | - <file>qml/fake_menu_widget5.qml</file> |
2069 | - <file>qml/fake_menu_page1.qml</file> |
2070 | - <file>qml/fake_menu_page2.qml</file> |
2071 | - <file>qml/fake_menu_page3.qml</file> |
2072 | - <file>qml/fake_menu_page4.qml</file> |
2073 | - <file>qml/fake_menu_page5.qml</file> |
2074 | - </qresource> |
2075 | -</RCC> |
2076 | |
2077 | === removed directory 'tests/mocks/Unity/Indicators/qml' |
2078 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml' |
2079 | --- tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml 2014-01-14 16:44:35 +0000 |
2080 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml 1970-01-01 00:00:00 +0000 |
2081 | @@ -1,35 +0,0 @@ |
2082 | -/* |
2083 | - * Copyright 2013 Canonical Ltd. |
2084 | - * |
2085 | - * This program is free software; you can redistribute it and/or modify |
2086 | - * it under the terms of the GNU General Public License as published by |
2087 | - * the Free Software Foundation; version 3. |
2088 | - * |
2089 | - * This program is distributed in the hope that it will be useful, |
2090 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2091 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2092 | - * GNU General Public License for more details. |
2093 | - * |
2094 | - * You should have received a copy of the GNU General Public License |
2095 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2096 | - */ |
2097 | - |
2098 | -import QtQuick 2.0 |
2099 | -import Unity.Indicators 0.1 as Indicators |
2100 | - |
2101 | -Indicators.FakeMenuPage { |
2102 | - id: menu_plugin1 |
2103 | - |
2104 | - Rectangle { |
2105 | - id: contents |
2106 | - color: "red" |
2107 | - |
2108 | - height: 150 |
2109 | - width: 150 |
2110 | - |
2111 | - anchors { |
2112 | - horizontalCenter: parent.horizontalCenter |
2113 | - verticalCenter: parent.verticalCenter |
2114 | - } |
2115 | - } |
2116 | -} |
2117 | |
2118 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml' |
2119 | --- tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml 2014-01-14 16:44:35 +0000 |
2120 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml 1970-01-01 00:00:00 +0000 |
2121 | @@ -1,35 +0,0 @@ |
2122 | -/* |
2123 | - * Copyright 2013 Canonical Ltd. |
2124 | - * |
2125 | - * This program is free software; you can redistribute it and/or modify |
2126 | - * it under the terms of the GNU General Public License as published by |
2127 | - * the Free Software Foundation; version 3. |
2128 | - * |
2129 | - * This program is distributed in the hope that it will be useful, |
2130 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2131 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2132 | - * GNU General Public License for more details. |
2133 | - * |
2134 | - * You should have received a copy of the GNU General Public License |
2135 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2136 | - */ |
2137 | - |
2138 | -import QtQuick 2.0 |
2139 | -import Unity.Indicators 0.1 as Indicators |
2140 | - |
2141 | -Indicators.FakeMenuPage { |
2142 | - id: menu_plugin2 |
2143 | - |
2144 | - Rectangle { |
2145 | - id: contents |
2146 | - color: "blue" |
2147 | - |
2148 | - height: 150 |
2149 | - width: 150 |
2150 | - |
2151 | - anchors { |
2152 | - horizontalCenter: parent.horizontalCenter |
2153 | - verticalCenter: parent.verticalCenter |
2154 | - } |
2155 | - } |
2156 | -} |
2157 | |
2158 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml' |
2159 | --- tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml 2014-01-14 16:44:35 +0000 |
2160 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml 1970-01-01 00:00:00 +0000 |
2161 | @@ -1,35 +0,0 @@ |
2162 | -/* |
2163 | - * Copyright 2013 Canonical Ltd. |
2164 | - * |
2165 | - * This program is free software; you can redistribute it and/or modify |
2166 | - * it under the terms of the GNU General Public License as published by |
2167 | - * the Free Software Foundation; version 3. |
2168 | - * |
2169 | - * This program is distributed in the hope that it will be useful, |
2170 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2171 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2172 | - * GNU General Public License for more details. |
2173 | - * |
2174 | - * You should have received a copy of the GNU General Public License |
2175 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2176 | - */ |
2177 | - |
2178 | -import QtQuick 2.0 |
2179 | -import Unity.Indicators 0.1 as Indicators |
2180 | - |
2181 | -Indicators.FakeMenuPage { |
2182 | - id: menu_plugin3 |
2183 | - |
2184 | - Rectangle { |
2185 | - id: contents |
2186 | - color: "yellow" |
2187 | - |
2188 | - height: 150 |
2189 | - width: 150 |
2190 | - |
2191 | - anchors { |
2192 | - horizontalCenter: parent.horizontalCenter |
2193 | - verticalCenter: parent.verticalCenter |
2194 | - } |
2195 | - } |
2196 | -} |
2197 | |
2198 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml' |
2199 | --- tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml 2014-01-14 16:44:35 +0000 |
2200 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml 1970-01-01 00:00:00 +0000 |
2201 | @@ -1,35 +0,0 @@ |
2202 | -/* |
2203 | - * Copyright 2013 Canonical Ltd. |
2204 | - * |
2205 | - * This program is free software; you can redistribute it and/or modify |
2206 | - * it under the terms of the GNU General Public License as published by |
2207 | - * the Free Software Foundation; version 3. |
2208 | - * |
2209 | - * This program is distributed in the hope that it will be useful, |
2210 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2211 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2212 | - * GNU General Public License for more details. |
2213 | - * |
2214 | - * You should have received a copy of the GNU General Public License |
2215 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2216 | - */ |
2217 | - |
2218 | -import QtQuick 2.0 |
2219 | -import Unity.Indicators 0.1 as Indicators |
2220 | - |
2221 | -Indicators.FakeMenuPage { |
2222 | - id: menu_plugin4 |
2223 | - |
2224 | - Rectangle { |
2225 | - id: contents |
2226 | - color: "green" |
2227 | - |
2228 | - height: 150 |
2229 | - width: 150 |
2230 | - |
2231 | - anchors { |
2232 | - horizontalCenter: parent.horizontalCenter |
2233 | - verticalCenter: parent.verticalCenter |
2234 | - } |
2235 | - } |
2236 | -} |
2237 | |
2238 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml' |
2239 | --- tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml 2014-01-14 16:44:35 +0000 |
2240 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml 1970-01-01 00:00:00 +0000 |
2241 | @@ -1,35 +0,0 @@ |
2242 | -/* |
2243 | - * Copyright 2013 Canonical Ltd. |
2244 | - * |
2245 | - * This program is free software; you can redistribute it and/or modify |
2246 | - * it under the terms of the GNU General Public License as published by |
2247 | - * the Free Software Foundation; version 3. |
2248 | - * |
2249 | - * This program is distributed in the hope that it will be useful, |
2250 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2251 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2252 | - * GNU General Public License for more details. |
2253 | - * |
2254 | - * You should have received a copy of the GNU General Public License |
2255 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2256 | - */ |
2257 | - |
2258 | -import QtQuick 2.0 |
2259 | -import Unity.Indicators 0.1 as Indicators |
2260 | - |
2261 | -Indicators.FakeMenuPage { |
2262 | - id: menu_plugin5 |
2263 | - |
2264 | - Rectangle { |
2265 | - id: contents |
2266 | - color: "orange" |
2267 | - |
2268 | - height: 150 |
2269 | - width: 150 |
2270 | - |
2271 | - anchors { |
2272 | - horizontalCenter: parent.horizontalCenter |
2273 | - verticalCenter: parent.verticalCenter |
2274 | - } |
2275 | - } |
2276 | -} |
2277 | |
2278 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml' |
2279 | --- tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml 2013-06-17 09:02:14 +0000 |
2280 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml 1970-01-01 00:00:00 +0000 |
2281 | @@ -1,23 +0,0 @@ |
2282 | -/* |
2283 | - * Copyright 2013 Canonical Ltd. |
2284 | - * |
2285 | - * This program is free software; you can redistribute it and/or modify |
2286 | - * it under the terms of the GNU General Public License as published by |
2287 | - * the Free Software Foundation; version 3. |
2288 | - * |
2289 | - * This program is distributed in the hope that it will be useful, |
2290 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2291 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2292 | - * GNU General Public License for more details. |
2293 | - * |
2294 | - * You should have received a copy of the GNU General Public License |
2295 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2296 | - */ |
2297 | - |
2298 | -import QtQuick 2.0 |
2299 | - |
2300 | -Rectangle { |
2301 | - width: 40 |
2302 | - height: 40 |
2303 | - color : "red" |
2304 | -} |
2305 | |
2306 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml' |
2307 | --- tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml 2014-01-13 16:25:32 +0000 |
2308 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml 1970-01-01 00:00:00 +0000 |
2309 | @@ -1,23 +0,0 @@ |
2310 | -/* |
2311 | - * Copyright 2013 Canonical Ltd. |
2312 | - * |
2313 | - * This program is free software; you can redistribute it and/or modify |
2314 | - * it under the terms of the GNU General Public License as published by |
2315 | - * the Free Software Foundation; version 3. |
2316 | - * |
2317 | - * This program is distributed in the hope that it will be useful, |
2318 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2319 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2320 | - * GNU General Public License for more details. |
2321 | - * |
2322 | - * You should have received a copy of the GNU General Public License |
2323 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2324 | - */ |
2325 | - |
2326 | -import QtQuick 2.0 |
2327 | - |
2328 | -Rectangle { |
2329 | - width: 40 |
2330 | - height: 40 |
2331 | - color : "blue" |
2332 | -} |
2333 | |
2334 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml' |
2335 | --- tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml 2014-01-13 16:25:32 +0000 |
2336 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml 1970-01-01 00:00:00 +0000 |
2337 | @@ -1,23 +0,0 @@ |
2338 | -/* |
2339 | - * Copyright 2013 Canonical Ltd. |
2340 | - * |
2341 | - * This program is free software; you can redistribute it and/or modify |
2342 | - * it under the terms of the GNU General Public License as published by |
2343 | - * the Free Software Foundation; version 3. |
2344 | - * |
2345 | - * This program is distributed in the hope that it will be useful, |
2346 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2347 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2348 | - * GNU General Public License for more details. |
2349 | - * |
2350 | - * You should have received a copy of the GNU General Public License |
2351 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2352 | - */ |
2353 | - |
2354 | -import QtQuick 2.0 |
2355 | - |
2356 | -Rectangle { |
2357 | - width: 40 |
2358 | - height: 40 |
2359 | - color : "yellow" |
2360 | -} |
2361 | |
2362 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml' |
2363 | --- tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml 2013-06-17 09:02:14 +0000 |
2364 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml 1970-01-01 00:00:00 +0000 |
2365 | @@ -1,23 +0,0 @@ |
2366 | -/* |
2367 | - * Copyright 2013 Canonical Ltd. |
2368 | - * |
2369 | - * This program is free software; you can redistribute it and/or modify |
2370 | - * it under the terms of the GNU General Public License as published by |
2371 | - * the Free Software Foundation; version 3. |
2372 | - * |
2373 | - * This program is distributed in the hope that it will be useful, |
2374 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2375 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2376 | - * GNU General Public License for more details. |
2377 | - * |
2378 | - * You should have received a copy of the GNU General Public License |
2379 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2380 | - */ |
2381 | - |
2382 | -import QtQuick 2.0 |
2383 | - |
2384 | -Rectangle { |
2385 | - width: 40 |
2386 | - height: 40 |
2387 | - color : "green" |
2388 | -} |
2389 | |
2390 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml' |
2391 | --- tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml 2013-06-17 09:02:14 +0000 |
2392 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml 1970-01-01 00:00:00 +0000 |
2393 | @@ -1,23 +0,0 @@ |
2394 | -/* |
2395 | - * Copyright 2013 Canonical Ltd. |
2396 | - * |
2397 | - * This program is free software; you can redistribute it and/or modify |
2398 | - * it under the terms of the GNU General Public License as published by |
2399 | - * the Free Software Foundation; version 3. |
2400 | - * |
2401 | - * This program is distributed in the hope that it will be useful, |
2402 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2403 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2404 | - * GNU General Public License for more details. |
2405 | - * |
2406 | - * You should have received a copy of the GNU General Public License |
2407 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2408 | - */ |
2409 | - |
2410 | -import QtQuick 2.0 |
2411 | - |
2412 | -Rectangle { |
2413 | - width: 40 |
2414 | - height: 40 |
2415 | - color : "orange" |
2416 | -} |
2417 | |
2418 | === modified file 'tests/mocks/Unity/Indicators/qmldir' |
2419 | --- tests/mocks/Unity/Indicators/qmldir 2014-08-20 08:39:09 +0000 |
2420 | +++ tests/mocks/Unity/Indicators/qmldir 2014-10-14 11:43:16 +0000 |
2421 | @@ -3,5 +3,4 @@ |
2422 | typeinfo Indicators.qmltypes |
2423 | |
2424 | IndicatorsModel 0.1 IndicatorsModel.qml |
2425 | -FakeMenuPage 0.1 FakeMenuPage.qml |
2426 | RootActionState 0.1 RootActionState.qml |
2427 | |
2428 | === modified file 'tests/mocks/Unity/Launcher/Launcher.qmltypes' |
2429 | --- tests/mocks/Unity/Launcher/Launcher.qmltypes 2014-06-26 07:47:57 +0000 |
2430 | +++ tests/mocks/Unity/Launcher/Launcher.qmltypes 2014-10-14 11:43:16 +0000 |
2431 | @@ -85,6 +85,7 @@ |
2432 | Property { name: "recent"; type: "bool"; isReadonly: true } |
2433 | Property { name: "progress"; type: "int"; isReadonly: true } |
2434 | Property { name: "count"; type: "int"; isReadonly: true } |
2435 | + Property { name: "countVisible"; type: "bool"; isReadonly: true } |
2436 | Property { name: "focused"; type: "bool"; isReadonly: true } |
2437 | Property { |
2438 | name: "quickList" |
2439 | @@ -93,6 +94,14 @@ |
2440 | isPointer: true |
2441 | } |
2442 | Signal { |
2443 | + name: "nameChanged" |
2444 | + Parameter { name: "name"; type: "string" } |
2445 | + } |
2446 | + Signal { |
2447 | + name: "iconChanged" |
2448 | + Parameter { name: "icon"; type: "string" } |
2449 | + } |
2450 | + Signal { |
2451 | name: "pinnedChanged" |
2452 | Parameter { name: "pinned"; type: "bool" } |
2453 | } |
2454 | @@ -113,6 +122,10 @@ |
2455 | Parameter { name: "count"; type: "int" } |
2456 | } |
2457 | Signal { |
2458 | + name: "countVisibleChanged" |
2459 | + Parameter { name: "countVisible"; type: "bool" } |
2460 | + } |
2461 | + Signal { |
2462 | name: "focusedChanged" |
2463 | Parameter { name: "focused"; type: "bool" } |
2464 | } |
2465 | |
2466 | === modified file 'tests/mocks/Unity/Unity.qmltypes' |
2467 | --- tests/mocks/Unity/Unity.qmltypes 2014-09-01 12:18:53 +0000 |
2468 | +++ tests/mocks/Unity/Unity.qmltypes 2014-10-14 11:43:16 +0000 |
2469 | @@ -30,6 +30,25 @@ |
2470 | Parameter { name: "row"; type: "int" } |
2471 | Parameter { name: "role"; type: "int" } |
2472 | } |
2473 | + Method { |
2474 | + name: "setCount" |
2475 | + Parameter { name: "count"; type: "int" } |
2476 | + } |
2477 | + Method { |
2478 | + name: "resultModel" |
2479 | + type: "ResultsModel*" |
2480 | + Parameter { name: "row"; type: "int" } |
2481 | + } |
2482 | + Method { |
2483 | + name: "setLayout" |
2484 | + Parameter { name: "row"; type: "int" } |
2485 | + Parameter { name: "layout"; type: "string" } |
2486 | + } |
2487 | + Method { |
2488 | + name: "setHeaderLink" |
2489 | + Parameter { name: "row"; type: "int" } |
2490 | + Parameter { name: "headerLink"; type: "string" } |
2491 | + } |
2492 | } |
2493 | Component { |
2494 | name: "PreviewModel" |
2495 | @@ -66,6 +85,10 @@ |
2496 | exports: ["Unity/FakeResultsModel 0.2", "Unity/ResultsModel 0.2"] |
2497 | isCreatable: false |
2498 | exportMetaObjectRevisions: [0, 0] |
2499 | + Method { |
2500 | + name: "setResultCount" |
2501 | + Parameter { name: "result_count"; type: "int" } |
2502 | + } |
2503 | } |
2504 | Component { |
2505 | name: "Scope" |
2506 | @@ -76,6 +99,15 @@ |
2507 | name: "performQuery" |
2508 | Parameter { name: "query"; type: "string" } |
2509 | } |
2510 | + Signal { name: "refreshed" } |
2511 | + Method { |
2512 | + name: "setId" |
2513 | + Parameter { name: "id"; type: "string" } |
2514 | + } |
2515 | + Method { |
2516 | + name: "setName" |
2517 | + Parameter { name: "name"; type: "string" } |
2518 | + } |
2519 | Method { |
2520 | name: "setSearchInProgress" |
2521 | Parameter { name: "inProg"; type: "bool" } |
2522 | |
2523 | === modified file 'tests/plugins/Unity/Indicators/CMakeLists.txt' |
2524 | --- tests/plugins/Unity/Indicators/CMakeLists.txt 2013-12-10 14:22:43 +0000 |
2525 | +++ tests/plugins/Unity/Indicators/CMakeLists.txt 2014-10-14 11:43:16 +0000 |
2526 | @@ -40,3 +40,4 @@ |
2527 | indicator_test(menucontentactivatortest ADDITIONAL_CPPS ${INDICATORS_DIR}/menucontentactivator.cpp) |
2528 | indicator_test(unitymenumodelstacktest ADDITIONAL_CPPS ${TEST_DIR}/mocks/QMenuModel/unitymenumodel.cpp ${INDICATORS_DIR}/unitymenumodelstack.cpp) |
2529 | indicator_test(rootactionstatetest ADDITIONAL_LIBS IndicatorsQml) |
2530 | +indicator_test(sharedunitymenumodeltest ADDITIONAL_LIBS IndicatorsQml) |
2531 | |
2532 | === added file 'tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp' |
2533 | --- tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp 1970-01-01 00:00:00 +0000 |
2534 | +++ tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp 2014-10-14 11:43:16 +0000 |
2535 | @@ -0,0 +1,92 @@ |
2536 | +/* |
2537 | + * Copyright 2014 Canonical Ltd. |
2538 | + * |
2539 | + * This program is free software; you can redistribute it and/or modify |
2540 | + * it under the terms of the GNU Lesser General Public License as published by |
2541 | + * the Free Software Foundation; version 3. |
2542 | + * |
2543 | + * This program is distributed in the hope that it will be useful, |
2544 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2545 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2546 | + * GNU Lesser General Public License for more details. |
2547 | + * |
2548 | + * You should have received a copy of the GNU Lesser General Public License |
2549 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2550 | + * |
2551 | + */ |
2552 | + |
2553 | +#include "sharedunitymenumodel.h" |
2554 | +#include "unitymenumodelcache.h" |
2555 | + |
2556 | +#include <QtTest> |
2557 | +#include <unitymenumodel.h> |
2558 | + |
2559 | +class SharedUnityMenuModelTest : public QObject |
2560 | +{ |
2561 | + Q_OBJECT |
2562 | + |
2563 | + SharedUnityMenuModel* createFullModel(const QByteArray& testId) |
2564 | + { |
2565 | + SharedUnityMenuModel* model = new SharedUnityMenuModel; |
2566 | + model->setBusName("com.canonical." + testId); |
2567 | + model->setMenuObjectPath("/com/canonical/" + testId); |
2568 | + QVariantMap actions; |
2569 | + actions["test"] = QString("/com/canonical/%1/actions").arg(QString(testId)); |
2570 | + model->setActions(actions); |
2571 | + |
2572 | + return model; |
2573 | + } |
2574 | + |
2575 | +private Q_SLOTS: |
2576 | + |
2577 | + void testCreateModel() |
2578 | + { |
2579 | + QSharedPointer<SharedUnityMenuModel> model(createFullModel("test1")); |
2580 | + QVERIFY(model->model() != nullptr); |
2581 | + } |
2582 | + |
2583 | + void testDifferentDataCreatesDifferentModels() |
2584 | + { |
2585 | + QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1")); |
2586 | + QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test2")); |
2587 | + |
2588 | + QVERIFY(model1->model() != model2->model()); |
2589 | + } |
2590 | + |
2591 | + void testSameDataCreatesSameModels() |
2592 | + { |
2593 | + QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1")); |
2594 | + QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test1")); |
2595 | + |
2596 | + QCOMPARE(model1->model(), model2->model()); |
2597 | + } |
2598 | + |
2599 | + void testSharedOwnership() |
2600 | + { |
2601 | + QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1")); |
2602 | + QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test1")); |
2603 | + |
2604 | + QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), true); |
2605 | + model1.clear(); |
2606 | + QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), true); |
2607 | + model2.clear(); |
2608 | + QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), false); |
2609 | + } |
2610 | + |
2611 | + // Tests that changing cached model data does not change the model path of others |
2612 | + void testLP1328646() |
2613 | + { |
2614 | + QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1")); |
2615 | + QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test1")); |
2616 | + |
2617 | + model2->setMenuObjectPath("/com/canonical/LP1328646"); |
2618 | + |
2619 | + QVERIFY(model1->model() != model2->model()); |
2620 | + QCOMPARE(model1->model()->menuObjectPath(), QByteArray("/com/canonical/test1")); |
2621 | + QCOMPARE(model2->model()->menuObjectPath(), QByteArray("/com/canonical/LP1328646")); |
2622 | + } |
2623 | + |
2624 | +}; |
2625 | + |
2626 | +QTEST_GUILESS_MAIN(SharedUnityMenuModelTest) |
2627 | +#include "sharedunitymenumodeltest.moc" |
2628 | |
2629 | === modified file 'tests/qmltests/CMakeLists.txt' |
2630 | --- tests/qmltests/CMakeLists.txt 2014-10-01 13:22:00 +0000 |
2631 | +++ tests/qmltests/CMakeLists.txt 2014-10-14 11:43:16 +0000 |
2632 | @@ -19,9 +19,9 @@ |
2633 | set(qmltest_DEFAULT_NO_ADD_TEST TRUE) |
2634 | set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C") |
2635 | |
2636 | -add_qml_test(. Shell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single") |
2637 | -add_qml_test(. ShellWithPin ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single-pin") |
2638 | -add_qml_test(. TabletShell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full") |
2639 | +add_qml_test(. Shell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2640 | +add_qml_test(. ShellWithPin ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single-pin:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2641 | +add_qml_test(. TabletShell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2642 | add_qml_test(Components Background) |
2643 | add_qml_test(Components Carousel) |
2644 | add_qml_test(Components DraggingArea) |
2645 | @@ -72,14 +72,13 @@ |
2646 | add_qml_test(Notifications Notifications) |
2647 | add_qml_test(Notifications VisualSnapDecisionsQueue) |
2648 | add_qml_test(Panel ActiveCallHint) |
2649 | -add_qml_test(Panel IndicatorRow) |
2650 | -add_qml_test(Panel Indicators) |
2651 | -add_qml_test(Panel MenuContent) |
2652 | -add_qml_test(Panel Panel) |
2653 | +add_qml_test(Panel IndicatorRow ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2654 | +add_qml_test(Panel Indicators ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2655 | +add_qml_test(Panel MenuContent ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2656 | +add_qml_test(Panel Panel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2657 | add_qml_test(Panel SearchIndicator) |
2658 | add_qml_test(Panel/Indicators DefaultIndicatorWidget ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2659 | add_qml_test(Panel/Indicators DefaultIndicatorPage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2660 | -add_qml_test(Panel/Indicators CachedUnityMenuModel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2661 | # These MenuItemFactory tests need the test/mocks/ to come before plugins/ |
2662 | add_qml_test(Panel/Indicators MenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS}) |
2663 | add_qml_test(Panel/Indicators MessageMenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS}) |
2664 | |
2665 | === modified file 'tests/qmltests/Greeter/tst_Clock.qml' |
2666 | --- tests/qmltests/Greeter/tst_Clock.qml 2014-05-01 14:25:18 +0000 |
2667 | +++ tests/qmltests/Greeter/tst_Clock.qml 2014-10-14 11:43:16 +0000 |
2668 | @@ -19,7 +19,7 @@ |
2669 | import ".." |
2670 | import "../../../qml/Greeter" |
2671 | import Ubuntu.Components 0.1 |
2672 | -import QMenuModel 0.1 |
2673 | +import Unity.Indicators 0.1 as Indicators |
2674 | import Unity.Test 0.1 as UT |
2675 | |
2676 | Rectangle { |
2677 | @@ -36,56 +36,73 @@ |
2678 | } |
2679 | } |
2680 | |
2681 | - UnityMenuModel { |
2682 | - id: menuModel |
2683 | - modelData: [{ |
2684 | - "rowData": { |
2685 | - "actionState": { "label": Qt.formatTime(new Date("October 13, 1975 11:13:00")) } |
2686 | - } |
2687 | - }] |
2688 | + function updateDatetimeModelTime(label) { |
2689 | + Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicator.datetime", |
2690 | + "/com/canonical/indicator/datetime/phone", |
2691 | + "/com/canonical/indicator/datetime", |
2692 | + [{ |
2693 | + "rowData": { |
2694 | + "actionState": { "label": label } |
2695 | + } |
2696 | + }]); |
2697 | } |
2698 | |
2699 | UT.UnityTestCase { |
2700 | name: "Clock" |
2701 | + when: windowShown |
2702 | |
2703 | function init() { |
2704 | - var cachedModel = findChild(clock, "timeModel"); |
2705 | - verify(cachedModel !== undefined); |
2706 | - cachedModel.model = menuModel; |
2707 | - } |
2708 | - |
2709 | - function test_customDate() { |
2710 | - var dateObj = new Date("October 13, 1975 11:13:00") |
2711 | - var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate) |
2712 | - var timeString = Qt.formatTime(dateObj) |
2713 | - |
2714 | - clock.currentDate = dateObj |
2715 | - var dateLabel = findChild(clock, "dateLabel") |
2716 | - compare(dateLabel.text, dateString, "Not the expected date") |
2717 | - var timeLabel = findChild(clock, "timeLabel") |
2718 | - compare(timeLabel.text, timeString, "Not the expected time") |
2719 | - } |
2720 | - |
2721 | - function test_dateUpdate() { |
2722 | - var dateObj = new Date("October 13, 1975 11:13:00") |
2723 | - var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate) |
2724 | - var timeString = Qt.formatTime(dateObj) |
2725 | - |
2726 | + updateDatetimeModelTime(Qt.formatTime(new Date("October 13, 1975 12:14:00"))); |
2727 | + clock.visible = true; |
2728 | + } |
2729 | + |
2730 | + // Test that the date portion of the clock updates with custom value. |
2731 | + // Time portion is controlled by indicators |
2732 | + function test_updateDate() { |
2733 | + var dateLabel = findChild(clock, "dateLabel"); |
2734 | + var timeLabel = findChild(clock, "timeLabel"); |
2735 | + |
2736 | + var timeString = Qt.formatTime(new Date("October 13, 1975 12:14:00")); |
2737 | + |
2738 | + // initial date. |
2739 | + var dateObj = new Date("October 13, 1975 11:13:00"); |
2740 | + var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate); |
2741 | + clock.currentDate = dateObj; |
2742 | + |
2743 | + compare(dateLabel.text, dateString, "Not the expected date"); |
2744 | + compare(timeLabel.text, timeString, "Time should come from indicators"); |
2745 | + |
2746 | + // update date. |
2747 | + var dateObj2 = new Date("October 14, 1976 13:15:00"); |
2748 | + var dateString2 = Qt.formatDate(dateObj2, Qt.DefaultLocaleLongDate); |
2749 | + clock.currentDate = dateObj2; |
2750 | + |
2751 | + compare(dateLabel.text, dateString2, "Not the expected date"); |
2752 | + compare(timeLabel.text,timeString, "Time should come from indicators"); |
2753 | + } |
2754 | + |
2755 | + // Test that the date portion of the clock updates with custom value. |
2756 | + // Time portion is controlled by indicators |
2757 | + function test_updateTime() { |
2758 | + var timeLabel = findChild(clock, "timeLabel"); |
2759 | + |
2760 | + var timeString1 = Qt.formatTime(new Date("October 13, 1975 11:15:00")); |
2761 | + var timeString2 = Qt.formatTime(new Date("October 14, 1976 12:16:00")); |
2762 | + |
2763 | + updateDatetimeModelTime(timeString1); |
2764 | + compare(timeLabel.text, timeString1, "Time should come from indicators"); |
2765 | + |
2766 | + updateDatetimeModelTime(timeString2); |
2767 | + compare(timeLabel.text, timeString2, "Time should come from indicators"); |
2768 | + } |
2769 | + |
2770 | + function test_indicatorDisconnect() { |
2771 | clock.visible = false |
2772 | var timeModel = findInvisibleChild(clock, "timeModel") |
2773 | - |
2774 | compare(timeModel.menuObjectPath, "", "Clock shouldn't be connected to Indicators when not visible.") |
2775 | |
2776 | - clock.currentDate = dateObj |
2777 | - |
2778 | - var dateLabel = findChild(clock, "dateLabel") |
2779 | - compare(dateLabel.text, dateString, "Not the expected date") |
2780 | - var timeLabel = findChild(clock, "timeLabel") |
2781 | - compare(timeLabel.text, timeString, "Not the expected time") |
2782 | - |
2783 | clock.visible = true |
2784 | - |
2785 | - verify(timeModel.menuObjectPath != "", "Should be connected to Indicators.") |
2786 | + verify(timeModel.menuObjectPath !== "", "Should be connected to Indicators.") |
2787 | } |
2788 | } |
2789 | } |
2790 | |
2791 | === removed file 'tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml' |
2792 | --- tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml 2014-08-20 09:16:28 +0000 |
2793 | +++ tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml 1970-01-01 00:00:00 +0000 |
2794 | @@ -1,137 +0,0 @@ |
2795 | -/* |
2796 | - * Copyright 2014 Canonical Ltd. |
2797 | - * |
2798 | - * This program is free software; you can redistribute it and/or modify |
2799 | - * it under the terms of the GNU General Public License as published by |
2800 | - * the Free Software Foundation; version 3. |
2801 | - * |
2802 | - * This program is distributed in the hope that it will be useful, |
2803 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2804 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2805 | - * GNU General Public License for more details. |
2806 | - * |
2807 | - * You should have received a copy of the GNU General Public License |
2808 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2809 | - */ |
2810 | - |
2811 | -import QtQuick 2.0 |
2812 | -import QtTest 1.0 |
2813 | -import Unity.Test 0.1 as UT |
2814 | -import QMenuModel 0.1 |
2815 | -import Unity.Indicators 0.1 as Indicators |
2816 | -import "../../../../qml/Panel/Indicators" |
2817 | - |
2818 | -Item { |
2819 | - id: root |
2820 | - width: units.gu(40) |
2821 | - height: units.gu(70) |
2822 | - |
2823 | - Component { |
2824 | - id: model |
2825 | - CachedUnityMenuModel {} |
2826 | - } |
2827 | - |
2828 | - UT.UnityTestCase { |
2829 | - name: "CachedUnityMenuModel" |
2830 | - when: windowShown |
2831 | - |
2832 | - function cleanup() { |
2833 | - doGC(); |
2834 | - } |
2835 | - |
2836 | - function doGC() { |
2837 | - // need to put some wait cycles here to get gc going properly. |
2838 | - wait(10); |
2839 | - gc(); |
2840 | - wait(10); |
2841 | - } |
2842 | - |
2843 | - function test_createDifferent() { |
2844 | - var cachedObject = model.createObject(null, |
2845 | - { |
2846 | - "busName": "com.canonical.test1", |
2847 | - "menuObjectPath": "/com/canonical/test1", |
2848 | - "actionsObjectPath": "/com/canonical/test1" |
2849 | - }); |
2850 | - |
2851 | - var cachedObject2 = model.createObject(null, |
2852 | - { |
2853 | - "busName": "com.canonical.test2", |
2854 | - "menuObjectPath": "/com/canonical/test2", |
2855 | - "actionsObjectPath": "/com/canonical/test2" |
2856 | - }); |
2857 | - |
2858 | - verify(cachedObject.model !== cachedObject2.model); |
2859 | - } |
2860 | - |
2861 | - function test_createSame() { |
2862 | - var cachedObject = model.createObject(null, |
2863 | - { |
2864 | - "busName": "com.canonical.test3", |
2865 | - "menuObjectPath": "/com/canonical/test3", |
2866 | - "actionsObjectPath": "/com/canonical/test3" |
2867 | - }); |
2868 | - |
2869 | - var cachedObject2 = model.createObject(null, |
2870 | - { |
2871 | - "busName": "com.canonical.test3", |
2872 | - "menuObjectPath": "/com/canonical/test3", |
2873 | - "actionsObjectPath": "/com/canonical/test3" |
2874 | - }); |
2875 | - |
2876 | - verify(cachedObject.model === cachedObject2.model); |
2877 | - } |
2878 | - |
2879 | - // Tests that changing cached model data does not change the model path of others |
2880 | - function test_lp1328646() { |
2881 | - var cachedObject = model.createObject(null, |
2882 | - { |
2883 | - "busName": "com.canonical.test4", |
2884 | - "menuObjectPath": "/com/canonical/test4", |
2885 | - "actionsObjectPath": "/com/canonical/test4" |
2886 | - }); |
2887 | - |
2888 | - var cachedObject2 = model.createObject(null, |
2889 | - { |
2890 | - "busName": "com.canonical.test4", |
2891 | - "menuObjectPath": "/com/canonical/test4", |
2892 | - "actionsObjectPath": "/com/canonical/test4" |
2893 | - }); |
2894 | - |
2895 | - cachedObject.menuObjectPath = "/com/canonical/test5"; |
2896 | - compare(cachedObject.model.menuObjectPath, "/com/canonical/test5"); |
2897 | - compare(cachedObject2.model.menuObjectPath, "/com/canonical/test4"); |
2898 | - |
2899 | - verify(cachedObject.model !== cachedObject2.model); |
2900 | - } |
2901 | - |
2902 | - function createAndDestroy(test) { |
2903 | - var cachedObject = model.createObject(null, |
2904 | - { |
2905 | - "busName": "com.canonical."+test, |
2906 | - "menuObjectPath": "/com/canonical/"+test, |
2907 | - "actionsObjectPath": "/com/canonical/"+test |
2908 | - }); |
2909 | - var cachedObject2 = model.createObject(null, |
2910 | - { |
2911 | - "busName": "com.canonical."+test, |
2912 | - "menuObjectPath": "/com/canonical/"+test, |
2913 | - "actionsObjectPath": "/com/canonical/"+test |
2914 | - }); |
2915 | - cachedObject.destroy(); |
2916 | - return cachedObject2; |
2917 | - } |
2918 | - |
2919 | - function test_destroyAllDeletesModel() { |
2920 | - createAndDestroy("test6"); |
2921 | - doGC(); |
2922 | - compare(Indicators.UnityMenuModelCache.contains("/com/canonical/test6"), false); |
2923 | - } |
2924 | - |
2925 | - function test_destroyPartialKeepsModel() { |
2926 | - var model = createAndDestroy("test7"); |
2927 | - doGC(); |
2928 | - compare(Indicators.UnityMenuModelCache.contains("/com/canonical/test7"), true); |
2929 | - } |
2930 | - } |
2931 | -} |
2932 | |
2933 | === modified file 'tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml' |
2934 | --- tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml 2014-09-29 10:24:58 +0000 |
2935 | +++ tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml 2014-10-14 11:43:16 +0000 |
2936 | @@ -17,7 +17,7 @@ |
2937 | import QtQuick 2.0 |
2938 | import QtTest 1.0 |
2939 | import Unity.Test 0.1 as UT |
2940 | -import QMenuModel 0.1 |
2941 | +import Unity.Indicators 0.1 as Indicators |
2942 | import "../../../../qml/Panel/Indicators" |
2943 | |
2944 | Item { |
2945 | @@ -25,18 +25,14 @@ |
2946 | width: units.gu(40) |
2947 | height: units.gu(70) |
2948 | |
2949 | - DefaultIndicatorPage { |
2950 | + DefaultIndicatorPage { |
2951 | id: page |
2952 | - |
2953 | anchors.fill: parent |
2954 | |
2955 | - menuModel: UnityMenuModel {} |
2956 | - busName: "test" |
2957 | - actionsObjectPath: "test" |
2958 | - menuObjectPath: "test" |
2959 | - |
2960 | identifier: "test-indicator" |
2961 | - rootMenuType: "com.canonical.indicator.root" |
2962 | + busName: "com.caninical.indicator.test" |
2963 | + actionsObjectPath: "/com/canonical/indicator/test" |
2964 | + menuObjectPath: "/com/canonical/indicator/test" |
2965 | } |
2966 | |
2967 | property var fullMenuData: [{ |
2968 | @@ -113,29 +109,30 @@ |
2969 | "submenu": [] |
2970 | }]; // end row 1 |
2971 | |
2972 | + function initializeMenuData(data) { |
2973 | + Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicator.test", |
2974 | + "/com/canonical/indicator/test", |
2975 | + "/com/canonical/indicator/test", |
2976 | + data); |
2977 | + } |
2978 | + |
2979 | UT.UnityTestCase { |
2980 | name: "DefaultIndicatorPage" |
2981 | |
2982 | function init() { |
2983 | - var mainMenu = findChild(page, "mainMenu"); |
2984 | - page.menuModel.modelData = []; |
2985 | - verify(mainMenu.model !== null); |
2986 | + initializeMenuData([]); |
2987 | } |
2988 | |
2989 | function test_reloadData() { |
2990 | var mainMenu = findChild(page, "mainMenu"); |
2991 | |
2992 | - page.menuModel.modelData = []; |
2993 | - tryCompare(mainMenu, "count", 0); |
2994 | - |
2995 | - page.menuModel.modelData = fullMenuData; |
2996 | - tryCompare(mainMenu, "count", 3); |
2997 | - |
2998 | - page.menuModel.modelData = []; |
2999 | - tryCompare(mainMenu, "count", 0); |
3000 | - |
3001 | - page.menuModel.modelData = fullMenuData; |
3002 | - tryCompare(mainMenu, "count", 3); |
3003 | + tryCompare(mainMenu, "count", 0); |
3004 | + |
3005 | + initializeMenuData(fullMenuData); |
3006 | + tryCompare(mainMenu, "count", 3); |
3007 | + |
3008 | + initializeMenuData([]); |
3009 | + tryCompare(mainMenu, "count", 0); |
3010 | } |
3011 | |
3012 | function test_traverse_rootMenuType_data() { |
3013 | @@ -147,7 +144,7 @@ |
3014 | |
3015 | function test_traverse_rootMenuType(data) { |
3016 | page.rootMenuType = data.rootMenuType; |
3017 | - page.menuModel.modelData = fullMenuData; |
3018 | + initializeMenuData(fullMenuData); |
3019 | |
3020 | var mainMenu = findChild(page, "mainMenu"); |
3021 | tryCompare(mainMenu, "count", data.expectedCount); |
3022 | |
3023 | === modified file 'tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml' |
3024 | --- tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml 2014-07-03 13:46:51 +0000 |
3025 | +++ tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml 2014-10-14 11:43:16 +0000 |
3026 | @@ -33,7 +33,6 @@ |
3027 | top: parent.top |
3028 | } |
3029 | |
3030 | - menuModel: UnityMenuModel {} |
3031 | busName: "test" |
3032 | actionsObjectPath: "test" |
3033 | deviceMenuObjectPath: "test" |
3034 | @@ -48,13 +47,6 @@ |
3035 | name: "DefaultIndicatorWidget" |
3036 | when: windowShown |
3037 | |
3038 | - function init() { |
3039 | - widget.rootActionState.icons = []; |
3040 | - widget.rootActionState.leftLabel = ""; |
3041 | - widget.rootActionState.rightLabel = ""; |
3042 | - waitForRendering(widget) |
3043 | - } |
3044 | - |
3045 | // FIXME: add tests |
3046 | } |
3047 | } |
3048 | |
3049 | === modified file 'tests/qmltests/Panel/tst_IndicatorItem.qml' |
3050 | --- tests/qmltests/Panel/tst_IndicatorItem.qml 2014-01-07 14:29:23 +0000 |
3051 | +++ tests/qmltests/Panel/tst_IndicatorItem.qml 2014-10-14 11:43:16 +0000 |
3052 | @@ -43,7 +43,7 @@ |
3053 | |
3054 | function test_empty() { |
3055 | compare(indicatorItem.indicatorVisible, false, "IndicatorItem should not be visible."); |
3056 | - indicatorItem.widgetSource = "qrc:/tests/indciators/qml/fake_menu_widget1.qml"; |
3057 | + indicatorItem.widgetSource = "../../../qml/Panel/Indicators/DefaultIndicatorWidget.qml"; |
3058 | tryCompare(indicatorItem, "indicatorVisible", true); |
3059 | } |
3060 | } |
3061 | |
3062 | === modified file 'tests/qmltests/Panel/tst_IndicatorRow.qml' |
3063 | --- tests/qmltests/Panel/tst_IndicatorRow.qml 2014-03-03 11:55:00 +0000 |
3064 | +++ tests/qmltests/Panel/tst_IndicatorRow.qml 2014-10-14 11:43:16 +0000 |
3065 | @@ -30,15 +30,6 @@ |
3066 | width: units.gu(40) |
3067 | height: units.gu(60) |
3068 | |
3069 | - function init_test() |
3070 | - { |
3071 | - indicatorModel.load("test1"); |
3072 | - |
3073 | - indicatorRow.state = "initial"; |
3074 | - indicatorRow.setCurrentItemIndex(-1); |
3075 | - indicatorRow.unitProgress = 0.0; |
3076 | - } |
3077 | - |
3078 | PanelBackground { |
3079 | anchors.fill: indicatorRow |
3080 | } |
3081 | @@ -63,20 +54,33 @@ |
3082 | name: "IndicatorRow" |
3083 | when: windowShown |
3084 | |
3085 | + function init() { |
3086 | + indicatorModel.load("test1"); |
3087 | + |
3088 | + indicatorRow.state = "initial"; |
3089 | + indicatorRow.setCurrentItemIndex(-1); |
3090 | + indicatorRow.unitProgress = 0.0; |
3091 | + } |
3092 | + |
3093 | function get_indicator_item(index) { |
3094 | return findChild(indicatorRow.row, "item" + index); |
3095 | } |
3096 | |
3097 | function test_set_current_item() { |
3098 | - init_test(); |
3099 | indicatorRow.setCurrentItemIndex(0); |
3100 | - compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake1", "Incorrect item at position 0"); |
3101 | + compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), |
3102 | + "indicator-fake1", |
3103 | + "Incorrect item at position 0"); |
3104 | |
3105 | indicatorRow.setCurrentItemIndex(1); |
3106 | - compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake2", "Incorrect item at position 1"); |
3107 | + compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), |
3108 | + "indicator-fake2", |
3109 | + "Incorrect item at position 1"); |
3110 | |
3111 | indicatorRow.setCurrentItemIndex(2); |
3112 | - compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake3", "Incorrect item at position 2"); |
3113 | + compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), |
3114 | + "indicator-fake3", |
3115 | + "Incorrect item at position 2"); |
3116 | } |
3117 | |
3118 | function test_highlight_data() { |
3119 | @@ -93,8 +97,6 @@ |
3120 | } |
3121 | |
3122 | function test_highlight(data) { |
3123 | - init_test(); |
3124 | - |
3125 | indicatorRow.unitProgress = data.progress; |
3126 | indicatorRow.setCurrentItemIndex(data.index); |
3127 | |
3128 | @@ -119,8 +121,6 @@ |
3129 | } |
3130 | |
3131 | function test_opacity(data) { |
3132 | - init_test(); |
3133 | - |
3134 | indicatorRow.unitProgress = data.progress; |
3135 | indicatorRow.setCurrentItemIndex(data.index); |
3136 | |
3137 | @@ -145,8 +145,6 @@ |
3138 | } |
3139 | |
3140 | function test_dimmed(data) { |
3141 | - init_test(); |
3142 | - |
3143 | indicatorRow.unitProgress = data.progress; |
3144 | indicatorRow.setCurrentItemIndex(data.index); |
3145 | |
3146 | |
3147 | === modified file 'tests/qmltests/Panel/tst_Indicators.qml' |
3148 | --- tests/qmltests/Panel/tst_Indicators.qml 2014-07-30 16:01:09 +0000 |
3149 | +++ tests/qmltests/Panel/tst_Indicators.qml 2014-10-14 11:43:16 +0000 |
3150 | @@ -158,6 +158,7 @@ |
3151 | function init_invisible_indicator(identifier) { |
3152 | tryCompareFunction(function() { return findChild(indicators, identifier+"-delegate") !== undefined }, true); |
3153 | var item = findChild(indicators, identifier+"-delegate"); |
3154 | + verify(item !== null); |
3155 | |
3156 | item.enabled = false; |
3157 | } |
3158 | |
3159 | === modified file 'tests/qmltests/Panel/tst_MenuContent.qml' |
3160 | --- tests/qmltests/Panel/tst_MenuContent.qml 2014-09-09 15:10:52 +0000 |
3161 | +++ tests/qmltests/Panel/tst_MenuContent.qml 2014-10-14 11:43:16 +0000 |
3162 | @@ -26,14 +26,6 @@ |
3163 | width: units.gu(40) |
3164 | height: units.gu(70) |
3165 | |
3166 | - property var indicator_status: { |
3167 | - 'indicator-fake1-page': { 'started': false, 'reset': 0 }, |
3168 | - 'indicator-fake2-page': { 'started': false, 'reset': 0 }, |
3169 | - 'indicator-fake3-page': { 'started': false, 'reset': 0 }, |
3170 | - 'indicator-fake4-page': { 'started': false, 'reset': 0 }, |
3171 | - 'indicator-fake5-page': { 'started': false, 'reset': 0 } |
3172 | - } |
3173 | - |
3174 | // Dummy objects |
3175 | Item { id: greeter } |
3176 | Item { id: handle } |
3177 | |
3178 | === modified file 'tests/qmltests/tst_Shell.qml' |
3179 | --- tests/qmltests/tst_Shell.qml 2014-10-06 16:39:10 +0000 |
3180 | +++ tests/qmltests/tst_Shell.qml 2014-10-14 11:43:16 +0000 |
3181 | @@ -25,14 +25,17 @@ |
3182 | import Ubuntu.Telephony 0.1 as Telephony |
3183 | import Unity.Application 0.1 |
3184 | import Unity.Connectivity 0.1 |
3185 | +import Unity.Notifications 1.0 |
3186 | import Unity.Test 0.1 as UT |
3187 | import Powerd 0.1 |
3188 | |
3189 | import "../../qml" |
3190 | |
3191 | -Row { |
3192 | +Item { |
3193 | id: root |
3194 | - spacing: 0 |
3195 | + |
3196 | + width: units.gu(60) |
3197 | + height: units.gu(71) |
3198 | |
3199 | QtObject { |
3200 | id: applicationArguments |
3201 | @@ -50,47 +53,42 @@ |
3202 | } |
3203 | } |
3204 | |
3205 | - Loader { |
3206 | - id: shellLoader |
3207 | - |
3208 | - // Copied from Shell.qml |
3209 | - property bool tablet: false |
3210 | - width: tablet ? units.gu(160) |
3211 | - : applicationArguments.hasGeometry() ? applicationArguments.width() |
3212 | - : units.gu(40) |
3213 | - height: tablet ? units.gu(100) |
3214 | - : applicationArguments.hasGeometry() ? applicationArguments.height() |
3215 | - : units.gu(71) |
3216 | - |
3217 | - property bool itemDestroyed: false |
3218 | - sourceComponent: Component { |
3219 | - Shell { |
3220 | - Component.onDestruction: { |
3221 | - shellLoader.itemDestroyed = true; |
3222 | + Row { |
3223 | + anchors.fill: parent |
3224 | + |
3225 | + Loader { |
3226 | + id: shellLoader |
3227 | + |
3228 | + property bool itemDestroyed: false |
3229 | + sourceComponent: Component { |
3230 | + Shell { |
3231 | + Component.onDestruction: { |
3232 | + shellLoader.itemDestroyed = true; |
3233 | + } |
3234 | } |
3235 | } |
3236 | } |
3237 | - } |
3238 | - |
3239 | - Rectangle { |
3240 | - color: "white" |
3241 | - width: units.gu(30) |
3242 | - height: shellLoader.height |
3243 | - |
3244 | - Column { |
3245 | - anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) } |
3246 | - spacing: units.gu(1) |
3247 | - Row { |
3248 | - anchors { left: parent.left; right: parent.right } |
3249 | - Button { |
3250 | - text: "Show Greeter" |
3251 | - onClicked: { |
3252 | - if (shellLoader.status !== Loader.Ready) |
3253 | - return; |
3254 | - |
3255 | - var greeter = testCase.findChild(shellLoader.item, "greeter"); |
3256 | - if (!greeter.shown) { |
3257 | - greeter.show(); |
3258 | + |
3259 | + Rectangle { |
3260 | + color: "white" |
3261 | + width: units.gu(30) |
3262 | + height: shellLoader.height |
3263 | + |
3264 | + Column { |
3265 | + anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) } |
3266 | + spacing: units.gu(1) |
3267 | + Row { |
3268 | + anchors { left: parent.left; right: parent.right } |
3269 | + Button { |
3270 | + text: "Show Greeter" |
3271 | + onClicked: { |
3272 | + if (shellLoader.status !== Loader.Ready) |
3273 | + return; |
3274 | + |
3275 | + var greeter = testCase.findChild(shellLoader.item, "greeter"); |
3276 | + if (!greeter.shown) { |
3277 | + greeter.show(); |
3278 | + } |
3279 | } |
3280 | } |
3281 | } |
3282 | @@ -98,6 +96,33 @@ |
3283 | } |
3284 | } |
3285 | |
3286 | + Component { |
3287 | + id: mockNotification |
3288 | + |
3289 | + QtObject { |
3290 | + function invokeAction(actionId) { |
3291 | + mockNotificationsModel.actionInvoked(actionId) |
3292 | + } |
3293 | + } |
3294 | + } |
3295 | + |
3296 | + ListModel { |
3297 | + id: mockNotificationsModel |
3298 | + |
3299 | + signal actionInvoked(string actionId) |
3300 | + |
3301 | + function getRaw(id) { |
3302 | + return mockNotification.createObject(mockNotificationsModel) |
3303 | + } |
3304 | + |
3305 | + onActionInvoked: { |
3306 | + if(actionId == "ok_id") { |
3307 | + mockNotificationsModel.clear() |
3308 | + } |
3309 | + } |
3310 | + } |
3311 | + |
3312 | + |
3313 | SignalSpy { |
3314 | id: sessionSpy |
3315 | signalName: "sessionStarted" |
3316 | @@ -114,6 +139,12 @@ |
3317 | signalName: "unlockingAllModems" |
3318 | } |
3319 | |
3320 | + SignalSpy { |
3321 | + id: notificationActionSpy |
3322 | + target: mockNotificationsModel |
3323 | + signalName: "actionInvoked" |
3324 | + } |
3325 | + |
3326 | Telephony.CallEntry { |
3327 | id: phoneCall |
3328 | phoneNumber: "+447812221111" |
3329 | @@ -168,6 +199,63 @@ |
3330 | compare(ApplicationManager.count, 1) |
3331 | } |
3332 | |
3333 | + function test_snapDecisionDismissalReturnsFocus() { |
3334 | + var notifications = findChild(shell, "notificationList"); |
3335 | + var app = ApplicationManager.startApplication("camera-app"); |
3336 | + var stage = findChild(shell, "stage") |
3337 | + // Open an application and focus |
3338 | + waitUntilApplicationWindowIsFullyVisible(app); |
3339 | + ApplicationManager.focusApplication(app); |
3340 | + compare(app.session.surface.focus, true, "Focused application didn't have activeFocus"); |
3341 | + |
3342 | + notifications.model = mockNotificationsModel; |
3343 | + |
3344 | + // FIXME: Hack: SortFilterProxyModelQML doesn't work with QML ListModels which we use |
3345 | + // for mocking here (RoleType can't be found in the QML model). As we only need to show |
3346 | + // one SnapDecision lets just disable the filtering and make appear any notification as a |
3347 | + // SnapDecision. |
3348 | + var snapDecisionProxyModel = findInvisibleChild(shell, "snapDecisionProxyModel"); |
3349 | + snapDecisionProxyModel.filterRegExp = RegExp(""); |
3350 | + |
3351 | + // Pop-up a notification |
3352 | + addSnapDecisionNotification(); |
3353 | + waitForRendering(shell); |
3354 | + |
3355 | + // Make sure the notification really opened |
3356 | + var notification = findChild(notifications, "notification" + (mockNotificationsModel.count - 1)); |
3357 | + verify(notification !== undefined && notification != null, "notification wasn't found"); |
3358 | + |
3359 | + // Make sure activeFocus went away from the app window |
3360 | + compare(app.session.surface.focus, false, "Notification didn't take active focus"); |
3361 | + compare(stage.interactive, false, "the stage is interactive with a notification showing") |
3362 | + |
3363 | + // Clicking the button should dismiss the notification and return focus |
3364 | + var buttonAccept = findChild(notification, "notify_button0"); |
3365 | + mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2); |
3366 | + |
3367 | + // Make sure we're back to normal |
3368 | + compare(app.session.surface.focus, true, "App didn't take active focus after snap notification was dismissed"); |
3369 | + compare(stage.interactive, true, "Stages not interactive again after modal notification has closed"); |
3370 | + } |
3371 | + |
3372 | + function addSnapDecisionNotification() { |
3373 | + var n = { |
3374 | + type: Notification.SnapDecision, |
3375 | + hints: {"x-canonical-private-affirmative-tint": "true"}, |
3376 | + summary: "Tom Ato", |
3377 | + body: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.", |
3378 | + icon: "../graphics/avatars/funky.png", |
3379 | + secondaryIcon: "../graphics/applicationIcons/facebook.png", |
3380 | + actions: [{ id: "ok_id", label: "Ok"}, |
3381 | + { id: "cancel_id", label: "Cancel"}, |
3382 | + { id: "notreally_id", label: "Not really"}, |
3383 | + { id: "noway_id", label: "messages:No way"}, |
3384 | + { id: "nada_id", label: "messages:Nada"}] |
3385 | + } |
3386 | + |
3387 | + mockNotificationsModel.append(n) |
3388 | + } |
3389 | + |
3390 | function test_leftEdgeDrag_data() { |
3391 | return [ |
3392 | {tag: "without launcher", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true}, |
3393 | |
3394 | === modified file 'tests/qmltests/tst_ShellWithPin.qml' |
3395 | --- tests/qmltests/tst_ShellWithPin.qml 2014-10-01 13:22:00 +0000 |
3396 | +++ tests/qmltests/tst_ShellWithPin.qml 2014-10-14 11:43:16 +0000 |
3397 | @@ -56,6 +56,8 @@ |
3398 | property bool itemDestroyed: false |
3399 | sourceComponent: Component { |
3400 | Shell { |
3401 | + property string indicatorProfile: "phone" |
3402 | + |
3403 | Component.onDestruction: { |
3404 | shellLoader.itemDestroyed = true |
3405 | } |
3406 | |
3407 | === modified file 'tests/qmltests/tst_TabletShell.qml' |
3408 | --- tests/qmltests/tst_TabletShell.qml 2014-10-08 20:36:48 +0000 |
3409 | +++ tests/qmltests/tst_TabletShell.qml 2014-10-14 11:43:16 +0000 |
3410 | @@ -56,6 +56,8 @@ |
3411 | property bool itemDestroyed: false |
3412 | sourceComponent: Component { |
3413 | Shell { |
3414 | + property string indicatorProfile: "phone" |
3415 | + |
3416 | Component.onDestruction: { |
3417 | shellLoader.itemDestroyed = true |
3418 | } |