on xenial help sign in
Fix departments to work with scopes interface v4
commitff2b71345d2a8e190f15433c215796f946f3f49a authorMichal Hruby <michal.mhr@gmail.com> dateWed 30 Jul 2014, 18:11 (12 years ago) parentd6e0fa4
3 files changed+18−18
qml/Dash/DashDepartments.qml+14−14 qml/Dash/DashDepartmentsList.qml+3−3 tests/mocks/Unity/CMakeLists.txt+1−1
qml/Dash/DashDepartments.qml+14−14
@@ -25,7 +25,7 @@ AbstractButton {
2525
2626 property bool showList: false
2727
28− readonly property var currentDepartment: scope && scope.hasDepartments ? scope.getDepartment(scope.currentDepartmentId) : null
28+ readonly property var currentDepartment: scope && scope.hasNavigation ? scope.getNavigation(scope.currentNavigationId) : null
2929
3030 property alias windowWidth: blackRect.width
3131 property alias windowHeight: blackRect.height
@@ -102,8 +102,8 @@ AbstractButton {
102102 model: ListModel {
103103 id: departmentModel
104104 // We have two roles
105− // departmentId: the department id of the department the list represents
106− // nullifyDepartment: overrides departmentId to be null
105+ // navigationId: the department id of the department the list represents
106+ // nullifyDepartment: overrides navigationId to be null
107107 // This is used to "clear" the delegate when going "right" on the tree
108108 }
109109 anchors {
@@ -138,31 +138,31 @@ AbstractButton {
138138 }
139139 }
140140 height: desiredHeight
141− department: (nullifyDepartment || !scope) ? null : scope.getDepartment(departmentId)
141+ department: (nullifyDepartment || !scope) ? null : scope.getNavigation(navigationId)
142142 currentDepartment: root.currentDepartment
143143 onEnterDepartment: {
144− scope.loadDepartment(newDepartmentId);
144+ scope.performQuery(departmentQuery);
145145 // We only need to add a new item to the model
146146 // if we have children, otherwise just load it
147147 if (hasChildren) {
148148 isGoingBack = false;
149− departmentModel.append({"departmentId": newDepartmentId, "nullifyDepartment": false});
149+ departmentModel.append({"navigationId": newNavigationId, "nullifyDepartment": false});
150150 departmentListView.currentIndex++;
151151 } else {
152152 showList = false;
153153 }
154154 }
155155 onGoBackToParentClicked: {
156− scope.loadDepartment(department.parentDepartmentId);
156+ scope.performQuery(department.parentQuery);
157157 isGoingBack = true;
158158 departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", false);
159159 departmentListView.currentIndex--;
160160 }
161161 onAllDepartmentClicked: {
162162 showList = false;
163− if (root.currentDepartment.parentDepartmentId == department.departmentId) {
163+ if (root.currentDepartment.parentNavigationId == department.navigationId) {
164164 // For leaves we have to go to the parent too
165− scope.loadDepartment(root.currentDepartment.parentDepartmentId);
165+ scope.performQuery(root.currentDepartment.parentQuery);
166166 }
167167 }
168168 }
@@ -185,16 +185,16 @@ AbstractButton {
185185
186186 onScopeChanged: {
187187 departmentModel.clear();
188− if (scope && scope.hasDepartments) {
189− departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
188+ if (scope && scope.hasNavigation) {
189+ departmentModel.append({"navigationId": scope.currentNavigationId, "nullifyDepartment": false});
190190 }
191191 }
192192
193193 Connections {
194194 target: scope
195− onHasDepartmentsChanged: {
196− if (scope.hasDepartments) {
197− departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
195+ onHasNavigationChanged: {
196+ if (scope.hasNavigation) {
197+ departmentModel.append({"navigationId": scope.currentNavigationId, "nullifyDepartment": false});
198198 } else {
199199 departmentModel.clear();
200200 }
qml/Dash/DashDepartmentsList.qml+3−3
@@ -22,7 +22,7 @@ Item {
2222 property var department: null
2323 property var currentDepartment: null
2424 property var scopeStyle: null
25− signal enterDepartment(var newDepartmentId, bool hasChildren)
25+ signal enterDepartment(var newNavigationId, var departmentQuery, bool hasChildren)
2626 signal goBackToParentClicked()
2727 signal allDepartmentClicked()
2828
@@ -114,7 +114,7 @@ Item {
114114 id: allButton
115115 objectName: "allButton"
116116 width: parent.width
117− visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
117+ visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentNavigationId == department.navigationId)) || false
118118 height: itemHeight
119119
120120 Label {
@@ -152,7 +152,7 @@ Item {
152152 height: root.itemHeight
153153 width: root.width
154154
155− onClicked: root.enterDepartment(departmentId, hasChildren)
155+ onClicked: root.enterDepartment(navigationId, query, hasChildren)
156156
157157 Label {
158158 anchors {
tests/mocks/Unity/CMakeLists.txt+1−1
@@ -6,7 +6,7 @@ add_subdirectory(Notifications)
66pkg_search_module(DEE dee-1.0 REQUIRED)
77pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
88pkg_search_module(DEEQT libdee-qt5 REQUIRED)
9−pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=2)
9+pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=4)
1010
1111include_directories(
1212 ${CMAKE_CURRENT_BINARY_DIR}