From b600ac882a7dad0ce7631c46bf292a67ecfdbb2c Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Mon, 2 Nov 2015 17:52:04 +0100 Subject: [PATCH] ActivityListModel: Add method to refresh one Account (WIP) --- src/gui/activitywidget.cpp | 11 +++++++++++ src/gui/activitywidget.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp index 3c20a95a5..ada65d062 100644 --- a/src/gui/activitywidget.cpp +++ b/src/gui/activitywidget.cpp @@ -145,6 +145,7 @@ void ActivityListModel::slotActivitiesReceived(const QVariantMap& json) _activityLists[ai] = list; // if all activity lists were received, assemble the whole list + // otherwise wait until the others are finished bool allAreHere = true; foreach( ActivityList list, _activityLists.values() ) { if( list.count() == 0 ) { @@ -152,6 +153,8 @@ void ActivityListModel::slotActivitiesReceived(const QVariantMap& json) break; } } + + // FIXME: Be more efficient, if( allAreHere ) { combineActivityLists(); } @@ -190,6 +193,14 @@ void ActivityListModel::fetchMore(const QModelIndex &) } } +void ActivityListModel::slotRefreshActivity(AccountStatePtr ast) +{ + if(ast && _activityLists.contains(ast)) { + _activityLists[ast].clear(); + } + startFetchJob(ast); +} + /* ==================================================================== */ ActivityWidget::ActivityWidget(QWidget *parent) : diff --git a/src/gui/activitywidget.h b/src/gui/activitywidget.h index 034dc3362..266b13791 100644 --- a/src/gui/activitywidget.h +++ b/src/gui/activitywidget.h @@ -88,6 +88,9 @@ public: bool canFetchMore(const QModelIndex& ) const; void fetchMore(const QModelIndex&); +public slots: + void slotRefreshActivity(AccountStatePtr ast); + private slots: void slotActivitiesReceived(const QVariantMap& json);