mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Adds notifications to the Activities list.
Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
parent
30a4f1edd7
commit
908870ccde
4 changed files with 27 additions and 0 deletions
|
@ -46,6 +46,8 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
a = _finalList.at(index.row());
|
a = _finalList.at(index.row());
|
||||||
|
qDebug() << "Adding activity/notification: " << a._subject;
|
||||||
|
qDebug() << "Adding activity/notification: " << a._message;
|
||||||
AccountStatePtr ast = AccountManager::instance()->account(a._accName);
|
AccountStatePtr ast = AccountManager::instance()->account(a._accName);
|
||||||
if (!ast)
|
if (!ast)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
@ -173,6 +175,25 @@ void ActivityListModel::slotActivitiesReceived(const QJsonDocument &json, int st
|
||||||
combineActivityLists();
|
combineActivityLists();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActivityListModel::addToActivityList(AccountState *ast, ActivityList list) {
|
||||||
|
_activityLists[ast].append(list);
|
||||||
|
//endInsertRows();
|
||||||
|
ActivityList resultList;
|
||||||
|
|
||||||
|
foreach (ActivityList list, _activityLists.values()) {
|
||||||
|
resultList.append(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::sort(resultList.begin(), resultList.end());
|
||||||
|
|
||||||
|
beginResetModel();
|
||||||
|
_finalList.clear();
|
||||||
|
endResetModel();
|
||||||
|
|
||||||
|
beginInsertRows(QModelIndex(), 0, resultList.count());
|
||||||
|
_finalList = resultList;
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
void ActivityListModel::combineActivityLists()
|
void ActivityListModel::combineActivityLists()
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,6 +47,7 @@ public:
|
||||||
void fetchMore(const QModelIndex &) Q_DECL_OVERRIDE;
|
void fetchMore(const QModelIndex &) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
ActivityList activityList() { return _finalList; }
|
ActivityList activityList() { return _finalList; }
|
||||||
|
void addToActivityList(AccountState *ast, ActivityList list);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotRefreshActivity(AccountState *ast);
|
void slotRefreshActivity(AccountState *ast);
|
||||||
|
|
|
@ -314,8 +314,12 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList &list)
|
||||||
emit guiLog(activity._subject, activity._accName);
|
emit guiLog(activity._subject, activity._accName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_newNotifications.append(activity);
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
//_model->addToActivityList(AccountManager::instance()->account(listAccountName).data(), _newNotifications);
|
||||||
|
_model->addToActivityList(AccountManager::instance()->account(listAccountName).data(), list);
|
||||||
|
|
||||||
// check if there are widgets that have no corresponding activity from
|
// check if there are widgets that have no corresponding activity from
|
||||||
// the server any more. Collect them in a list
|
// the server any more. Collect them in a list
|
||||||
|
|
|
@ -105,6 +105,7 @@ private:
|
||||||
QMap<Activity::Identifier, NotificationWidget *> _widgetForNotifId;
|
QMap<Activity::Identifier, NotificationWidget *> _widgetForNotifId;
|
||||||
QElapsedTimer _guiLogTimer;
|
QElapsedTimer _guiLogTimer;
|
||||||
QSet<int> _guiLoggedNotifications;
|
QSet<int> _guiLoggedNotifications;
|
||||||
|
ActivityList _newNotifications;
|
||||||
ActivityList _blacklistedNotifications;
|
ActivityList _blacklistedNotifications;
|
||||||
|
|
||||||
QHash<NotificationWidget *, QDateTime> _widgetsToRemove;
|
QHash<NotificationWidget *, QDateTime> _widgetsToRemove;
|
||||||
|
|
Loading…
Reference in a new issue