on xenial help sign in
make it fav vs nonfav, not fav vs all
5636a44Albert Astals
tests/mocks/Unity/fake_scopes.cpp+8−3
@@ -164,14 +164,19 @@ unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
164 return m_scopesOverview;
164 return m_scopesOverview;
165}
165}
166
166
167−QList<Scope*> Scopes::scopes() const
167+QList<Scope*> Scopes::favScopes() const
168{
168{
169 return m_scopes;
169 return m_scopes;
170}
170}
171
171
172−QList<Scope*> Scopes::allScopes() const
172+QList<Scope*> Scopes::nonFavScopes() const
173{
173{
174+ QList<Scope*> res;
174− return m_allScopes;
175+ for (Scope *scope : m_allScopes) {
176+ if (!m_scopes.contains(scope))
177+ res << scope;
178+ }
179+ return res;
175}
180}
176
181
177void Scopes::addScope(Scope* scope)
182void Scopes::addScope(Scope* scope)
tests/mocks/Unity/fake_scopes.h+2−2
@@ -54,8 +54,8 @@ public:
54 unity::shell::scopes::ScopeInterface* overviewScope() const override;
54 unity::shell::scopes::ScopeInterface* overviewScope() const override;
55
55
56 // This is used as part of implementation of the other C++ code, not API
56 // This is used as part of implementation of the other C++ code, not API
57− QList<Scope*> scopes() const;
57+ QList<Scope*> favScopes() const;
58− QList<Scope*> allScopes() const;
58+ QList<Scope*> nonFavScopes() const;
59 Q_INVOKABLE Scope* getScopeFromAll(const QString& scope_id) const;
59 Q_INVOKABLE Scope* getScopeFromAll(const QString& scope_id) const;
60
60
61private Q_SLOTS:
61private Q_SLOTS:
tests/mocks/Unity/fake_scopesoverview.cpp+3−3
@@ -76,12 +76,12 @@ ScopesOverviewCategories::data(const QModelIndex& index, int role) const
76 return QVariant();
76 return QVariant();
77 }
77 }
78
78
79− const QString categoryId = index.row() == 0 ? "favorites" : "all";
79+ const QString categoryId = index.row() == 0 ? "favorites" : "nonfavorites";
80
80
81 unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()];
81 unity::shell::scopes::ResultsModelInterface *resultsModel = m_resultsModels[index.row()];
82 if (!resultsModel) {
82 if (!resultsModel) {
83 QObject *that = const_cast<ScopesOverviewCategories*>(this);
83 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();
85 resultsModel = new ScopesOverviewResultsModel(scopes, categoryId, that);
85 resultsModel = new ScopesOverviewResultsModel(scopes, categoryId, that);
86 m_resultsModels[index.row()] = resultsModel;
86 m_resultsModels[index.row()] = resultsModel;
87 }
87 }
@@ -89,7 +89,7 @@ ScopesOverviewCategories::data(const QModelIndex& index, int role) const
89 case RoleCategoryId:
89 case RoleCategoryId:
90 return categoryId;
90 return categoryId;
91 case RoleName:
91 case RoleName:
92− return index.row() == 0 ? "Favorites" : "All";
92+ return index.row() == 0 ? "Favorites" : "Non Favorites";
93 case RoleIcon:
93 case RoleIcon:
94 return QVariant();
94 return QVariant();
95 case RoleRawRendererTemplate:
95 case RoleRawRendererTemplate: