File indexing completed on 2024-11-10 04:40:43
0001 /* 0002 SPDX-FileCopyrightText: 2016 Daniel Vrátil <dvratil@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "notificationsubscriber.h" 0008 #include "collectionfetchscope.h" 0009 #include "itemfetchscope.h" 0010 #include "tagfetchscope.h" 0011 0012 namespace Akonadi 0013 { 0014 class NotificationSubscriberPrivate : public QSharedData 0015 { 0016 public: 0017 QByteArray subscriber; 0018 QByteArray sessionId; 0019 QSet<qint64> collections; 0020 QSet<qint64> items; 0021 QSet<qint64> tags; 0022 QSet<Monitor::Type> types; 0023 QSet<QString> mimeTypes; 0024 QSet<QByteArray> resources; 0025 QSet<QByteArray> ignoredSessions; 0026 ItemFetchScope itemFetchScope; 0027 CollectionFetchScope collectionFetchScope; 0028 TagFetchScope tagFetchScope; 0029 bool isAllMonitored = false; 0030 bool isExclusive = false; 0031 }; 0032 0033 } // namespace Akonadi 0034 0035 using namespace Akonadi; 0036 0037 NotificationSubscriber::NotificationSubscriber() 0038 : d(new NotificationSubscriberPrivate) 0039 { 0040 } 0041 0042 NotificationSubscriber::NotificationSubscriber(const NotificationSubscriber &other) 0043 : d(other.d) 0044 { 0045 } 0046 0047 NotificationSubscriber::~NotificationSubscriber() 0048 { 0049 } 0050 0051 NotificationSubscriber &NotificationSubscriber::operator=(const NotificationSubscriber &other) 0052 { 0053 d = other.d; 0054 return *this; 0055 } 0056 0057 bool NotificationSubscriber::isValid() const 0058 { 0059 return !d->subscriber.isEmpty(); 0060 } 0061 0062 QByteArray NotificationSubscriber::subscriber() const 0063 { 0064 return d->subscriber; 0065 } 0066 0067 void NotificationSubscriber::setSubscriber(const QByteArray &subscriber) 0068 { 0069 d->subscriber = subscriber; 0070 } 0071 0072 QByteArray NotificationSubscriber::sessionId() const 0073 { 0074 return d->sessionId; 0075 } 0076 0077 void NotificationSubscriber::setSessionId(const QByteArray &sessionId) 0078 { 0079 d->sessionId = sessionId; 0080 } 0081 0082 QSet<qint64> NotificationSubscriber::monitoredCollections() const 0083 { 0084 return d->collections; 0085 } 0086 0087 void NotificationSubscriber::setMonitoredCollections(const QSet<qint64> &collections) 0088 { 0089 d->collections = collections; 0090 } 0091 0092 QSet<qint64> NotificationSubscriber::monitoredItems() const 0093 { 0094 return d->items; 0095 } 0096 0097 void NotificationSubscriber::setMonitoredItems(const QSet<qint64> &items) 0098 { 0099 d->items = items; 0100 } 0101 0102 QSet<qint64> NotificationSubscriber::monitoredTags() const 0103 { 0104 return d->tags; 0105 } 0106 0107 void NotificationSubscriber::setMonitoredTags(const QSet<qint64> &tags) 0108 { 0109 d->tags = tags; 0110 } 0111 0112 QSet<Monitor::Type> NotificationSubscriber::monitoredTypes() const 0113 { 0114 return d->types; 0115 } 0116 0117 void NotificationSubscriber::setMonitoredTypes(const QSet<Monitor::Type> &types) 0118 { 0119 d->types = types; 0120 } 0121 0122 QSet<QString> NotificationSubscriber::monitoredMimeTypes() const 0123 { 0124 return d->mimeTypes; 0125 } 0126 0127 void NotificationSubscriber::setMonitoredMimeTypes(const QSet<QString> &mimeTypes) 0128 { 0129 d->mimeTypes = mimeTypes; 0130 } 0131 0132 QSet<QByteArray> NotificationSubscriber::monitoredResources() const 0133 { 0134 return d->resources; 0135 } 0136 0137 void NotificationSubscriber::setMonitoredResources(const QSet<QByteArray> &resources) 0138 { 0139 d->resources = resources; 0140 } 0141 0142 QSet<QByteArray> NotificationSubscriber::ignoredSessions() const 0143 { 0144 return d->ignoredSessions; 0145 } 0146 0147 void NotificationSubscriber::setIgnoredSessions(const QSet<QByteArray> &ignoredSessions) 0148 { 0149 d->ignoredSessions = ignoredSessions; 0150 } 0151 0152 bool NotificationSubscriber::isAllMonitored() const 0153 { 0154 return d->isAllMonitored; 0155 } 0156 0157 void NotificationSubscriber::setIsAllMonitored(bool isAllMonitored) 0158 { 0159 d->isAllMonitored = isAllMonitored; 0160 } 0161 0162 bool NotificationSubscriber::isExclusive() const 0163 { 0164 return d->isExclusive; 0165 } 0166 0167 void NotificationSubscriber::setIsExclusive(bool isExclusive) 0168 { 0169 d->isExclusive = isExclusive; 0170 } 0171 0172 ItemFetchScope NotificationSubscriber::itemFetchScope() const 0173 { 0174 return d->itemFetchScope; 0175 } 0176 0177 void NotificationSubscriber::setItemFetchScope(const ItemFetchScope &itemFetchScope) 0178 { 0179 d->itemFetchScope = itemFetchScope; 0180 } 0181 0182 CollectionFetchScope NotificationSubscriber::collectionFetchScope() const 0183 { 0184 return d->collectionFetchScope; 0185 } 0186 0187 void NotificationSubscriber::setCollectionFetchScope(const CollectionFetchScope &fetchScope) 0188 { 0189 d->collectionFetchScope = fetchScope; 0190 } 0191 0192 TagFetchScope NotificationSubscriber::tagFetchScope() const 0193 { 0194 return d->tagFetchScope; 0195 } 0196 0197 void NotificationSubscriber::setTagFetchScope(const TagFetchScope &tagFetchScope) 0198 { 0199 d->tagFetchScope = tagFetchScope; 0200 }