@@ -73,7 +73,8 @@ void Scopes::clear()
73 timer.stop();
73 timer.stop();
74 if (m_scopes.size() > 0) {
74 if (m_scopes.size() > 0) {
75 beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1);
75 beginRemoveRows(QModelIndex(), 0, m_scopes.count()-1);
76− qDeleteAll(m_scopes);
76+ qDeleteAll(m_allScopes);
77 m_scopes.clear();
78 m_scopes.clear();
78 endRemoveRows();
79 endRemoveRows();
@@ -126,17 +127,17 @@ unity::shell::scopes::ScopeInterface* Scopes::getScope(int row) const
127unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const &scope_id) const
128unity::shell::scopes::ScopeInterface* Scopes::getScope(QString const &scope_id) const
130+ // According to mh3 Scopes::getScope should only return favorite scopes (i.e the ones in the model)
129 for (Scope *scope : m_scopes) {
131 for (Scope *scope : m_scopes) {
130− // According to mh3 Scopes::getScope should only return non null for visible scopes
131− if (scope->id() == scope_id && scope->visible())
132+ if (scope->id() == scope_id)
132 return scope;
133 return scope;
134 return nullptr;
135 return nullptr;
137−unity::shell::scopes::ScopeInterface* Scopes::getScopeFromAll(const QString& scope_id) const
138+Scope* Scopes::getScopeFromAll(const QString& scope_id) const
139− for (Scope *scope : m_scopes) {
140+ for (Scope *scope : m_allScopes) {
140 if (scope->id() == scope_id)
141 if (scope->id() == scope_id)
141 return scope;
142 return scope;
@@ -163,21 +164,23 @@ unity::shell::scopes::ScopeInterface* Scopes::overviewScope() const
163 return m_scopesOverview;
164 return m_scopesOverview;
166−QList<unity::shell::scopes::ScopeInterface *> Scopes::scopes(bool onlyVisible) const
167+QList<Scope*> Scopes::scopes() const
168− QList<unity::shell::scopes::ScopeInterface *> res;
169+ return m_scopes;
169− for (Scope *scope : m_scopes) {
170+}
170− if (!onlyVisible || scope->visible()) {
171+
171− res << scope;
172+QList<Scope*> Scopes::allScopes() const
174− return res;
174+ return m_allScopes;
177void Scopes::addScope(Scope* scope)
177void Scopes::addScope(Scope* scope)
179 int index = rowCount();
179 int index = rowCount();
180+ if (scope->favorite()) {
180− beginInsertRows(QModelIndex(), index, index);
181+ beginInsertRows(QModelIndex(), index, index);
181− m_scopes.append(scope);
182+ m_scopes.append(scope);
182− endInsertRows();
183+ endInsertRows();
185+ m_allScopes.append(scope);