Merge lp:~nick-dedekind/unity8/lp1352977 into lp:unity8

Proposed by Nick Dedekind on 2014-08-07
Status: Superseded
Proposed branch: lp:~nick-dedekind/unity8/lp1352977
Merge into: lp:unity8
Prerequisite: lp:~unity-team/unity8/scopes-v4
Diff against target: 1922 lines (+481/-470)
29 files modified
debian/control (+3/-3)
qml/Dash/Dash.qml (+11/-9)
qml/Dash/DashContent.qml (+4/-3)
qml/Dash/DashDepartments.qml (+43/-50)
qml/Dash/DashDepartmentsList.qml (+14/-15)
qml/Dash/GenericScopeView.qml (+11/-4)
qml/ScopeTool.qml (+11/-1)
qml/Stages/AppSurfaceContainer.qml (+44/-0)
qml/Stages/SpreadDelegate.qml (+3/-1)
qml/Stages/SurfaceContainer.qml (+5/-22)
tests/mocks/Unity/Application/ApplicationDBusAdaptor.cpp (+11/-4)
tests/mocks/Unity/Application/ApplicationDBusAdaptor.h (+1/-1)
tests/mocks/Unity/Application/ApplicationInfo.cpp (+49/-0)
tests/mocks/Unity/Application/ApplicationInfo.h (+13/-0)
tests/mocks/Unity/Application/ApplicationManager.cpp (+3/-0)
tests/mocks/Unity/Application/ApplicationManager.h (+1/-0)
tests/mocks/Unity/Application/MirSurfaceItem.cpp (+2/-2)
tests/mocks/Unity/Application/MirSurfaceItem.h (+1/-0)
tests/mocks/Unity/CMakeLists.txt (+3/-3)
tests/mocks/Unity/Unity.qmltypes (+35/-87)
tests/mocks/Unity/fake_department.cpp (+44/-36)
tests/mocks/Unity/fake_department.h (+13/-13)
tests/mocks/Unity/fake_scope.cpp (+25/-73)
tests/mocks/Unity/fake_scope.h (+8/-16)
tests/mocks/Unity/fake_scopes.cpp (+2/-10)
tests/mocks/Unity/fake_scopes.h (+0/-1)
tests/mocks/Unity/fake_unity_plugin.cpp (+2/-2)
tests/qmltests/Dash/tst_Dash.qml (+9/-5)
tests/qmltests/Dash/tst_DashContent.qml (+110/-109)
To merge this branch: bzr merge lp:~nick-dedekind/unity8/lp1352977
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Pending
Unity Team 2014-08-07 Pending
Review via email: mp+229943@code.launchpad.net

This proposal has been superseded by a proposal from 2014-08-07.

Commit message

Added application prompt surfaces to allow prompting application which have not yet created a surface.

Description of the change

Added application prompt surfaces to allow prompting application which have not yet created a surface.

To post a comment you must log in.
lp:~nick-dedekind/unity8/lp1352977 updated on 2014-08-08
1134. By PS Jenkins bot on 2014-08-07

Resync trunk

1135. By Nick Dedekind on 2014-08-07

added prompt surfaces

1136. By Nick Dedekind on 2014-08-08

Fixed promptSurface over app splash

1137. By Nick Dedekind on 2014-08-08

