165
165
return m_scopesOverview;
168
QList<Scope*> Scopes::scopes() const
168
void Scopes::setFavorite(const QString& scopeId, bool favorite)
171
for (Scope *scope : m_scopes) {
172
// Check it's not already there
173
Q_ASSERT(scope->id() != scopeId);
175
for (Scope *scope : m_allScopes) {
176
if (scope->id() == scopeId) {
177
const int index = rowCount();
178
beginInsertRows(QModelIndex(), index, index);
181
m_scopesOverview->setFavorite(scope, true);
185
Q_ASSERT(false && "Unknown scopeId");
187
for (Scope *scope : m_scopes) {
188
if (scope->id() == scopeId) {
189
const int index = m_scopes.indexOf(scope);
190
beginRemoveRows(QModelIndex(), index, index);
191
m_scopes.removeAt(index);
193
m_scopesOverview->setFavorite(scope, false);
197
Q_ASSERT(false && "Unknown scopeId");
201
void Scopes::moveFavoriteTo(const QString& scopeId, int to)
204
for (int i = 0; i < m_scopes.count(); ++i) {
205
if (m_scopes[i]->id() == scopeId) {
210
Q_ASSERT(from != -1);
211
beginMoveRows(QModelIndex(), from, from, QModelIndex(), to + (to > from ? 1 : 0));
212
m_scopes.move(from, to);
214
m_scopesOverview->moveFavoriteTo(m_scopes[to], to);
217
QList<Scope*> Scopes::favScopes() const
173
QList<Scope*> Scopes::allScopes() const
222
QList<Scope*> Scopes::nonFavScopes() const
225
for (Scope *scope : m_allScopes) {
226
if (!m_scopes.contains(scope))
178
232
void Scopes::addScope(Scope* scope)