ActivityListModel: Add method to refresh one Account (WIP)

This commit is contained in:
Klaas Freitag 2015-11-02 17:52:04 +01:00
parent 71849c4372
commit b600ac882a
2 changed files with 14 additions and 0 deletions

View file

@ -145,6 +145,7 @@ void ActivityListModel::slotActivitiesReceived(const QVariantMap& json)
_activityLists[ai] = list; _activityLists[ai] = list;
// if all activity lists were received, assemble the whole list // if all activity lists were received, assemble the whole list
// otherwise wait until the others are finished
bool allAreHere = true; bool allAreHere = true;
foreach( ActivityList list, _activityLists.values() ) { foreach( ActivityList list, _activityLists.values() ) {
if( list.count() == 0 ) { if( list.count() == 0 ) {
@ -152,6 +153,8 @@ void ActivityListModel::slotActivitiesReceived(const QVariantMap& json)
break; break;
} }
} }
// FIXME: Be more efficient,
if( allAreHere ) { if( allAreHere ) {
combineActivityLists(); 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) : ActivityWidget::ActivityWidget(QWidget *parent) :

View file

@ -88,6 +88,9 @@ public:
bool canFetchMore(const QModelIndex& ) const; bool canFetchMore(const QModelIndex& ) const;
void fetchMore(const QModelIndex&); void fetchMore(const QModelIndex&);
public slots:
void slotRefreshActivity(AccountStatePtr ast);
private slots: private slots:
void slotActivitiesReceived(const QVariantMap& json); void slotActivitiesReceived(const QVariantMap& json);