better mock logging

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-08-07 14:25:38 +0000
3+++ debian/control 2014-08-07 14:25:38 +0000
4@@ -24,7 +24,7 @@
5 libpulse-dev,
6 libqmenumodel-dev (>= 0.2.8),
7 libqt5xmlpatterns5-dev,
8- libunity-api-dev (>= 7.88),
9+ libunity-api-dev (>= 7.87),
10 libusermetricsoutput1-dev,
11 libxcb1-dev,
12 pkg-config,
13@@ -83,7 +83,7 @@
14 qmenumodel-qml (>= 0.2.8),
15 qml-module-qtquick-xmllistmodel,
16 qtdeclarative5-gsettings1.0,
17- qtdeclarative5-qtmir-plugin (>= 0.4),
18+ qtdeclarative5-qtmir-plugin (>= 0.4.1),
19 qtdeclarative5-ubuntu-settings-components (>= 0.3),
20 qtdeclarative5-ubuntu-telephony0.1,
21 unity-launcher-impl-3,
22@@ -112,7 +112,7 @@
23 unity-application-impl-2,
24 unity-notifications-impl-3,
25 unity-plugin-scopes | unity-scopes-impl,
26- unity-scopes-impl-4,
27+ unity-scopes-impl-2,
28 unity8-fake-env | unity-application-impl,
29 ${misc:Depends},
30 Breaks: unity8 (<< 7.86),
31
32=== modified file 'qml/Dash/Dash.qml'
33--- qml/Dash/Dash.qml 2014-08-07 14:25:38 +0000
34+++ qml/Dash/Dash.qml 2014-07-29 11:35:10 +0000
35@@ -38,13 +38,7 @@
36 }
37
38 function setCurrentScope(scopeId, animate, reset) {
39- var scopeIndex = -1;
40- for (var i = 0; i < scopes.count; ++i) {
41- if (scopes.getScope(i).id == scopeId) {
42- scopeIndex = i;
43- break;
44- }
45- }
46+ var scopeIndex = filteredScopes.findFirst(Scopes.RoleId, scopeId)
47
48 if (scopeIndex == -1) {
49 console.warn("No match for scope with id: %1".arg(scopeId))
50@@ -69,8 +63,15 @@
51 }
52 }
53
54- Scopes {
55- id: scopes
56+ SortFilterProxyModel {
57+ id: filteredScopes
58+ model: Scopes {
59+ id: scopes
60+ }
61+ dynamicSortFilter: true
62+
63+ filterRole: Scopes.RoleVisible
64+ filterRegExp: RegExp("^true$")
65 }
66
67 DashContent {
68@@ -78,6 +79,7 @@
69 objectName: "dashContent"
70 width: parent.width
71 height: parent.height
72+ model: filteredScopes
73 scopes: scopes
74 visible: x != -width
75 onGotoScope: {
76
77=== modified file 'qml/Dash/DashContent.qml'
78--- qml/Dash/DashContent.qml 2014-08-07 14:25:38 +0000
79+++ qml/Dash/DashContent.qml 2014-07-24 23:31:44 +0000
80@@ -23,7 +23,8 @@
81 Item {
82 id: dashContent
83
84- property alias scopes: dashContentList.model
85+ property var model: null
86+ property var scopes: null
87 readonly property alias currentIndex: dashContentList.currentIndex
88
89 signal scopeLoaded(string scopeId)
90@@ -88,9 +89,10 @@
91 id: dashContentList
92 objectName: "dashContentList"
93
94- interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving && !currentItem.navigationShown
95+ interactive: dashContent.scopes.loaded && currentItem && !currentItem.moving
96
97 anchors.fill: parent
98+ model: dashContent.model
99 orientation: ListView.Horizontal
100 boundsBehavior: Flickable.DragAndOvershootBounds
101 flickDeceleration: units.gu(625)
102@@ -128,7 +130,6 @@
103 objectName: scope.id + " loader"
104
105 readonly property bool moving: item ? item.moving : false
106- readonly property bool navigationShown: item ? item.navigationShown : false
107 readonly property var categoryView: item ? item.categoryView : null
108 readonly property var theScope: scope
109
110
111=== renamed file 'qml/Dash/DashNavigation.qml' => 'qml/Dash/DashDepartments.qml'
112--- qml/Dash/DashNavigation.qml 2014-08-07 14:25:38 +0000
113+++ qml/Dash/DashDepartments.qml 2014-07-08 11:08:19 +0000
114@@ -15,17 +15,17 @@
115 */
116
117 import QtQuick 2.2
118-import Ubuntu.Components 1.1
119+import Ubuntu.Components 0.1
120
121 AbstractButton {
122 id: root
123- objectName: "dashNavigation"
124+ objectName: "dashDepartments"
125
126 property var scope: null
127
128 property bool showList: false
129
130- readonly property var currentNavigation: scope && scope.hasNavigation ? scope.getNavigation(scope.currentNavigationId) : null
131+ readonly property var currentDepartment: scope && scope.hasDepartments ? scope.getDepartment(scope.currentDepartmentId) : null
132
133 property alias windowWidth: blackRect.width
134 property alias windowHeight: blackRect.height
135@@ -34,21 +34,20 @@
136 // Are we drilling down the tree or up?
137 property bool isGoingBack: false
138
139- visible: root.currentNavigation != null
140+ visible: root.currentDepartment != null
141
142 height: visible ? units.gu(5) : 0
143
144 onClicked: {
145- navigationListView.updateMaxHeight();
146 root.showList = !root.showList;
147 }
148
149 Rectangle {
150 id: blackRect
151 color: "black"
152- opacity: navigationListView.currentItem && navigationListView.currentItem.visible ? 0.3 : 0
153+ opacity: departmentListView.currentItem && departmentListView.currentItem.visible ? 0.3 : 0
154 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
155- anchors.top: navigationListView.top
156+ anchors.top: departmentListView.top
157 anchors.right: parent.right
158 visible: opacity != 0
159 }
160@@ -79,7 +78,7 @@
161 anchors.fill: parent
162 anchors.margins: units.gu(2)
163 verticalAlignment: Text.AlignVCenter
164- text: root.currentNavigation ? root.currentNavigation.label : ""
165+ text: root.currentDepartment ? root.currentDepartment.label : ""
166 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
167 }
168
169@@ -93,18 +92,18 @@
170 color: root.scopeStyle ? root.scopeStyle.foreground : "grey"
171 }
172
173- // navigationListView is outside root
174+ // departmentListView is outside root
175 ListView {
176- id: navigationListView
177- objectName: "navigationListView"
178+ id: departmentListView
179+ objectName: "departmentListView"
180 orientation: ListView.Horizontal
181 interactive: false
182 clip: root.width != windowWidth
183 model: ListModel {
184- id: navigationModel
185+ id: departmentModel
186 // We have two roles
187- // navigationId: the navigation id of the navigation the list represents
188- // nullifyNavigation: overrides navigationId to be null
189+ // departmentId: the department id of the department the list represents
190+ // nullifyDepartment: overrides departmentId to be null
191 // This is used to "clear" the delegate when going "right" on the tree
192 }
193 anchors {
194@@ -112,12 +111,7 @@
195 right: parent.right
196 top: root.bottom
197 }
198- property int maxHeight: -1
199- Component.onCompleted: updateMaxHeight();
200- function updateMaxHeight()
201- {
202- maxHeight = (windowHeight - mapToItem(null, 0, 0).y) - units.gu(8);
203- }
204+ readonly property int maxHeight: (windowHeight - mapToItem(null, root.x, root.y).y) - units.gu(8)
205 property int prevHeight: maxHeight
206 height: currentItem ? currentItem.height : maxHeight
207 onHeightChanged: {
208@@ -126,84 +120,83 @@
209 }
210 }
211 highlightMoveDuration: UbuntuAnimation.FastDuration
212- delegate: DashNavigationList {
213- objectName: "navigation" + index
214+ delegate: DashDepartmentsList {
215+ objectName: "department" + index
216 visible: height != 0
217- width: navigationListView.width
218+ width: departmentListView.width
219 scopeStyle: root.scopeStyle
220 property real desiredHeight: {
221 if (root.showList) {
222- if (navigation && navigation.loaded && x == navigationListView.contentX)
223+ if (department && department.loaded && x == departmentListView.contentX)
224 {
225- navigationListView.updateMaxHeight();
226- return Math.min(implicitHeight, navigationListView.maxHeight);
227+ return Math.min(implicitHeight, departmentListView.maxHeight);
228 } else {
229- return navigationListView.prevHeight;
230+ return departmentListView.prevHeight;
231 }
232 } else {
233 return 0;
234 }
235 }
236 height: desiredHeight
237- navigation: (nullifyNavigation || !scope) ? null : scope.getNavigation(navigationId)
238- currentNavigation: root.currentNavigation
239- onEnterNavigation: {
240- scope.setNavigationState(newNavigationId, false);
241+ department: (nullifyDepartment || !scope) ? null : scope.getDepartment(departmentId)
242+ currentDepartment: root.currentDepartment
243+ onEnterDepartment: {
244+ scope.loadDepartment(newDepartmentId);
245 // We only need to add a new item to the model
246 // if we have children, otherwise just load it
247 if (hasChildren) {
248 isGoingBack = false;
249- navigationModel.append({"navigationId": newNavigationId, "nullifyNavigation": false});
250- navigationListView.currentIndex++;
251+ departmentModel.append({"departmentId": newDepartmentId, "nullifyDepartment": false});
252+ departmentListView.currentIndex++;
253 } else {
254 showList = false;
255 }
256 }
257 onGoBackToParentClicked: {
258- scope.setNavigationState(navigation.parentNavigationId, false);
259+ scope.loadDepartment(department.parentDepartmentId);
260 isGoingBack = true;
261- navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", false);
262- navigationListView.currentIndex--;
263+ departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", false);
264+ departmentListView.currentIndex--;
265 }
266- onAllNavigationClicked: {
267+ onAllDepartmentClicked: {
268 showList = false;
269- if (root.currentNavigation.parentNavigationId == navigation.navigationId) {
270+ if (root.currentDepartment.parentDepartmentId == department.departmentId) {
271 // For leaves we have to go to the parent too
272- scope.setNavigationState(root.currentNavigation.parentNavigationId, false);
273+ scope.loadDepartment(root.currentDepartment.parentDepartmentId);
274 }
275 }
276 }
277 onContentXChanged: {
278- if (contentX == width * navigationListView.currentIndex) {
279+ if (contentX == width * departmentListView.currentIndex) {
280 if (isGoingBack) {
281- navigationModel.remove(navigationListView.currentIndex + 1);
282+ departmentModel.remove(departmentListView.currentIndex + 1);
283 } else {
284- navigationModel.setProperty(navigationListView.currentIndex - 1, "nullifyNavigation", true);
285+ departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", true);
286 }
287 }
288 }
289 }
290
291 InverseMouseArea {
292- anchors.fill: navigationListView
293+ anchors.fill: departmentListView
294 enabled: root.showList
295 onClicked: root.showList = false
296 }
297
298 onScopeChanged: {
299- navigationModel.clear();
300- if (scope && scope.hasNavigation) {
301- navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
302+ departmentModel.clear();
303+ if (scope && scope.hasDepartments) {
304+ departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
305 }
306 }
307
308 Connections {
309 target: scope
310- onHasNavigationChanged: {
311- if (scope.hasNavigation) {
312- navigationModel.append({"navigationId": scope.currentNavigationId, "nullifyNavigation": false});
313+ onHasDepartmentsChanged: {
314+ if (scope.hasDepartments) {
315+ departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
316 } else {
317- navigationModel.clear();
318+ departmentModel.clear();
319 }
320 }
321 }
322
323=== renamed file 'qml/Dash/DashNavigationList.qml' => 'qml/Dash/DashDepartmentsList.qml'
324--- qml/Dash/DashNavigationList.qml 2014-08-07 14:25:38 +0000
325+++ qml/Dash/DashDepartmentsList.qml 2014-07-08 11:08:19 +0000
326@@ -15,16 +15,16 @@
327 */
328
329 import QtQuick 2.2
330-import Ubuntu.Components 1.1
331+import Ubuntu.Components 0.1
332
333 Item {
334 id: root
335- property var navigation: null
336- property var currentNavigation: null
337+ property var department: null
338+ property var currentDepartment: null
339 property var scopeStyle: null
340- signal enterNavigation(var newNavigationId, bool hasChildren)
341+ signal enterDepartment(var newDepartmentId, bool hasChildren)
342 signal goBackToParentClicked()
343- signal allNavigationClicked()
344+ signal allDepartmentClicked()
345
346 readonly property int itemHeight: units.gu(5)
347 readonly property color foregroundColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"
348@@ -38,7 +38,7 @@
349 ActivityIndicator {
350 id: loadingIndicator
351 anchors.centerIn: parent
352- running: !(navigation && navigation.loaded)
353+ running: !(department && department.loaded)
354 }
355 clip: true
356
357@@ -54,7 +54,6 @@
358
359 anchors.fill: parent
360
361- flickableDirection: Flickable.VerticalFlick
362 contentHeight: column.height
363 contentWidth: width
364
365@@ -69,7 +68,7 @@
366 id: backButton
367 objectName: "backButton"
368 width: parent.width
369- visible: navigation && !navigation.isRoot || false
370+ visible: department && !department.isRoot || false
371 height: itemHeight
372
373 onClicked: root.goBackToParentClicked();
374@@ -93,7 +92,7 @@
375 left: backImage.right
376 leftMargin: units.gu(0.5)
377 }
378- text: navigation ? navigation.parentLabel : ""
379+ text: department ? department.parentLabel : ""
380 color: root.foregroundColor
381 }
382
383@@ -115,7 +114,7 @@
384 id: allButton
385 objectName: "allButton"
386 width: parent.width
387- visible: navigation && (!navigation.isRoot || (root.currentNavigation && !root.currentNavigation.isRoot && root.currentNavigation.parentNavigationId == navigation.navigationId)) || false
388+ visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
389 height: itemHeight
390
391 Label {
392@@ -124,7 +123,7 @@
393 left: parent.left
394 leftMargin: units.gu(2)
395 }
396- text: navigation ? (navigation.allLabel != "" ? navigation.allLabel : navigation.label) : ""
397+ text: department ? (department.allLabel != "" ? department.allLabel : department.label) : ""
398 font.bold: true
399 color: root.foregroundColor
400 }
401@@ -142,18 +141,18 @@
402 height: units.dp(1)
403 }
404
405- onClicked: root.allNavigationClicked();
406+ onClicked: root.allDepartmentClicked();
407 }
408
409 Repeater {
410- model: navigation && navigation.loaded ? navigation : null
411+ model: department && department.loaded ? department : null
412 clip: true
413 delegate: AbstractButton {
414 objectName: root.objectName + "child" + index
415 height: root.itemHeight
416 width: root.width
417
418- onClicked: root.enterNavigation(navigationId, hasChildren)
419+ onClicked: root.enterDepartment(departmentId, hasChildren)
420
421 Label {
422 anchors {
423@@ -189,7 +188,7 @@
424 color: root.foregroundColor
425 opacity: 0.1
426 height: units.dp(1)
427- visible: index != navigation.count - 1
428+ visible: index != department.count - 1
429 }
430 }
431 }
432
433=== modified file 'qml/Dash/GenericScopeView.qml'
434--- qml/Dash/GenericScopeView.qml 2014-08-07 14:25:38 +0000
435+++ qml/Dash/GenericScopeView.qml 2014-07-29 11:35:10 +0000
436@@ -25,7 +25,6 @@
437 FocusScope {
438 id: scopeView
439
440- readonly property alias navigationShown: dashNavigation.showList
441 property var scope: null
442 property SortFilterProxyModel categories: categoryFilter
443 property bool isCurrent: false
444@@ -40,6 +39,16 @@
445
446 signal backClicked()
447
448+ onScopeChanged: {
449+ if (scope) {
450+ scope.activateApplication.connect(activateApp);
451+ }
452+ }
453+
454+ function activateApp(appId) {
455+ Qt.openUrlExternally(appId);
456+ }
457+
458 function positionAtBeginning() {
459 categoryView.positionAtBeginning()
460 }
461@@ -110,7 +119,6 @@
462 model: scopeView.categories
463 forceNoClip: previewListView.open
464 pixelAligned: true
465- interactive: !dashNavigation.showList
466
467 property string expandedCategoryId: ""
468
469@@ -382,8 +390,7 @@
470 searchInProgress: scopeView.scope ? scopeView.scope.searchInProgress : false
471 scopeStyle: scopeView.scopeStyle
472
473- bottomItem: DashNavigation {
474- id: dashNavigation
475+ bottomItem: DashDepartments {
476 scope: scopeView.scope
477 width: parent.width <= units.gu(60) ? parent.width : units.gu(40)
478 anchors.right: parent.right
479
480=== modified file 'qml/ScopeTool.qml'
481--- qml/ScopeTool.qml 2014-08-07 14:25:38 +0000
482+++ qml/ScopeTool.qml 2014-07-03 09:08:22 +0000
483@@ -45,6 +45,16 @@
484 signal searchClicked
485 }
486
487+ SortFilterProxyModel {
488+ id: filteredScopes
489+ model: Scopes {
490+ id: scopes
491+ }
492+ dynamicSortFilter: true
493+
494+ filterRole: Scopes.RoleVisible
495+ filterRegExp: RegExp("^true$")
496+ }
497
498 Rectangle {
499 anchors.fill: dashContent
500@@ -62,8 +72,8 @@
501 DashContent {
502 id: dashContent
503
504+ model: filteredScopes
505 property var scope: scopes.getScope(currentIndex)
506- scopes: Scopes { }
507
508 anchors {
509 top: parent.top
510
511=== added file 'qml/Stages/AppSurfaceContainer.qml'
512--- qml/Stages/AppSurfaceContainer.qml 1970-01-01 00:00:00 +0000
513+++ qml/Stages/AppSurfaceContainer.qml 2014-08-07 14:25:38 +0000
514@@ -0,0 +1,44 @@
515+/*
516+ * Copyright 2014 Canonical Ltd.
517+ *
518+ * This program is free software; you can redistribute it and/or modify
519+ * it under the terms of the GNU Lesser General Public License as published by
520+ * the Free Software Foundation; version 3.
521+ *
522+ * This program is distributed in the hope that it will be useful,
523+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
524+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
525+ * GNU Lesser General Public License for more details.
526+ *
527+ * You should have received a copy of the GNU Lesser General Public License
528+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
529+*/
530+
531+import QtQuick 2.0
532+import "Animations"
533+
534+SurfaceContainer {
535+ id: container
536+ property var promptSurfaces
537+
538+ Repeater {
539+ model: container.promptSurfaces
540+
541+ delegate: SurfaceContainer {
542+ anchors {
543+ fill: container
544+ topMargin: container.surface.anchors.topMargin
545+ rightMargin: container.surface.anchors.rightMargin
546+ bottomMargin: container.surface.anchors.bottomMargin
547+ leftMargin: container.surface.anchors.leftMargin
548+ }
549+
550+ z: 3 + index
551+ surface: modelData
552+
553+ Component.onCompleted: {
554+ animateIn();
555+ }
556+ }
557+ }
558+}
559
560=== modified file 'qml/Stages/SpreadDelegate.qml'
561--- qml/Stages/SpreadDelegate.qml 2014-07-29 11:35:10 +0000
562+++ qml/Stages/SpreadDelegate.qml 2014-08-07 14:25:38 +0000
563@@ -35,11 +35,13 @@
564 signal clicked()
565 signal closed()
566
567- SurfaceContainer {
568+ AppSurfaceContainer {
569 id: surfaceContainer
570 objectName: "surfaceContainer"
571 anchors.fill: parent
572 surface: model.surface
573+ promptSurfaces: model.application.promptSurfaces
574+
575 property bool appHasCreatedASurface: false
576
577 onSurfaceChanged: {
578
579=== modified file 'qml/Stages/SurfaceContainer.qml'
580--- qml/Stages/SurfaceContainer.qml 2014-07-23 12:23:10 +0000
581+++ qml/Stages/SurfaceContainer.qml 2014-08-07 14:25:38 +0000
582@@ -40,19 +40,12 @@
583 childSurfaces[i].removed();
584 }
585
586- //if we don't have children, nothing will tell us to animate out, so do it.
587- if (childSurfaces.length === 0) {
588- animateOut();
589- }
590- // tell our parent to animate out.
591- if (surface.parentSurface) {
592- surface.parentSurface.parent.animateOut();
593- }
594+ animateOut();
595 }
596 }
597
598 Repeater {
599- model: container.surface ? container.surface.childSurfaces : 0
600+ model: surface.childSurfaces
601
602 delegate: Loader {
603 z: 2
604@@ -68,14 +61,13 @@
605 source: Qt.resolvedUrl("SurfaceContainer.qml")
606 onLoaded: {
607 item.surface = modelData;
608- item.animateIn(swipeFromBottom);
609- container.animateIn(swipeUp);
610+ item.animateIn();
611 }
612 }
613 }
614
615- function animateIn(component) {
616- var animation = component.createObject(container, { "surface": container.surface });
617+ function animateIn() {
618+ var animation = swipeFromBottom.createObject(container, { "surface": container.surface });
619 animation.start();
620
621 var tmp = d.animations;
622@@ -104,20 +96,11 @@
623 id: swipeFromBottom
624 SwipeFromBottomAnimation {}
625 }
626- Component {
627- id: swipeUp
628- SwipeUpAnimation {}
629- }
630- Component {
631- id: darkenFade
632- DarkenAndFadeInAnimation {}
633- }
634
635 states: [
636 State {
637 name: "initial"
638 PropertyChanges { target: surface; anchors.fill: container }
639 }
640- // TODO: more animations!
641 ]
642 }
643
644=== modified file 'tests/mocks/Unity/Application/ApplicationDBusAdaptor.cpp'
645--- tests/mocks/Unity/Application/ApplicationDBusAdaptor.cpp 2014-07-25 05:39:21 +0000
646+++ tests/mocks/Unity/Application/ApplicationDBusAdaptor.cpp 2014-08-07 14:25:38 +0000
647@@ -43,10 +43,8 @@
648 return child ? child : surface;
649 }
650
651-quint32 ApplicationDBusAdaptor::addChildSurface(const QString &appId, const QString &surfaceImage)
652+quint32 ApplicationDBusAdaptor::addPromptSurface(const QString &appId, const QString &surfaceImage)
653 {
654- qDebug() << "ApplicationDBusAdaptor::addChildSurface - " << appId;
655-
656 ApplicationInfo* application = m_applicationManager->findApplication(appId);
657 if (!application) {
658 qDebug() << "ApplicationDBusAdaptor::addChildSurface - No application found for " << appId;
659@@ -58,7 +56,16 @@
660 MirSurfaceItem::Maximized,
661 QUrl(surfaceImage));
662 m_childItems[surfaceId] = surface;
663- surface->setParentSurface(topSurface(application->surface()));
664+
665+ if (application->promptSurfaceList().count() > 0) {
666+ surface->setParentSurface(topSurface(application->promptSurfaceList()[0]));
667+ qDebug() << "ApplicationDBusAdaptor::addChildSurface - " << appId;
668+ } else {
669+ application->addPromptSurface(surface);
670+ qDebug() << "ApplicationDBusAdaptor::addPromptSurface - " << appId;
671+ }
672+
673+
674 return surfaceId;
675 }
676
677
678=== modified file 'tests/mocks/Unity/Application/ApplicationDBusAdaptor.h'
679--- tests/mocks/Unity/Application/ApplicationDBusAdaptor.h 2014-07-19 12:06:55 +0000
680+++ tests/mocks/Unity/Application/ApplicationDBusAdaptor.h 2014-08-07 14:25:38 +0000
681@@ -31,7 +31,7 @@
682 ApplicationDBusAdaptor(ApplicationManager* applicationManager);
683
684 public Q_SLOTS:
685- quint32 addChildSurface(const QString& appId, const QString& surfaceImage);
686+ quint32 addPromptSurface(const QString& appId, const QString& surfaceImage);
687 void removeChildSurface(int surfaceId);
688
689 private:
690
691=== modified file 'tests/mocks/Unity/Application/ApplicationInfo.cpp'
692--- tests/mocks/Unity/Application/ApplicationInfo.cpp 2014-07-25 00:10:11 +0000
693+++ tests/mocks/Unity/Application/ApplicationInfo.cpp 2014-08-07 14:25:38 +0000
694@@ -98,3 +98,52 @@
695 Q_EMIT surfaceChanged(m_surface);
696 SurfaceManager::singleton()->registerSurface(m_surface);
697 }
698+
699+void ApplicationInfo::removeSurface(MirSurfaceItem* surface)
700+{
701+ if (m_surface == surface) {
702+ setSurface(nullptr);
703+ } else if (m_promptSurfaces.contains(surface)) {
704+ m_promptSurfaces.removeAll(surface);
705+ surface->setApplication(nullptr);
706+
707+ Q_EMIT promptSurfacesChanged();
708+ }
709+}
710+
711+void ApplicationInfo::addPromptSurface(MirSurfaceItem* surface)
712+{
713+ if (surface == m_surface || m_promptSurfaces.contains(surface)) return;
714+
715+ surface->setApplication(this);
716+ m_promptSurfaces.append(surface);
717+ Q_EMIT promptSurfacesChanged();
718+}
719+
720+QList<MirSurfaceItem*> ApplicationInfo::promptSurfaceList() const
721+{
722+ return m_promptSurfaces;
723+}
724+
725+QQmlListProperty<MirSurfaceItem> ApplicationInfo::promptSurfaces()
726+{
727+ return QQmlListProperty<MirSurfaceItem>(this,
728+ 0,
729+ ApplicationInfo::promptSurfaceCount,
730+ ApplicationInfo::promptSurfaceAt);
731+}
732+
733+int ApplicationInfo::promptSurfaceCount(QQmlListProperty<MirSurfaceItem> *prop)
734+{
735+ ApplicationInfo *p = qobject_cast<ApplicationInfo*>(prop->object);
736+ return p->m_promptSurfaces.count();
737+}
738+
739+MirSurfaceItem* ApplicationInfo::promptSurfaceAt(QQmlListProperty<MirSurfaceItem> *prop, int index)
740+{
741+ ApplicationInfo *p = qobject_cast<ApplicationInfo*>(prop->object);
742+
743+ if (index < 0 || index >= p->m_promptSurfaces.count())
744+ return nullptr;
745+ return p->m_promptSurfaces[index];
746+}
747
748=== modified file 'tests/mocks/Unity/Application/ApplicationInfo.h'
749--- tests/mocks/Unity/Application/ApplicationInfo.h 2014-07-25 00:10:11 +0000
750+++ tests/mocks/Unity/Application/ApplicationInfo.h 2014-08-07 14:25:38 +0000
751@@ -38,6 +38,7 @@
752 Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged)
753 Q_PROPERTY(Stage stage READ stage WRITE setStage NOTIFY stageChanged)
754 Q_PROPERTY(MirSurfaceItem* surface READ surface NOTIFY surfaceChanged)
755+ Q_PROPERTY(QQmlListProperty<MirSurfaceItem> promptSurfaces READ promptSurfaces NOTIFY promptSurfacesChanged DESIGNABLE false)
756
757 // Only exists in this fake implementation
758
759@@ -85,8 +86,15 @@
760 void setSurface(MirSurfaceItem* surface);
761 MirSurfaceItem* surface() const { return m_surface; }
762
763+ void removeSurface(MirSurfaceItem* surface);
764+
765+ void addPromptSurface(MirSurfaceItem* surface);
766+ QList<MirSurfaceItem*> promptSurfaceList() const;
767+ QQmlListProperty<MirSurfaceItem> promptSurfaces();
768+
769 Q_SIGNALS:
770 void surfaceChanged(MirSurfaceItem*);
771+ void promptSurfacesChanged();
772
773 private Q_SLOTS:
774 void onStateChanged(State state);
775@@ -94,10 +102,15 @@
776 void createSurface();
777
778 private:
779+ static int promptSurfaceCount(QQmlListProperty<MirSurfaceItem> *prop);
780+ static MirSurfaceItem* promptSurfaceAt(QQmlListProperty<MirSurfaceItem> *prop, int index);
781+
782 QQuickItem *m_parentItem;
783 MirSurfaceItem* m_surface;
784+ QList<MirSurfaceItem*> m_promptSurfaces;
785 };
786
787 Q_DECLARE_METATYPE(ApplicationInfo*)
788+Q_DECLARE_METATYPE(QQmlListProperty<MirSurfaceItem>)
789
790 #endif // APPLICATION_H
791
792=== modified file 'tests/mocks/Unity/Application/ApplicationManager.cpp'
793--- tests/mocks/Unity/Application/ApplicationManager.cpp 2014-07-29 11:41:39 +0000
794+++ tests/mocks/Unity/Application/ApplicationManager.cpp 2014-08-07 14:25:38 +0000
795@@ -51,6 +51,7 @@
796 {
797 m_roleNames.insert(RoleSurface, "surface");
798 m_roleNames.insert(RoleFullscreen, "fullscreen");
799+ m_roleNames.insert(RoleApplication, "application");
800
801 buildListOfAvailableApplications();
802
803@@ -92,6 +93,8 @@
804 return QVariant::fromValue(app->surface());
805 case RoleFullscreen:
806 return app->fullscreen();
807+ case RoleApplication:
808+ return QVariant::fromValue(app);
809 default:
810 return QVariant();
811 }
812
813=== modified file 'tests/mocks/Unity/Application/ApplicationManager.h'
814--- tests/mocks/Unity/Application/ApplicationManager.h 2014-07-25 00:10:11 +0000
815+++ tests/mocks/Unity/Application/ApplicationManager.h 2014-08-07 14:25:38 +0000
816@@ -53,6 +53,7 @@
817 enum MoreRoles {
818 RoleSurface = RoleScreenshot+1,
819 RoleFullscreen,
820+ RoleApplication,
821 };
822 enum Role {
823 Dash, Default, Indicators, Notifications, Greeter, Launcher, OnScreenKeyboard,
824
825=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.cpp'
826--- tests/mocks/Unity/Application/MirSurfaceItem.cpp 2014-07-25 05:39:21 +0000
827+++ tests/mocks/Unity/Application/MirSurfaceItem.cpp 2014-08-07 14:25:38 +0000
828@@ -54,7 +54,7 @@
829 m_parentSurface->removeChildSurface(this);
830
831 if (m_application)
832- m_application->setSurface(nullptr);
833+ m_application->removeSurface(this);
834 }
835
836 void MirSurfaceItem::paint(QPainter * painter)
837@@ -75,7 +75,7 @@
838 }
839
840 if (m_application) {
841- m_application->setSurface(nullptr);
842+ m_application->removeSurface(this);
843 }
844 if (!parent()) {
845 deleteLater();
846
847=== modified file 'tests/mocks/Unity/Application/MirSurfaceItem.h'
848--- tests/mocks/Unity/Application/MirSurfaceItem.h 2014-07-25 06:50:09 +0000
849+++ tests/mocks/Unity/Application/MirSurfaceItem.h 2014-08-07 14:25:38 +0000
850@@ -117,5 +117,6 @@
851 };
852
853 Q_DECLARE_METATYPE(MirSurfaceItem*)
854+Q_DECLARE_METATYPE(QList<MirSurfaceItem*>)
855
856 #endif // MIRSURFACEITEM_H
857
858=== modified file 'tests/mocks/Unity/CMakeLists.txt'
859--- tests/mocks/Unity/CMakeLists.txt 2014-08-07 14:25:38 +0000
860+++ tests/mocks/Unity/CMakeLists.txt 2014-08-05 12:06:16 +0000
861@@ -7,7 +7,7 @@
862 pkg_search_module(DEE dee-1.0 REQUIRED)
863 pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
864 pkg_search_module(DEEQT libdee-qt5 REQUIRED)
865-pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=4)
866+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=3)
867
868 include_directories(
869 ${CMAKE_CURRENT_BINARY_DIR}
870@@ -23,14 +23,14 @@
871 fake_scope.cpp
872 fake_scopes.cpp
873 fake_categories.cpp
874- fake_navigation.cpp
875+ fake_department.cpp
876 fake_resultsmodel.cpp
877 fake_previewmodel.cpp
878 fake_previewstack.cpp
879 fake_previewwidgetmodel.cpp
880 fake_unity_plugin.cpp
881 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/CategoriesInterface.h
882- ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/NavigationInterface.h
883+ ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/DepartmentInterface.h
884 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewModelInterface.h
885 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewStackInterface.h
886 ${SCOPES_API_INCLUDEDIR}/unity/shell/scopes/PreviewWidgetModelInterface.h
887
888=== modified file 'tests/mocks/Unity/Unity.qmltypes'
889--- tests/mocks/Unity/Unity.qmltypes 2014-08-07 14:25:38 +0000
890+++ tests/mocks/Unity/Unity.qmltypes 2014-07-10 10:59:08 +0000
891@@ -24,12 +24,6 @@
892 Parameter { name: "categoryId"; type: "string" }
893 Parameter { name: "json"; type: "string" }
894 }
895- Method {
896- name: "data"
897- type: "QVariant"
898- Parameter { name: "row"; type: "int" }
899- Parameter { name: "role"; type: "int" }
900- }
901 }
902 Component {
903 name: "PreviewModel"
904@@ -68,10 +62,6 @@
905 prototype: "unity::shell::scopes::ScopeInterface"
906 exports: ["Unity/MockScope 0.2"]
907 exportMetaObjectRevisions: [0]
908- Signal {
909- name: "performQuery"
910- Parameter { name: "query"; type: "string" }
911- }
912 Method {
913 name: "setSearchInProgress"
914 Parameter { name: "inProg"; type: "bool" }
915@@ -91,21 +81,18 @@
916 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
917 }
918 Method {
919- name: "getNavigation"
920- type: "unity::shell::scopes::NavigationInterface*"
921- Parameter { name: "navigationId"; type: "string" }
922- }
923- Method {
924- name: "getAltNavigation"
925- type: "unity::shell::scopes::NavigationInterface*"
926- Parameter { name: "altNavigationId"; type: "string" }
927- }
928- Method {
929- name: "setNavigationState"
930- Parameter { name: "navigationId"; type: "string" }
931- Parameter { name: "isAltNavigation"; type: "bool" }
932- }
933- Method { name: "refresh" }
934+ name: "getDepartment"
935+ type: "unity::shell::scopes::DepartmentInterface*"
936+ Parameter { name: "id"; type: "string" }
937+ }
938+ Method {
939+ name: "loadDepartment"
940+ Parameter { name: "id"; type: "string" }
941+ }
942+ Method {
943+ name: "performQuery"
944+ Parameter { name: "query"; type: "string" }
945+ }
946 }
947 Component {
948 name: "Scopes"
949@@ -150,7 +137,6 @@
950 "RoleRawRendererTemplate": 3,
951 "RoleRenderer": 4,
952 "RoleComponents": 5,
953- "RoleHeaderLink": 6,
954 "RoleResults": 7,
955 "RoleCount": 8
956 }
957@@ -171,28 +157,27 @@
958 }
959 }
960 Component {
961- name: "unity::shell::scopes::NavigationInterface"
962+ name: "unity::shell::scopes::DepartmentInterface"
963 prototype: "QAbstractListModel"
964- exports: ["Unity/Navigation 0.2"]
965+ exports: ["Unity/Department 0.2"]
966 isCreatable: false
967 exportMetaObjectRevisions: [0]
968 Enum {
969 name: "Roles"
970 values: {
971- "RoleNavigationId": 0,
972+ "RoleDepartmentId": 0,
973 "RoleLabel": 1,
974 "RoleHasChildren": 2,
975 "RoleIsActive": 3
976 }
977 }
978- Property { name: "navigationId"; type: "string"; isReadonly: true }
979+ Property { name: "departmentId"; type: "string"; isReadonly: true }
980 Property { name: "label"; type: "string"; isReadonly: true }
981 Property { name: "allLabel"; type: "string"; isReadonly: true }
982- Property { name: "parentNavigationId"; type: "string"; isReadonly: true }
983+ Property { name: "parentDepartmentId"; type: "string"; isReadonly: true }
984 Property { name: "parentLabel"; type: "string"; isReadonly: true }
985 Property { name: "loaded"; type: "bool"; isReadonly: true }
986 Property { name: "isRoot"; type: "bool"; isReadonly: true }
987- Property { name: "hidden"; type: "bool"; isReadonly: true }
988 Property { name: "count"; type: "int"; isReadonly: true }
989 }
990 Component {
991@@ -262,8 +247,7 @@
992 "RoleEmblem": 8,
993 "RoleSummary": 9,
994 "RoleAttributes": 10,
995- "RoleBackground": 11,
996- "RoleOverlayColor": 12
997+ "RoleBackground": 11
998 }
999 }
1000 Property { name: "categoryId"; type: "string" }
1001@@ -275,22 +259,13 @@
1002 exports: ["Unity/Scope 0.2"]
1003 isCreatable: false
1004 exportMetaObjectRevisions: [0]
1005- Enum {
1006- name: "Status"
1007- values: {
1008- "Okay": 0,
1009- "NoInternet": 1,
1010- "NoLocationData": 2,
1011- "Unknown": 3
1012- }
1013- }
1014 Property { name: "id"; type: "string"; isReadonly: true }
1015 Property { name: "name"; type: "string"; isReadonly: true }
1016 Property { name: "iconHint"; type: "string"; isReadonly: true }
1017 Property { name: "description"; type: "string"; isReadonly: true }
1018 Property { name: "searchHint"; type: "string"; isReadonly: true }
1019 Property { name: "searchInProgress"; type: "bool"; isReadonly: true }
1020- Property { name: "favorite"; type: "bool" }
1021+ Property { name: "visible"; type: "bool"; isReadonly: true }
1022 Property { name: "shortcut"; type: "string"; isReadonly: true }
1023 Property {
1024 name: "categories"
1025@@ -298,27 +273,13 @@
1026 isReadonly: true
1027 isPointer: true
1028 }
1029- Property {
1030- name: "settings"
1031- type: "unity::shell::scopes::SettingsModelInterface"
1032- isReadonly: true
1033- isPointer: true
1034- }
1035 Property { name: "searchQuery"; type: "string" }
1036 Property { name: "noResultsHint"; type: "string" }
1037 Property { name: "formFactor"; type: "string" }
1038 Property { name: "isActive"; type: "bool" }
1039- Property { name: "currentNavigationId"; type: "string"; isReadonly: true }
1040- Property { name: "hasNavigation"; type: "bool"; isReadonly: true }
1041- Property { name: "currentAltNavigationId"; type: "string"; isReadonly: true }
1042- Property { name: "hasAltNavigation"; type: "bool"; isReadonly: true }
1043+ Property { name: "currentDepartmentId"; type: "string"; isReadonly: true }
1044+ Property { name: "hasDepartments"; type: "bool"; isReadonly: true }
1045 Property { name: "customizations"; type: "QVariantMap"; isReadonly: true }
1046- Property {
1047- name: "status"
1048- type: "unity::shell::scopes::ScopeInterface::Status"
1049- isReadonly: true
1050- }
1051- Signal { name: "detailsChanged" }
1052 Signal { name: "showDash" }
1053 Signal { name: "hideDash" }
1054 Signal {
1055@@ -337,6 +298,10 @@
1056 name: "openScope"
1057 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
1058 }
1059+ Signal {
1060+ name: "activateApplication"
1061+ Parameter { name: "desktop"; type: "string" }
1062+ }
1063 Method {
1064 name: "activate"
1065 Parameter { name: "result"; type: "QVariant" }
1066@@ -352,25 +317,14 @@
1067 Parameter { name: "scope"; type: "unity::shell::scopes::ScopeInterface"; isPointer: true }
1068 }
1069 Method {
1070- name: "getNavigation"
1071- type: "unity::shell::scopes::NavigationInterface*"
1072- Parameter { name: "navigationId"; type: "string" }
1073- }
1074- Method {
1075- name: "getAltNavigation"
1076- type: "unity::shell::scopes::NavigationInterface*"
1077- Parameter { name: "altNavigationId"; type: "string" }
1078- }
1079- Method {
1080- name: "setNavigationState"
1081- Parameter { name: "navId"; type: "string" }
1082- Parameter { name: "altNavigation"; type: "bool" }
1083- }
1084- Method {
1085- name: "performQuery"
1086- Parameter { name: "cannedQuery"; type: "string" }
1087- }
1088- Method { name: "refresh" }
1089+ name: "getDepartment"
1090+ type: "unity::shell::scopes::DepartmentInterface*"
1091+ Parameter { name: "departmentId"; type: "string" }
1092+ }
1093+ Method {
1094+ name: "loadDepartment"
1095+ Parameter { name: "departmentId"; type: "string" }
1096+ }
1097 }
1098 Component {
1099 name: "unity::shell::scopes::ScopesInterface"
1100@@ -380,17 +334,11 @@
1101 values: {
1102 "RoleScope": 0,
1103 "RoleId": 1,
1104- "RoleTitle": 2
1105+ "RoleVisible": 2,
1106+ "RoleTitle": 3
1107 }
1108 }
1109 Property { name: "loaded"; type: "bool"; isReadonly: true }
1110- Property { name: "count"; type: "int"; isReadonly: true }
1111- Property {
1112- name: "overviewScope"
1113- type: "unity::shell::scopes::ScopeInterface"
1114- isReadonly: true
1115- isPointer: true
1116- }
1117 Method {
1118 name: "getScope"
1119 type: "unity::shell::scopes::ScopeInterface*"
1120
1121=== renamed file 'tests/mocks/Unity/fake_navigation.cpp' => 'tests/mocks/Unity/fake_department.cpp'
1122--- tests/mocks/Unity/fake_navigation.cpp 2014-08-07 14:25:38 +0000
1123+++ tests/mocks/Unity/fake_department.cpp 2014-06-18 13:48:32 +0000
1124@@ -14,15 +14,14 @@
1125 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1126 */
1127
1128-#include "fake_navigation.h"
1129+#include "fake_department.h"
1130
1131 #include "fake_scope.h"
1132
1133-#include <QDebug>
1134 #include <QTimer>
1135
1136-Navigation::Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
1137- : m_navigationId(navigationId)
1138+Department::Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope)
1139+ : m_departmentId(departmentId)
1140 , m_label(label)
1141 , m_allLabel(allLabel)
1142 , m_parentId(parentId)
1143@@ -31,87 +30,96 @@
1144 , m_scope(scope)
1145 {
1146 QTimer::singleShot(1500, this, SLOT(slotLoaded()));
1147- connect(scope, SIGNAL(currentNavigationIdChanged()), this, SLOT(slotCurrentNavigationChanged()));
1148+ connect(scope, SIGNAL(currentDepartmentIdChanged()), this, SLOT(slotCurrentDepartmentChanged()));
1149 }
1150
1151-QString Navigation::navigationId() const
1152+QString Department::departmentId() const
1153 {
1154- return m_navigationId;
1155+ return m_departmentId;
1156 }
1157
1158-QString Navigation::label() const
1159+QString Department::label() const
1160 {
1161 return m_label;
1162 }
1163
1164-QString Navigation::allLabel() const
1165+QString Department::allLabel() const
1166 {
1167 return m_allLabel;
1168 }
1169
1170-QString Navigation::parentNavigationId() const
1171+QString Department::parentDepartmentId() const
1172 {
1173 return m_parentId;
1174 }
1175
1176-QString Navigation::parentLabel() const
1177+QString Department::parentLabel() const
1178 {
1179 return m_parentLabel;
1180 }
1181
1182-void Navigation::slotLoaded()
1183+void Department::slotLoaded()
1184 {
1185 m_loaded = true;
1186 Q_EMIT loadedChanged();
1187 }
1188
1189-bool Navigation::loaded() const
1190+bool Department::loaded() const
1191 {
1192 return m_loaded;
1193 }
1194
1195-int Navigation::count() const
1196+int Department::count() const
1197 {
1198 return rowCount();
1199 }
1200
1201-bool Navigation::isRoot() const
1202-{
1203- return m_navigationId == "root" || m_navigationId == "altroot";
1204-}
1205-
1206-bool Navigation::hidden() const
1207-{
1208- return m_navigationId == "altroot";
1209-}
1210-
1211-int Navigation::rowCount(const QModelIndex & /*parent*/) const
1212-{
1213- if (!m_loaded || m_navigationId.startsWith("child") || m_navigationId == "middle3")
1214+bool Department::isRoot() const
1215+{
1216+ return m_departmentId == "root";
1217+}
1218+
1219+int Department::rowCount(const QModelIndex & /*parent*/) const
1220+{
1221+ if (!m_loaded || m_departmentId.startsWith("child") || m_departmentId == "middle3")
1222 return 0;
1223 else
1224 return 8;
1225 }
1226
1227-QVariant Navigation::data(const QModelIndex &index, int role) const
1228+QHash<int, QByteArray> Department::roleNames() const
1229+{
1230+ QHash<int, QByteArray> res;
1231+ res[RoleDepartmentId] = "departmentId";
1232+ res[RoleLabel] = "label";
1233+ res[RoleHasChildren] = "hasChildren";
1234+ res[RoleIsActive] = "isActive";
1235+ return res;
1236+}
1237+
1238+QVariant Department::data(const QModelIndex &index, int role) const
1239 {
1240 switch (role) {
1241- case RoleNavigationId:
1242- if (m_navigationId == "root")
1243+ case RoleDepartmentId:
1244+ if (m_departmentId == "root")
1245 return QString("middle%1").arg(index.row());
1246- else if (m_navigationId.startsWith("middle"))
1247- return QString("child%1%2").arg(m_navigationId).arg(index.row());
1248+ else if (m_departmentId.startsWith("middle"))
1249+ return QString("child%1%2").arg(m_departmentId).arg(index.row());
1250+ break;
1251 case RoleLabel:
1252- return QString("%1Child%2").arg(m_navigationId).arg(index.row());
1253+ return QString("%1Child%2").arg(m_departmentId).arg(index.row());
1254+ break;
1255 case RoleHasChildren:
1256- return m_navigationId == "root" && index.row() != 3;
1257+ return m_departmentId == "root" && index.row() != 3;
1258+ break;
1259 case RoleIsActive:
1260- return m_scope->currentNavigationId() == data(index, RoleNavigationId);
1261+ return m_scope->currentDepartmentId() == data(index, RoleDepartmentId);
1262+ break;
1263 }
1264 return QVariant();
1265 }
1266
1267-void Navigation::slotCurrentNavigationChanged()
1268+void Department::slotCurrentDepartmentChanged()
1269 {
1270 // This is wasteful, should only emit it if really something changed in this
1271 // deparment, but this is a mock, so no need to optimize
1272
1273=== renamed file 'tests/mocks/Unity/fake_navigation.h' => 'tests/mocks/Unity/fake_department.h'
1274--- tests/mocks/Unity/fake_navigation.h 2014-08-07 14:25:38 +0000
1275+++ tests/mocks/Unity/fake_department.h 2014-05-29 10:25:21 +0000
1276@@ -14,48 +14,48 @@
1277 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1278 */
1279
1280-#ifndef FAKE_NAVIGATION_H
1281-#define FAKE_NAVIGATION_H
1282+#ifndef FAKE_DEPARTMENT_H
1283+#define FAKE_DEPARTMENT_H
1284
1285-#include <unity/shell/scopes/NavigationInterface.h>
1286+#include <unity/shell/scopes/DepartmentInterface.h>
1287
1288 class Scope;
1289
1290-class Navigation : public unity::shell::scopes::NavigationInterface
1291+class Department : public unity::shell::scopes::DepartmentInterface
1292 {
1293 Q_OBJECT
1294
1295 public:
1296- Navigation(const QString& navigationId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
1297+ Department(const QString& departmentId, const QString& label, const QString& allLabel, const QString& parentId, const QString& parentLabel, Scope* scope);
1298
1299- QString navigationId() const override;
1300+ QString departmentId() const override;
1301 QString label() const override;
1302 QString allLabel() const override;
1303- QString parentNavigationId() const override;
1304+ QString parentDepartmentId() const override;
1305 QString parentLabel() const override;
1306 bool loaded() const override;
1307+ int count() const override;
1308 bool isRoot() const override;
1309- bool hidden() const override;
1310- int count() const override;
1311
1312 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
1313+ QHash<int, QByteArray> roleNames() const;
1314 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
1315
1316 public Q_SLOTS:
1317- void slotCurrentNavigationChanged();
1318+ void slotCurrentDepartmentChanged();
1319
1320 private Q_SLOTS:
1321 void slotLoaded();
1322
1323 private:
1324- QString m_navigationId;
1325+ QString m_departmentId;
1326 QString m_label;
1327 QString m_allLabel;
1328 QString m_parentId;
1329 QString m_parentLabel;
1330 bool m_loaded;
1331- QString m_currentNavigation;
1332+ QString m_currentDepartment;
1333 Scope *m_scope;
1334 };
1335
1336-#endif // FAKE_NAVIGATION_H
1337+#endif // FAKE_DEPARTMENT_H
1338
1339=== modified file 'tests/mocks/Unity/fake_scope.cpp'
1340--- tests/mocks/Unity/fake_scope.cpp 2014-08-07 14:25:38 +0000
1341+++ tests/mocks/Unity/fake_scope.cpp 2014-07-24 20:40:57 +0000
1342@@ -14,26 +14,24 @@
1343 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1344 */
1345
1346-#include <QDebug>
1347 #include <QUrl>
1348
1349 #include "fake_scope.h"
1350-#include "fake_navigation.h"
1351+#include "fake_department.h"
1352 #include "fake_resultsmodel.h"
1353
1354 Scope::Scope(QObject* parent) : Scope(QString(), QString(), false, parent)
1355 {
1356 }
1357
1358-Scope::Scope(QString const& id, QString const& name, bool favorite, QObject* parent, int categories)
1359+Scope::Scope(QString const& id, QString const& name, bool visible, QObject* parent, int categories)
1360 : unity::shell::scopes::ScopeInterface(parent)
1361 , m_id(id)
1362 , m_name(name)
1363+ , m_visible(visible)
1364 , m_searching(false)
1365- , m_favorite(favorite)
1366 , m_isActive(false)
1367- , m_currentNavigationId("root")
1368- , m_currentAltNavigationId("altroot")
1369+ , m_currentDeparment("root")
1370 , m_previewRendererName("preview-generic")
1371 , m_categories(new Categories(categories, this))
1372 {
1373@@ -79,11 +77,6 @@
1374 return m_searching;
1375 }
1376
1377-bool Scope::favorite() const
1378-{
1379- return m_favorite;
1380-}
1381-
1382 unity::shell::scopes::CategoriesInterface* Scope::categories() const
1383 {
1384 return m_categories;
1385@@ -104,6 +97,11 @@
1386 return m_formFactor;
1387 }
1388
1389+bool Scope::visible() const
1390+{
1391+ return m_visible;
1392+}
1393+
1394 bool Scope::isActive() const
1395 {
1396 return m_isActive;
1397@@ -133,13 +131,6 @@
1398 }
1399 }
1400
1401-void Scope::setFavorite(const bool favorite)
1402-{
1403- if (favorite != m_favorite) {
1404- m_favorite = favorite;
1405- Q_EMIT favoriteChanged();
1406- }
1407-}
1408 void Scope::setSearchInProgress(const bool inProg)
1409 {
1410 if (inProg != m_searching) {
1411@@ -179,29 +170,14 @@
1412 qFatal("Scope::closeScope is not implemented");
1413 }
1414
1415-QString Scope::currentNavigationId() const
1416-{
1417- return m_currentNavigationId;
1418-}
1419-
1420-bool Scope::hasNavigation() const
1421-{
1422- return true;
1423-}
1424-
1425-QString Scope::currentAltNavigationId() const
1426-{
1427- return m_currentAltNavigationId;
1428-}
1429-
1430-bool Scope::hasAltNavigation() const
1431-{
1432- return true;
1433-}
1434-
1435-Scope::Status Scope::status() const
1436-{
1437- return Status::Okay;
1438+QString Scope::currentDepartmentId() const
1439+{
1440+ return m_currentDeparment;
1441+}
1442+
1443+bool Scope::hasDepartments() const
1444+{
1445+ return true;
1446 }
1447
1448 QVariantMap Scope::customizations() const
1449@@ -220,12 +196,7 @@
1450 return m;
1451 }
1452
1453-void Scope::refresh()
1454-{
1455- qDebug() << "Scope::refresh is currently not implmented in the fake scopes plugin";
1456-}
1457-
1458-unity::shell::scopes::NavigationInterface* Scope::getNavigation(const QString& id)
1459+unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& id)
1460 {
1461 if (id.isEmpty())
1462 return nullptr;
1463@@ -239,30 +210,11 @@
1464 parentId = id.mid(5, 7);
1465 parentLabel = parentId;
1466 }
1467- return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
1468-}
1469-
1470-unity::shell::scopes::NavigationInterface* Scope::getAltNavigation(QString const& id)
1471-{
1472- if (id.isEmpty())
1473- return nullptr;
1474-
1475- QString parentId;
1476- QString parentLabel;
1477- if (id.startsWith("altmiddle")) {
1478- parentId = "altroot";
1479- parentLabel = "altroot";
1480- }
1481- return new Navigation(id, id, "all"+id, parentId, parentLabel, this);
1482-}
1483-
1484-void Scope::setNavigationState(const QString &navigationId, bool isAltNavigation)
1485-{
1486- if (isAltNavigation) {
1487- m_currentAltNavigationId = navigationId;
1488- Q_EMIT currentAltNavigationIdChanged();
1489- } else {
1490- m_currentNavigationId = navigationId;
1491- Q_EMIT currentNavigationIdChanged();
1492- }
1493+ return new Department(id, id, "all"+id, parentId, parentLabel, this);
1494+}
1495+
1496+void Scope::loadDepartment(const QString& id)
1497+{
1498+ m_currentDeparment = id;
1499+ Q_EMIT currentDepartmentIdChanged();
1500 }
1501
1502=== modified file 'tests/mocks/Unity/fake_scope.h'
1503--- tests/mocks/Unity/fake_scope.h 2014-08-07 14:25:38 +0000
1504+++ tests/mocks/Unity/fake_scope.h 2014-07-11 16:39:33 +0000
1505@@ -30,7 +30,7 @@
1506
1507 public:
1508 Scope(QObject* parent = 0);
1509- Scope(QString const& id, QString const& name, bool favorite, QObject* parent = 0, int categories = 20);
1510+ Scope(QString const& id, QString const& name, bool visible, QObject* parent = 0, int categories = 20);
1511
1512 /* getters */
1513 QString id() const override;
1514@@ -38,9 +38,9 @@
1515 QString iconHint() const override;
1516 QString description() const override;
1517 QString searchHint() const override;
1518+ bool visible() const override;
1519 QString shortcut() const override;
1520 bool searchInProgress() const override;
1521- bool favorite() const override;
1522 unity::shell::scopes::CategoriesInterface* categories() const override;
1523 QString searchQuery() const override;
1524 QString noResultsHint() const override;
1525@@ -53,7 +53,6 @@
1526 void setNoResultsHint(const QString& hint) override;
1527 void setFormFactor(const QString& form_factor) override;
1528 void setActive(const bool) override;
1529- void setFavorite(const bool) override;
1530 Q_INVOKABLE void setSearchInProgress(const bool inProg); // This is not invokable in the Interface, here for testing benefits
1531
1532 Q_INVOKABLE void activate(QVariant const& result) override;
1533@@ -61,20 +60,14 @@
1534 Q_INVOKABLE void cancelActivation() override;
1535 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
1536
1537- QString currentNavigationId() const override;
1538- bool hasNavigation() const override;
1539- QString currentAltNavigationId() const override;
1540- bool hasAltNavigation() const override;
1541- Q_INVOKABLE unity::shell::scopes::NavigationInterface* getNavigation(QString const& navigationId) override;
1542- Q_INVOKABLE unity::shell::scopes::NavigationInterface* getAltNavigation(QString const& altNavigationId) override;
1543- Q_INVOKABLE void setNavigationState(const QString &navigationId, bool isAltNavigation) override;
1544+ QString currentDepartmentId() const override;
1545+ bool hasDepartments() const override;
1546+ Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(const QString& id) override;
1547+ Q_INVOKABLE void loadDepartment(const QString& id) override;
1548 Q_SIGNAL void performQuery(const QString& query) override;
1549
1550- Status status() const override;
1551 QVariantMap customizations() const override;
1552
1553- Q_INVOKABLE void refresh() override;
1554-
1555 protected:
1556
1557 QString m_id;
1558@@ -84,11 +77,10 @@
1559 QString m_searchQuery;
1560 QString m_noResultsHint;
1561 QString m_formFactor;
1562+ bool m_visible;
1563 bool m_searching;
1564- bool m_favorite;
1565 bool m_isActive;
1566- QString m_currentNavigationId;
1567- QString m_currentAltNavigationId;
1568+ QString m_currentDeparment;
1569
1570 QString m_previewRendererName;
1571
1572
1573=== modified file 'tests/mocks/Unity/fake_scopes.cpp'
1574--- tests/mocks/Unity/fake_scopes.cpp 2014-08-07 14:25:38 +0000
1575+++ tests/mocks/Unity/fake_scopes.cpp 2014-07-25 13:25:45 +0000
1576@@ -32,11 +32,6 @@
1577 timer.setSingleShot(true);
1578 timer.setInterval(100);
1579 QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateScopes()));
1580-
1581- QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
1582- QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
1583- QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
1584-
1585 load();
1586 }
1587
1588@@ -97,6 +92,8 @@
1589 return QVariant::fromValue(scope);
1590 } else if (role == Scopes::RoleId) {
1591 return QVariant::fromValue(scope->id());
1592+ } else if (role == Scopes::RoleVisible) {
1593+ return QVariant::fromValue(scope->visible());
1594 } else if (role == Scopes::RoleTitle) {
1595 return QVariant::fromValue(scope->name());
1596 } else {
1597@@ -128,11 +125,6 @@
1598 return m_loaded;
1599 }
1600
1601-int Scopes::count() const
1602-{
1603- return rowCount();
1604-}
1605-
1606 unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
1607 {
1608 return nullptr;
1609
1610=== modified file 'tests/mocks/Unity/fake_scopes.h'
1611--- tests/mocks/Unity/fake_scopes.h 2014-08-07 14:25:38 +0000
1612+++ tests/mocks/Unity/fake_scopes.h 2014-07-25 13:25:45 +0000
1613@@ -50,7 +50,6 @@
1614 QModelIndex parent ( const QModelIndex & index ) const;
1615
1616 bool loaded() const override;
1617- int count() const override;
1618 unity::shell::scopes::ScopeInterface* overviewScope() const override;
1619
1620 private Q_SLOTS:
1621
1622=== modified file 'tests/mocks/Unity/fake_unity_plugin.cpp'
1623--- tests/mocks/Unity/fake_unity_plugin.cpp 2014-08-07 14:25:38 +0000
1624+++ tests/mocks/Unity/fake_unity_plugin.cpp 2014-07-08 11:26:44 +0000
1625@@ -22,7 +22,7 @@
1626 // local
1627 #include "fake_scopes.h"
1628 #include "fake_categories.h"
1629-#include "fake_navigation.h"
1630+#include "fake_department.h"
1631 #include "fake_previewmodel.h"
1632 #include "fake_previewwidgetmodel.h"
1633 #include "fake_resultsmodel.h"
1634@@ -43,7 +43,7 @@
1635 qmlRegisterType<Scopes>(uri, 0, 2, "Scopes");
1636 qmlRegisterType<Scope>(uri, 0, 2, "MockScope");
1637 qmlRegisterUncreatableType<unity::shell::scopes::ScopeInterface>(uri, 0, 2, "Scope", "Can't create Scope object in QML.");
1638- qmlRegisterUncreatableType<unity::shell::scopes::NavigationInterface>(uri, 0, 2, "Navigation", "Can't create Navigation object in QML.");
1639+ qmlRegisterUncreatableType<unity::shell::scopes::DepartmentInterface>(uri, 0, 2, "Department", "Can't create Department object in QML.");
1640 qmlRegisterUncreatableType<unity::shell::scopes::CategoriesInterface>(uri, 0, 2, "Categories", "Can't create Categories object in QML.");
1641 qmlRegisterUncreatableType<unity::shell::scopes::PreviewModelInterface>(uri, 0, 2, "PreviewModel", "Can't create new PreviewModel in QML. Get them from PreviewStack instance.");
1642 qmlRegisterUncreatableType<ResultsModel>(uri, 0, 2, "ResultsModel", "Can't create ResultsModel object in QML.");
1643
1644=== modified file 'tests/qmltests/Dash/tst_Dash.qml'
1645--- tests/qmltests/Dash/tst_Dash.qml 2014-08-07 14:25:38 +0000
1646+++ tests/qmltests/Dash/tst_Dash.qml 2014-07-29 11:35:10 +0000
1647@@ -64,10 +64,10 @@
1648
1649 function get_scope_data() {
1650 return [
1651- { tag: "MockScope1", visualIndex: 0 },
1652- { tag: "MockScope2", visualIndex: 1 },
1653- { tag: "clickscope", visualIndex: 2 },
1654- { tag: "MockScope5", visualIndex: 3 },
1655+ { tag: "MockScope1", visualIndex: 0, shouldBeVisible: true },
1656+ { tag: "MockScope2", visualIndex: -1, shouldBeVisible: false },
1657+ { tag: "clickscope", visualIndex: 1, shouldBeVisible: true },
1658+ { tag: "MockScope5", visualIndex: 2, shouldBeVisible: true },
1659 ]
1660 }
1661
1662@@ -76,6 +76,10 @@
1663 }
1664
1665 function test_show_scope_on_load(data) {
1666+ if (data.shouldBeVisible == false) {
1667+ console.log("Not testing " + data.tag + ": not visible");
1668+ return;
1669+ }
1670 var dashContentList = findChild(dash, "dashContentList");
1671
1672 dash.showScopeOnLoaded = data.tag
1673@@ -83,7 +87,7 @@
1674 tryCompare(dashContentList, "count", 0);
1675 scopes.load();
1676 tryCompare(scopes, "loaded", true);
1677- tryCompare(dashContentList, "count", 5);
1678+ tryCompare(dashContentList, "count", 4);
1679
1680 verify(dashContentList != undefined);
1681 tryCompare(dashContentList, "currentIndex", data.visualIndex);
1682
1683=== modified file 'tests/qmltests/Dash/tst_DashContent.qml'
1684--- tests/qmltests/Dash/tst_DashContent.qml 2014-08-07 14:25:38 +0000
1685+++ tests/qmltests/Dash/tst_DashContent.qml 2014-07-21 13:28:35 +0000
1686@@ -43,6 +43,9 @@
1687 id: dashContent
1688 anchors.fill: parent
1689
1690+ model: SortFilterProxyModel {
1691+ model: scopesModel
1692+ }
1693 scopes : scopesModel
1694 }
1695
1696@@ -265,119 +268,117 @@
1697 verify(carouselLV.tileWidth / carouselLV.tileHeight == cardTool.components["art"]["aspect-ratio"]);
1698 }
1699
1700- function test_navigations() {
1701- var dashContentList = findChild(dashContent, "dashContentList");
1702- tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
1703- var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
1704- tryCompare(dashNavigation, "visible", true);
1705- compare(dashNavigation.showList, false);
1706- waitForRendering(dashNavigation);
1707- mouseClick(dashNavigation, 0, 0);
1708- compare(dashNavigation.showList, true);
1709-
1710- var navigationListView = findChild(dashNavigation, "navigationListView");
1711- compare(navigationListView.count, 1);
1712- tryCompare(navigationListView.currentItem.navigation, "loaded", true);
1713-
1714- waitForRendering(navigationListView);
1715- waitForRendering(navigationListView.currentItem);
1716-
1717- var allButton = findChild(dashNavigation, "allButton");
1718- compare(allButton.visible, false);
1719-
1720- var navigation = findChild(dashNavigation, "navigation0child3");
1721- mouseClick(navigation, 0, 0);
1722- compare(dashNavigation.showList, false);
1723- tryCompare(dashNavigation.currentNavigation, "navigationId", "middle3");
1724- tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1725-
1726- mouseClick(dashNavigation, 0, 0);
1727- compare(dashNavigation.showList, true);
1728- waitForRendering(navigationListView);
1729- waitForRendering(navigationListView.currentItem);
1730- compare(allButton.visible, true);
1731-
1732- mouseClick(allButton, 0, 0);
1733- compare(dashNavigation.showList, false);
1734- tryCompare(dashNavigation.currentNavigation, "navigationId", "root");
1735- tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1736-
1737- mouseClick(dashNavigation, 0, 0);
1738- compare(dashNavigation.showList, true);
1739- waitForRendering(navigationListView);
1740- waitForRendering(navigationListView.currentItem);
1741- compare(allButton.visible, false);
1742-
1743- navigation = findChild(dashNavigation, "navigation0child2");
1744- mouseClick(navigation, 0, 0);
1745- compare(dashNavigation.showList, true);
1746- tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1747- tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1748-
1749- var navigationList1 = findChild(dashNavigation, "navigation1");
1750- allButton = findChild(navigationList1, "allButton");
1751- var backButton = findChild(findChild(navigationList1, "navigation1"), "backButton");
1752- compare(allButton.visible, true);
1753- compare(backButton.visible, true);
1754-
1755- tryCompare(navigationListView, "contentX", navigationList1.x);
1756- waitForRendering(navigationListView);
1757- mouseClick(allButton, 0, 0);
1758- compare(dashNavigation.showList, false);
1759- tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1760- tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1761-
1762- mouseClick(dashNavigation, 0, 0);
1763- compare(dashNavigation.showList, true);
1764- waitForRendering(navigationListView);
1765- waitForRendering(navigationListView.currentItem);
1766- compare(allButton.visible, true);
1767- compare(backButton.visible, true);
1768-
1769- tryCompare(navigationList1.navigation, "loaded", true);
1770- navigation = findChild(dashNavigation, "navigation1child2");
1771- mouseClick(navigation, 0, 0);
1772- compare(dashNavigation.showList, false);
1773- tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle22");
1774- tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1775-
1776- mouseClick(dashNavigation, 0, 0);
1777- compare(dashNavigation.showList, true);
1778- waitForRendering(navigationListView);
1779- waitForRendering(navigationListView.currentItem);
1780-
1781- tryCompare(navigationList1.navigation, "loaded", true);
1782- navigation = findChild(dashNavigation, "navigation1child3");
1783- mouseClick(navigation, 0, 0);
1784- compare(dashNavigation.showList, false);
1785- tryCompare(dashNavigation.currentNavigation, "navigationId", "childmiddle23");
1786- tryCompare(navigationListView.currentItem.navigation, "navigationId", "middle2");
1787-
1788- mouseClick(dashNavigation, 0, 0);
1789- compare(dashNavigation.showList, true);
1790- waitForRendering(navigationListView);
1791- waitForRendering(navigationListView.currentItem);
1792+ function test_departments() {
1793+ var dashDepartments = findChild(dashContent, "dashDepartments");
1794+ compare(dashDepartments.visible, true);
1795+ compare(dashDepartments.showList, false);
1796+ waitForRendering(dashDepartments);
1797+ mouseClick(dashDepartments, 0, 0);
1798+ compare(dashDepartments.showList, true);
1799+
1800+ var departmentListView = findChild(dashDepartments, "departmentListView");
1801+ compare(departmentListView.count, 1);
1802+ tryCompare(departmentListView.currentItem.department, "loaded", true);
1803+
1804+ waitForRendering(departmentListView);
1805+ waitForRendering(departmentListView.currentItem);
1806+
1807+ var allButton = findChild(dashDepartments, "allButton");
1808+ compare(allButton.visible, false);
1809+
1810+ var department = findChild(dashDepartments, "department0child3");
1811+ mouseClick(department, 0, 0);
1812+ compare(dashDepartments.showList, false);
1813+ tryCompare(dashDepartments.currentDepartment, "departmentId", "middle3");
1814+ tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1815+
1816+ mouseClick(dashDepartments, 0, 0);
1817+ compare(dashDepartments.showList, true);
1818+ waitForRendering(departmentListView);
1819+ waitForRendering(departmentListView.currentItem);
1820+ compare(allButton.visible, true);
1821+
1822+ mouseClick(allButton, 0, 0);
1823+ compare(dashDepartments.showList, false);
1824+ tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
1825+ tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1826+
1827+ mouseClick(dashDepartments, 0, 0);
1828+ compare(dashDepartments.showList, true);
1829+ waitForRendering(departmentListView);
1830+ waitForRendering(departmentListView.currentItem);
1831+ compare(allButton.visible, false);
1832+
1833+ department = findChild(dashDepartments, "department0child2");
1834+ mouseClick(department, 0, 0);
1835+ compare(dashDepartments.showList, true);
1836+ tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1837+ tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1838+
1839+ var departmentList1 = findChild(dashDepartments, "department1");
1840+ allButton = findChild(departmentList1, "allButton");
1841+ var backButton = findChild(findChild(departmentList1, "department1"), "backButton");
1842+ compare(allButton.visible, true);
1843+ compare(backButton.visible, true);
1844+
1845+ tryCompare(departmentListView, "contentX", departmentList1.x);
1846+ waitForRendering(departmentListView);
1847+ mouseClick(allButton, 0, 0);
1848+ compare(dashDepartments.showList, false);
1849+ tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1850+ tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1851+
1852+ mouseClick(dashDepartments, 0, 0);
1853+ compare(dashDepartments.showList, true);
1854+ waitForRendering(departmentListView);
1855+ waitForRendering(departmentListView.currentItem);
1856+ compare(allButton.visible, true);
1857+ compare(backButton.visible, true);
1858+
1859+ tryCompare(departmentList1.department, "loaded", true);
1860+ department = findChild(dashDepartments, "department1child2");
1861+ mouseClick(department, 0, 0);
1862+ compare(dashDepartments.showList, false);
1863+ tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle22");
1864+ tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1865+
1866+ mouseClick(dashDepartments, 0, 0);
1867+ compare(dashDepartments.showList, true);
1868+ waitForRendering(departmentListView);
1869+ waitForRendering(departmentListView.currentItem);
1870+
1871+ tryCompare(departmentList1.department, "loaded", true);
1872+ department = findChild(dashDepartments, "department1child3");
1873+ mouseClick(department, 0, 0);
1874+ compare(dashDepartments.showList, false);
1875+ tryCompare(dashDepartments.currentDepartment, "departmentId", "childmiddle23");
1876+ tryCompare(departmentListView.currentItem.department, "departmentId", "middle2");
1877+
1878+ mouseClick(dashDepartments, 0, 0);
1879+ compare(dashDepartments.showList, true);
1880+ waitForRendering(departmentListView);
1881+ waitForRendering(departmentListView.currentItem);
1882 mouseClick(backButton, 0, 0);
1883
1884- tryCompare(dashNavigation.currentNavigation, "navigationId", "root");
1885- tryCompare(navigationListView.currentItem.navigation, "navigationId", "root");
1886- compare(dashNavigation.showList, true);
1887- mouseClick(dashNavigation, 0, 0);
1888- compare(dashNavigation.showList, false);
1889+ tryCompare(dashDepartments.currentDepartment, "departmentId", "root");
1890+ tryCompare(departmentListView.currentItem.department, "departmentId", "root");
1891+ compare(dashDepartments.showList, true);
1892+ mouseClick(dashDepartments, 0, 0);
1893+ compare(dashDepartments.showList, false);
1894
1895- mouseClick(dashNavigation, 0, 0);
1896- compare(dashNavigation.showList, true);
1897- tryCompare(navigationListView.currentItem.navigation, "loaded", true);
1898- navigation = findChild(dashNavigation, "navigation0child2");
1899- mouseClick(navigation, 0, 0);
1900- compare(dashNavigation.showList, true);
1901- navigationList1 = findChild(dashNavigation, "navigation1");
1902- compare(navigationList1.navigation.loaded, false);
1903- tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1904- allButton = findChild(navigationList1, "allButton");
1905- tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1906+ mouseClick(dashDepartments, 0, 0);
1907+ compare(dashDepartments.showList, true);
1908+ tryCompare(departmentListView.currentItem.department, "loaded", true);
1909+ department = findChild(dashDepartments, "department0child2");
1910+ mouseClick(department, 0, 0);
1911+ compare(dashDepartments.showList, true);
1912+ departmentList1 = findChild(dashDepartments, "department1");
1913+ compare(departmentList1.department.loaded, false);
1914+ tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1915+ allButton = findChild(departmentList1, "allButton");
1916+ tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1917 mouseClick(allButton, 0, 0);
1918- tryCompare(dashNavigation.currentNavigation, "navigationId", "middle2");
1919+ tryCompare(dashDepartments.currentDepartment, "departmentId", "middle2");
1920 }
1921 }
1922 }

Subscribers

People subscribed via source and target branches