Cleaups based on review feedback.

This commit is contained in:
Klaas Freitag 2016-03-29 14:38:11 +02:00
Родитель 4d59f5ec66
Коммит cacb751ab8
1 изменённых файлов: 4 добавлений и 5 удалений

Просмотреть файл

@ -99,8 +99,7 @@ bool ActivityListModel::canFetchMore(const QModelIndex& ) const
{ {
if( _activityLists.count() == 0 ) return true; if( _activityLists.count() == 0 ) return true;
QMap<AccountState*, ActivityList>::const_iterator i = _activityLists.begin(); for(auto i = _activityLists.begin() ; i != _activityLists.end(); ++i) {
while (i != _activityLists.end()) {
AccountState *ast = i.key(); AccountState *ast = i.key();
if( ast && ast->isConnected() ) { if( ast && ast->isConnected() ) {
ActivityList activities = i.value(); ActivityList activities = i.value();
@ -176,9 +175,9 @@ void ActivityListModel::combineActivityLists()
std::sort( resultList.begin(), resultList.end() ); std::sort( resultList.begin(), resultList.end() );
beginRemoveRows(QModelIndex(), 0, _finalList.count() ); beginResetModel();
_finalList.clear(); _finalList.clear();
endRemoveRows(); endResetModel();
beginInsertRows(QModelIndex(), 0, resultList.count()); beginInsertRows(QModelIndex(), 0, resultList.count());
_finalList = resultList; _finalList = resultList;
@ -189,7 +188,7 @@ void ActivityListModel::fetchMore(const QModelIndex &)
{ {
QList<AccountStatePtr> accounts = AccountManager::instance()->accounts(); QList<AccountStatePtr> accounts = AccountManager::instance()->accounts();
foreach (AccountStatePtr asp, accounts) { foreach (const AccountStatePtr& asp, accounts) {
if( !_activityLists.contains(asp.data()) && asp->isConnected() ) { if( !_activityLists.contains(asp.data()) && asp->isConnected() ) {
_activityLists[asp.data()] = ActivityList(); _activityLists[asp.data()] = ActivityList();