@@ -198,20 +198,20 @@ void Scopes::setFavorite(const QString& scopeId, bool favorite)
198198 }
199199}
200200
201−void Scopes::moveFavoriteTo(const QString& scopeId, int index)
201+void Scopes::moveFavoriteTo(const QString& scopeId, int to)
202202{
203− int origIndex = -1;
203+ int from = -1;
204204 for (int i = 0; i < m_scopes.count(); ++i) {
205205 if (m_scopes[i]->id() == scopeId) {
206− origIndex = i;
206+ from = i;
207207 break;
208208 }
209209 }
210− Q_ASSERT(origIndex != -1);
211− beginMoveRows(QModelIndex(), origIndex, origIndex, QModelIndex(), index);
212− m_scopes.move(origIndex, index);
210+ Q_ASSERT(from != -1);
211+ beginMoveRows(QModelIndex(), from, from, QModelIndex(), to + (to > from ? 1 : 0));
212+ m_scopes.move(from, to);
213213 endMoveRows();
214− m_scopesOverview->moveFavoriteTo(m_scopes[index], index);
214+ m_scopesOverview->moveFavoriteTo(m_scopes[to], to);
215215}
216216
217217QList<Scope*> Scopes::favScopes() const