mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
ActivityWidget: Detect new items in the list to refetch the activities.
On refresh, remove the activity list object from the models list.
This commit is contained in:
parent
1cdf0e8597
commit
c9ef4d5fa0
@ -204,13 +204,14 @@ void ActivityListModel::fetchMore(const QModelIndex &)
|
||||
QList<AccountStatePtr> accounts = AccountManager::instance()->accounts();
|
||||
|
||||
foreach (AccountStatePtr asp, accounts) {
|
||||
|
||||
bool newItem = false;
|
||||
// if the account is not yet managed, add an empty list.
|
||||
if( !_activityLists.contains(asp.data()) ) {
|
||||
_activityLists[asp.data()] = ActivityList();
|
||||
newItem = true;
|
||||
}
|
||||
ActivityList activities = _activityLists[asp.data()];
|
||||
if( activities.count() == 0 ) {
|
||||
if( newItem ) {
|
||||
startFetchJob(asp.data());
|
||||
}
|
||||
}
|
||||
@ -220,7 +221,7 @@ void ActivityListModel::slotRefreshActivity(AccountState *ast)
|
||||
{
|
||||
if(ast && _activityLists.contains(ast)) {
|
||||
qDebug() << "**** Refreshing Activity list for" << ast->account()->displayName();
|
||||
_activityLists[ast].clear();
|
||||
_activityLists.remove(ast);
|
||||
}
|
||||
startFetchJob(ast);
|
||||
}
|
||||
|
||||
@ -76,7 +76,6 @@ public:
|
||||
*/
|
||||
class ActivityList:public QList<Activity>
|
||||
{
|
||||
// explicit ActivityList();
|
||||
public:
|
||||
void setAccountName( const QString& name );
|
||||
QString accountName() const;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user