expose some properties of OCC::Activity gadget class
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Mon, 13 Feb 2023 22:07:00 +0000 (23:07 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 17 May 2023 16:16:09 +0000 (18:16 +0200)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/gui/owncloudgui.cpp
src/gui/tray/activitydata.h

index 713fca59fed1d1b72dd23b4b9caf207efdc796f1..370e850e6269d936c0b1bf8a53919fb18a8161e2 100644 (file)
@@ -128,6 +128,7 @@ ownCloudGui::ownCloudGui(Application *parent)
     qmlRegisterType<SortedShareModel>("com.nextcloud.desktopclient", 1, 0, "SortedShareModel");
     qmlRegisterType<SyncConflictsModel>("com.nextcloud.desktopclient", 1, 0, "SyncConflictsModel");
     qmlRegisterUncreatableType<QAbstractItemModel>("com.nextcloud.desktopclient", 1, 0, "QAbstractItemModel", "QAbstractItemModel");
+    qmlRegisterUncreatableType<Activity>("com.nextcloud.desktopclient", 1, 0, "Activity", "Activity");
 
     qmlRegisterUncreatableType<UnifiedSearchResultsListModel>("com.nextcloud.desktopclient", 1, 0, "UnifiedSearchResultsListModel", "UnifiedSearchResultsListModel");
     qmlRegisterUncreatableType<UserStatus>("com.nextcloud.desktopclient", 1, 0, "UserStatus", "Access to Status enum");
index 88a8948d37590ed3ac1f1b6fd4669c8f28834e13..c5517d116167413eba602b84cfc9e9ee383f8349 100644 (file)
@@ -108,6 +108,22 @@ public:
     QString messageId;
     QString messageSent;
     QString userAvatar;
+
+    [[nodiscard]] bool operator==(const TalkNotificationData &other) const
+    {
+        return conversationToken == other.conversationToken &&
+            messageId == other.messageId &&
+            messageSent == other.messageSent &&
+            userAvatar == other.userAvatar;
+    }
+
+    [[nodiscard]] bool operator!=(const TalkNotificationData &other) const
+    {
+        return conversationToken != other.conversationToken ||
+            messageId != other.messageId ||
+            messageSent != other.messageSent ||
+            userAvatar != other.userAvatar;
+    }
 };
 
 /* ==================================================================== */
@@ -120,6 +136,9 @@ public:
 class Activity
 {
     Q_GADGET
+    Q_PROPERTY(OCC::Activity::Type type MEMBER _type)
+    Q_PROPERTY(OCC::TalkNotificationData talkNotificationData MEMBER _talkNotificationData)
+    Q_PROPERTY(QVariantMap subjectRichParameters MEMBER _subjectRichParameters)
 
 public:
     using Identifier = QPair<qlonglong, QString>;