diff options
author | Klaas Freitag <freitag@owncloud.com> | 2016-03-04 19:41:57 +0300 |
---|---|---|
committer | Klaas Freitag <freitag@owncloud.com> | 2016-03-10 19:46:00 +0300 |
commit | 32e16b323c24f4b90da8cf31831a1b875675b676 (patch) | |
tree | e46b47cb6c1250a3f243ad736559684de7e000b1 /src/gui/activitywidget.h | |
parent | 688c5502a86e50a5ab6134a2987da17f7f741e90 (diff) |
Display server notifications on the client (#3733)
As interaction is required, the notifications are displayed in a
separate widget above the server activity list.
Note that design and also where we display the notifications can
still be discussed and changed.
Diffstat (limited to 'src/gui/activitywidget.h')
-rw-r--r-- | src/gui/activitywidget.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/gui/activitywidget.h b/src/gui/activitywidget.h index c3ba5cab5..c27724cdb 100644 --- a/src/gui/activitywidget.h +++ b/src/gui/activitywidget.h @@ -33,6 +33,8 @@ namespace OCC { class Account; class AccountStatusPtr; class ProtocolWidget; +class JsonApiJob; +class NotificationWidget; namespace Ui { class ActivityWidget; @@ -40,6 +42,23 @@ namespace Ui { class Application; /** + * @brief The ActivityLink class describes actions of an activity + * + * These are part of notifications which are mapped into activities. + */ + +class ActivityLink +{ +public: + QHash <QString, QVariant> toVariantHash(); + + QString _label; + QString _link; + QString _verb; + bool _isPrimary; +}; + +/** * @brief Activity Structure * @ingroup gui * @@ -49,6 +68,11 @@ class Application; class Activity { public: + enum Type { + ActivityType, + NotificationType + }; + Type _type; qlonglong _id; QString _subject; QString _message; @@ -57,6 +81,7 @@ public: QDateTime _dateTime; QString _accName; + QVector <ActivityLink> _links; /** * @brief Sort operator to sort the list youngest first. * @param val @@ -146,12 +171,21 @@ public slots: void slotRefresh(AccountState* ptr); void slotRemoveAccount( AccountState *ptr ); void slotAccountActivityStatus(AccountState *ast, int statusCode); + void slotFetchNotifications(AccountState *ptr); signals: void guiLog(const QString&, const QString&); void copyToClipboard(); void rowsInserted(); void hideAcitivityTab(bool); + void newNotificationList(const ActivityList& list); + +private slots: + void slotNotificationsReceived(const QVariantMap& json, int statusCode); + void slotBuildNotificationDisplay(const ActivityList& list); + void slotSendNotificationRequest(const QString &accountName, const QString& link, const QString& verb); + void slotNotifyNetworkError( QNetworkReply* ); + void slotNotifyServerFinished( const QString& reply, int replyCode ); private: void showLabels(); @@ -160,8 +194,10 @@ private: QPushButton *_copyBtn; QSet<QString> _accountsWithoutActivities; - + QMap<int, NotificationWidget*> _widgetForNotifId; + QPointer<JsonApiJob> _notificationJob; ActivityListModel *_model; + QVBoxLayout *_notificationsLayout; }; |