on xenial help sign in
Fix departments to work with scopes interface v4
ff2b713Michal Hruby
qml/Dash/DashDepartments.qml+14−14
@@ -25,7 +25,7 @@ AbstractButton {
25
25
26 property bool showList: false
26 property bool showList: false
27
27
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
29
29
30 property alias windowWidth: blackRect.width
30 property alias windowWidth: blackRect.width
31 property alias windowHeight: blackRect.height
31 property alias windowHeight: blackRect.height
@@ -102,8 +102,8 @@ AbstractButton {
102 model: ListModel {
102 model: ListModel {
103 id: departmentModel
103 id: departmentModel
104 // We have two roles
104 // We have two roles
105− // departmentId: the department id of the department the list represents
105+ // navigationId: the department id of the department the list represents
106− // nullifyDepartment: overrides departmentId to be null
106+ // nullifyDepartment: overrides navigationId to be null
107 // This is used to "clear" the delegate when going "right" on the tree
107 // This is used to "clear" the delegate when going "right" on the tree
108 }
108 }
109 anchors {
109 anchors {
@@ -138,31 +138,31 @@ AbstractButton {
138 }
138 }
139 }
139 }
140 height: desiredHeight
140 height: desiredHeight
141− department: (nullifyDepartment || !scope) ? null : scope.getDepartment(departmentId)
141+ department: (nullifyDepartment || !scope) ? null : scope.getNavigation(navigationId)
142 currentDepartment: root.currentDepartment
142 currentDepartment: root.currentDepartment
143 onEnterDepartment: {
143 onEnterDepartment: {
144− scope.loadDepartment(newDepartmentId);
144+ scope.performQuery(departmentQuery);
145 // We only need to add a new item to the model
145 // We only need to add a new item to the model
146 // if we have children, otherwise just load it
146 // if we have children, otherwise just load it
147 if (hasChildren) {
147 if (hasChildren) {
148 isGoingBack = false;
148 isGoingBack = false;
149− departmentModel.append({"departmentId": newDepartmentId, "nullifyDepartment": false});
149+ departmentModel.append({"navigationId": newNavigationId, "nullifyDepartment": false});
150 departmentListView.currentIndex++;
150 departmentListView.currentIndex++;
151 } else {
151 } else {
152 showList = false;
152 showList = false;
153 }
153 }
154 }
154 }
155 onGoBackToParentClicked: {
155 onGoBackToParentClicked: {
156− scope.loadDepartment(department.parentDepartmentId);
156+ scope.performQuery(department.parentQuery);
157 isGoingBack = true;
157 isGoingBack = true;
158 departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", false);
158 departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", false);
159 departmentListView.currentIndex--;
159 departmentListView.currentIndex--;
160 }
160 }
161 onAllDepartmentClicked: {
161 onAllDepartmentClicked: {
162 showList = false;
162 showList = false;
163− if (root.currentDepartment.parentDepartmentId == department.departmentId) {
163+ if (root.currentDepartment.parentNavigationId == department.navigationId) {
164 // For leaves we have to go to the parent too
164 // For leaves we have to go to the parent too
165− scope.loadDepartment(root.currentDepartment.parentDepartmentId);
165+ scope.performQuery(root.currentDepartment.parentQuery);
166 }
166 }
167 }
167 }
168 }
168 }
@@ -185,16 +185,16 @@ AbstractButton {
185
185
186 onScopeChanged: {
186 onScopeChanged: {
187 departmentModel.clear();
187 departmentModel.clear();
188− if (scope && scope.hasDepartments) {
188+ if (scope && scope.hasNavigation) {
189− departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
189+ departmentModel.append({"navigationId": scope.currentNavigationId, "nullifyDepartment": false});
190 }
190 }
191 }
191 }
192
192
193 Connections {
193 Connections {
194 target: scope
194 target: scope
195− onHasDepartmentsChanged: {
195+ onHasNavigationChanged: {
196− if (scope.hasDepartments) {
196+ if (scope.hasNavigation) {
197− departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
197+ departmentModel.append({"navigationId": scope.currentNavigationId, "nullifyDepartment": false});
198 } else {
198 } else {
199 departmentModel.clear();
199 departmentModel.clear();
200 }
200 }
qml/Dash/DashDepartmentsList.qml+3−3
@@ -22,7 +22,7 @@ Item {
22 property var department: null
22 property var department: null
23 property var currentDepartment: null
23 property var currentDepartment: null
24 property var scopeStyle: null
24 property var scopeStyle: null
25− signal enterDepartment(var newDepartmentId, bool hasChildren)
25+ signal enterDepartment(var newNavigationId, var departmentQuery, bool hasChildren)
26 signal goBackToParentClicked()
26 signal goBackToParentClicked()
27 signal allDepartmentClicked()
27 signal allDepartmentClicked()
28
28
@@ -114,7 +114,7 @@ Item {
114 id: allButton
114 id: allButton
115 objectName: "allButton"
115 objectName: "allButton"
116 width: parent.width
116 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
118 height: itemHeight
118 height: itemHeight
119
119
120 Label {
120 Label {
@@ -152,7 +152,7 @@ Item {
152 height: root.itemHeight
152 height: root.itemHeight
153 width: root.width
153 width: root.width
154
154
155− onClicked: root.enterDepartment(departmentId, hasChildren)
155+ onClicked: root.enterDepartment(navigationId, query, hasChildren)
156
156
157 Label {
157 Label {
158 anchors {
158 anchors {
tests/mocks/Unity/CMakeLists.txt+1−1
@@ -6,7 +6,7 @@ add_subdirectory(Notifications)
6pkg_search_module(DEE dee-1.0 REQUIRED)
6pkg_search_module(DEE dee-1.0 REQUIRED)
7pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
7pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
8pkg_search_module(DEEQT libdee-qt5 REQUIRED)
8pkg_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)
10
10
11include_directories(
11include_directories(
12 ${CMAKE_CURRENT_BINARY_DIR}
12 ${CMAKE_CURRENT_BINARY_DIR}