10#include <QMimeDatabase>
15#include "private/protocol_p.h"
23class NotificationManager;
25class NotificationSubscriber :
public QObject
30 explicit NotificationSubscriber(NotificationManager *manager, quintptr socketDescriptor);
31 ~NotificationSubscriber()
override;
33 [[nodiscard]]
inline QByteArray subscriber()
const
38 [[nodiscard]] QLocalSocket *socket()
const
43 void handleIncomingData();
46 bool notify(
const Akonadi::Protocol::ChangeNotificationPtr ¬ification);
49 void socketDisconnected();
52 void notificationDebuggingChanged(
bool enabled);
55 void registerSubscriber(
const Protocol::CreateSubscriptionCommand &command);
56 void modifySubscription(
const Protocol::ModifySubscriptionCommand &command);
57 void disconnectSubscriber();
60 bool acceptsNotification(
const Protocol::ChangeNotification ¬ification)
const;
61 bool acceptsItemNotification(
const Protocol::ItemChangeNotification ¬ification)
const;
62 bool acceptsCollectionNotification(
const Protocol::CollectionChangeNotification ¬ification)
const;
63 bool acceptsTagNotification(
const Protocol::TagChangeNotification ¬ification)
const;
64 bool acceptsSubscriptionNotification(
const Protocol::SubscriptionChangeNotification ¬ification)
const;
65 bool acceptsDebugChangeNotification(
const Protocol::DebugChangeNotification ¬ification)
const;
67 bool isCollectionMonitored(Entity::Id
id)
const;
68 bool isMimeTypeMonitored(
const QString &mimeType)
const;
69 bool isMoveDestinationResourceMonitored(
const Protocol::ItemChangeNotification &msg)
const;
70 bool isMoveDestinationResourceMonitored(
const Protocol::CollectionChangeNotification &msg)
const;
72 Protocol::SubscriptionChangeNotificationPtr toChangeNotification()
const;
75 virtual void writeNotification(
const Akonadi::Protocol::ChangeNotificationPtr ¬ification);
78 explicit NotificationSubscriber(NotificationManager *manager =
nullptr);
80 void writeCommand(qint64 tag,
const Protocol::CommandPtr &cmd);
83 NotificationManager *mManager =
nullptr;
84 QLocalSocket *mSocket =
nullptr;
85 QByteArray mSubscriber;
86 QSet<Entity::Id> mMonitoredCollections;
87 QSet<Entity::Id> mMonitoredItems;
88 QSet<Entity::Id> mMonitoredTags;
89 QSet<Protocol::ModifySubscriptionCommand::ChangeType> mMonitoredTypes;
90 QSet<QString> mMonitoredMimeTypes;
91 QSet<QByteArray> mMonitoredResources;
92 QSet<QByteArray> mIgnoredSessions;
94 Protocol::ItemFetchScope mItemFetchScope;
95 Protocol::CollectionFetchScope mCollectionFetchScope;
96 Protocol::TagFetchScope mTagFetchScope;
99 bool mNotificationDebugging;
Helper integration between Akonadi and Qt.