From cacb751ab873e05091af7650bf4d6d93bd86924a Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Tue, 29 Mar 2016 14:38:11 +0200 Subject: [PATCH] Cleaups based on review feedback. --- src/gui/activitylistmodel.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/activitylistmodel.cpp b/src/gui/activitylistmodel.cpp index 07e0ba30d..ac27db191 100644 --- a/src/gui/activitylistmodel.cpp +++ b/src/gui/activitylistmodel.cpp @@ -99,8 +99,7 @@ bool ActivityListModel::canFetchMore(const QModelIndex& ) const { if( _activityLists.count() == 0 ) return true; - QMap::const_iterator i = _activityLists.begin(); - while (i != _activityLists.end()) { + for(auto i = _activityLists.begin() ; i != _activityLists.end(); ++i) { AccountState *ast = i.key(); if( ast && ast->isConnected() ) { ActivityList activities = i.value(); @@ -176,9 +175,9 @@ void ActivityListModel::combineActivityLists() std::sort( resultList.begin(), resultList.end() ); - beginRemoveRows(QModelIndex(), 0, _finalList.count() ); + beginResetModel(); _finalList.clear(); - endRemoveRows(); + endResetModel(); beginInsertRows(QModelIndex(), 0, resultList.count()); _finalList = resultList; @@ -189,7 +188,7 @@ void ActivityListModel::fetchMore(const QModelIndex &) { QList accounts = AccountManager::instance()->accounts(); - foreach (AccountStatePtr asp, accounts) { + foreach (const AccountStatePtr& asp, accounts) { if( !_activityLists.contains(asp.data()) && asp->isConnected() ) { _activityLists[asp.data()] = ActivityList();