on xenial help sign in
make it fav vs nonfav, not fav vs all
commit5636a447d8f2ad4dd95962c29bf48ee5fa04b0d2 authorAlbert Astals <albert.astals@canonical.com> dateThu 18 Sep 2014, 17:04 (12 years ago) parent18b59bc
3 files changed+13−8
tests/mocks/Unity/fake_scopes.cpp+8−3 tests/mocks/Unity/fake_scopes.h+2−2 tests/mocks/Unity/fake_scopesoverview.cpp+3−3
tests/mocks/Unity/fake_scopes.cpp+8−3
@@ -164,14 +164,19 @@ unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
164164 return m_scopesOverview;
165165}
166166
167−QList<Scope*> Scopes::scopes() const
167+QList<Scope*> Scopes::favScopes() const
168168{
169169 return m_scopes;
170170}
171171
172−QList<Scope*> Scopes::allScopes() const
172+QList<Scope*> Scopes::nonFavScopes() const
173173{
174− return m_allScopes;
174+ QList<Scope*> res;
175+ for (Scope *scope : m_allScopes) {
176+ if (!m_scopes.contains(scope))
177+ res << scope;
178+ }
179+ return res;
175180}
176181
177182void Scopes::addScope(Scope* scope)
tests/mocks/Unity/fake_scopes.h+2−2
@@ -54,8 +54,8 @@ public:
5454 unity::shell::scopes::ScopeInterface* overviewScope() const override;
5555
5656 // This is used as part of implementation of the other C++ code, not API
57− QList<Scope*> scopes() const;
58− QList<Scope*> allScopes() const;
57+ QList<Scope*> favScopes() const;
58+ QList<Scope*> nonFavScopes() const;
5959 Q_INVOKABLE Scope* getScopeFromAll(const QString& scope_id) const;
6060
6161private Q_SLOTS:
tests/mocks/Unity/fake_scopesoverview.cpp+3−3
@@ -76,12 +76,12 @@ ScopesOverviewCategories::data(const QModelIndex& index, int role) const
7676 return QVariant();
7777 }
7878
79− const QString categoryId = index.row() == 0 ? "favorites" : "all";
79+ const QString categoryId = index.row() == 0 ? "favorites" : "nonfavorites";
8080
8181 unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()];
8282 if (!resultsModel) {
8383 QObject *that = const_cast<ScopesOverviewCategories*>(this);
84− QList<Scope*> scopes = index.row() == 0 ? m_scopes->scopes() : m_scopes->allScopes();
84+ QList<Scope*> scopes = index.row() == 0 ? m_scopes->favScopes() : m_scopes->nonFavScopes();
8585 resultsModel = new ScopesOverviewResultsModel(scopes, categoryId, that);
8686 m_resultsModels[index.row()] = resultsModel;
8787 }
@@ -89,7 +89,7 @@ ScopesOverviewCategories::data(const QModelIndex& index, int role) const
8989 case RoleCategoryId:
9090 return categoryId;
9191 case RoleName:
92− return index.row() == 0 ? "Favorites" : "All";
92+ return index.row() == 0 ? "Favorites" : "Non Favorites";
9393 case RoleIcon:
9494 return QVariant();
9595 case RoleRawRendererTemplate: