on xenial help sign in
Adapt to api changes
commit8b72bb06206a8b6188ab6d23b6d7b7efe003e11c authorAlbert Astals <albert.astals@canonical.com> dateThu 29 May 2014, 12:25 (12 years ago) parent8d1fce8
6 files changed+13−13
qml/Dash/DashDepartments.qml+5−5 qml/Dash/DashDepartmentsList.qml+2−2 tests/mocks/Unity/fake_department.cpp+2−2 tests/mocks/Unity/fake_department.h+1−1 tests/mocks/Unity/fake_scope.cpp+2−2 tests/mocks/Unity/fake_scope.h+1−1
qml/Dash/DashDepartments.qml+5−5
@@ -27,7 +27,7 @@ AbstractButton {
2727
2828 property bool showList: false
2929
30− readonly property var currentDepartment: scope && scope.hasDepartments ? scope.getDepartment(scope.currentDepartment) : null
30+ readonly property var currentDepartment: scope && scope.hasDepartments ? scope.getDepartment(scope.currentDepartmentId) : null
3131
3232 // Are we drilling down the tree or up?
3333 property bool isGoingBack: false
@@ -128,7 +128,7 @@ AbstractButton {
128128 }
129129 }
130130 onGoBackToParentClicked: {
131− scope.loadDepartment(department.parentId);
131+ scope.loadDepartment(department.parentDepartmentId);
132132 isGoingBack = true;
133133 departmentModel.setProperty(departmentListView.currentIndex - 1, "nullifyDepartment", false);
134134 departmentListView.currentIndex--;
@@ -137,7 +137,7 @@ AbstractButton {
137137 showList = false;
138138 if (root.currentDepartment.count == 0) {
139139 // For leaves we have to go to the parent too
140− scope.loadDepartment(root.currentDepartment.parentId);
140+ scope.loadDepartment(root.currentDepartment.parentDepartmentId);
141141 }
142142 }
143143 }
@@ -161,7 +161,7 @@ AbstractButton {
161161 onScopeChanged: {
162162 departmentModel.clear();
163163 if (scope && scope.hasDepartments) {
164− departmentModel.append({"departmentId": scope.currentDepartment, "nullifyDepartment": false});
164+ departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
165165 }
166166 }
167167
@@ -169,7 +169,7 @@ AbstractButton {
169169 target: scope
170170 onHasDepartmentsChanged: {
171171 if (scope.hasDepartments) {
172− departmentModel.append({"departmentId": scope.currentDepartment, "nullifyDepartment": false});
172+ departmentModel.append({"departmentId": scope.currentDepartmentId, "nullifyDepartment": false});
173173 } else {
174174 departmentModel.clear();
175175 }
qml/Dash/DashDepartmentsList.qml+2−2
@@ -61,7 +61,7 @@ Item {
6161 id: backButton
6262 objectName: "backButton"
6363 width: parent.width
64− visible: department && !department.isRoot
64+ visible: department && !department.isRoot || false
6565 height: visible ? itemHeight : 0
6666
6767 onClicked: root.goBackToParentClicked();
@@ -101,7 +101,7 @@ Item {
101101 objectName: "allButton"
102102 anchors.top: backButton.bottom
103103 width: parent.width
104− visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentId == department.departmentId))
104+ visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
105105 height: itemHeight
106106
107107 Label {
tests/mocks/Unity/fake_department.cpp+2−2
@@ -48,7 +48,7 @@ QString Department::allLabel() const
4848 return m_allLabel;
4949}
5050
51−QString Department::parentId() const
51+QString Department::parentDepartmentId() const
5252{
5353 return m_parentId;
5454}
@@ -113,7 +113,7 @@ QVariant Department::data(const QModelIndex &index, int role) const
113113 return m_departmentId == "root" && index.row() != 3;
114114 break;
115115 case RoleIsActive:
116− return m_scope->currentDepartment() == data(index, RoleDepartmentId);
116+ return m_scope->currentDepartmentId() == data(index, RoleDepartmentId);
117117 break;
118118 }
119119 return QVariant();
tests/mocks/Unity/fake_department.h+1−1
@@ -31,7 +31,7 @@ public:
3131 QString departmentId() const override;
3232 QString label() const override;
3333 QString allLabel() const override;
34− QString parentId() const override;
34+ QString parentDepartmentId() const override;
3535 QString parentLabel() const override;
3636 bool loaded() const override;
3737 int count() const override;
tests/mocks/Unity/fake_scope.cpp+2−2
@@ -145,7 +145,7 @@ void Scope::closeScope(unity::shell::scopes::ScopeInterface* /*scope*/)
145145 qFatal("Scope::closeScope is not implemented");
146146}
147147
148−QString Scope::currentDepartment() const
148+QString Scope::currentDepartmentId() const
149149{
150150 return m_currentDeparment;
151151}
@@ -175,5 +175,5 @@ unity::shell::scopes::DepartmentInterface* Scope::getDepartment(const QString& i
175175void Scope::loadDepartment(const QString& id)
176176{
177177 m_currentDeparment = id;
178− Q_EMIT currentDepartmentChanged();
178+ Q_EMIT currentDepartmentIdChanged();
179179}
tests/mocks/Unity/fake_scope.h+1−1
@@ -59,7 +59,7 @@ public:
5959 Q_INVOKABLE void cancelActivation() override;
6060 Q_INVOKABLE void closeScope(unity::shell::scopes::ScopeInterface* scope) override;
6161
62− QString currentDepartment() const override;
62+ QString currentDepartmentId() const override;
6363 bool hasDepartments() const override;
6464 Q_INVOKABLE unity::shell::scopes::DepartmentInterface* getDepartment(const QString& id) override;
6565 Q_INVOKABLE void loadDepartment(const QString& id) override;