Akonadi

core/notificationsubscriber.cpp
1 /*
2  Copyright (c) 2016 Daniel Vrátil <[email protected]>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #include "notificationsubscriber.h"
21 #include "itemfetchscope.h"
22 #include "collectionfetchscope.h"
23 #include "tagfetchscope.h"
24 
25 namespace Akonadi
26 {
27 class AKONADICORE_NO_EXPORT NotificationSubscriber::Private : public QSharedData
28 {
29 public:
30  explicit Private()
31  : QSharedData()
32  , isAllMonitored(false)
33  , isExclusive(false)
34  {}
35 
36  Private(const Private &other)
37  : QSharedData(other)
38  , subscriber(other.subscriber)
39  , sessionId(other.sessionId)
40  , collections(other.collections)
41  , items(other.items)
42  , tags(other.tags)
43  , types(other.types)
44  , mimeTypes(other.mimeTypes)
45  , resources(other.resources)
46  , ignoredSessions(other.ignoredSessions)
47  , itemFetchScope(other.itemFetchScope)
48  , collectionFetchScope(other.collectionFetchScope)
49  , tagFetchScope(other.tagFetchScope)
50  , isAllMonitored(other.isAllMonitored)
51  , isExclusive(other.isExclusive)
52  {}
53 
54  QByteArray subscriber;
55  QByteArray sessionId;
56  QSet<qint64> collections;
57  QSet<qint64> items;
58  QSet<qint64> tags;
61  QSet<QByteArray> resources;
62  QSet<QByteArray> ignoredSessions;
63  ItemFetchScope itemFetchScope;
64  CollectionFetchScope collectionFetchScope;
65  TagFetchScope tagFetchScope;
66  bool isAllMonitored;
67  bool isExclusive;
68 };
69 
70 }
71 
72 using namespace Akonadi;
73 
74 NotificationSubscriber::NotificationSubscriber()
75  : d(new Private)
76 {
77 }
78 
79 NotificationSubscriber::NotificationSubscriber(const NotificationSubscriber &other)
80  : d(other.d)
81 {
82 }
83 
84 NotificationSubscriber::~NotificationSubscriber()
85 {
86 }
87 
88 NotificationSubscriber &NotificationSubscriber::operator=(const NotificationSubscriber &other)
89 {
90  d = other.d;
91  return *this;
92 }
93 
94 bool NotificationSubscriber::isValid() const
95 {
96  return !d->subscriber.isEmpty();
97 }
98 
99 QByteArray NotificationSubscriber::subscriber() const
100 {
101  return d->subscriber;
102 }
103 
104 void NotificationSubscriber::setSubscriber(const QByteArray &subscriber)
105 {
106  d->subscriber = subscriber;
107 }
108 
109 QByteArray NotificationSubscriber::sessionId() const
110 {
111  return d->sessionId;
112 }
113 
114 void NotificationSubscriber::setSessionId(const QByteArray &sessionId)
115 {
116  d->sessionId = sessionId;
117 }
118 
119 QSet<qint64> NotificationSubscriber::monitoredCollections() const
120 {
121  return d->collections;
122 }
123 
124 void NotificationSubscriber::setMonitoredCollections(const QSet<qint64> &collections)
125 {
126  d->collections = collections;
127 }
128 
129 QSet<qint64> NotificationSubscriber::monitoredItems() const
130 {
131  return d->items;
132 }
133 
134 void NotificationSubscriber::setMonitoredItems(const QSet<qint64> &items)
135 {
136  d->items = items;
137 }
138 
139 QSet<qint64> NotificationSubscriber::monitoredTags() const
140 {
141  return d->tags;
142 }
143 
144 void NotificationSubscriber::setMonitoredTags(const QSet<qint64> &tags)
145 {
146  d->tags = tags;
147 }
148 
149 QSet<Monitor::Type> NotificationSubscriber::monitoredTypes() const
150 {
151  return d->types;
152 }
153 
154 void NotificationSubscriber::setMonitoredTypes(const QSet<Monitor::Type> &types)
155 {
156  d->types = types;
157 }
158 
159 QSet<QString> NotificationSubscriber::monitoredMimeTypes() const
160 {
161  return d->mimeTypes;
162 }
163 
164 void NotificationSubscriber::setMonitoredMimeTypes(const QSet<QString> &mimeTypes)
165 {
166  d->mimeTypes = mimeTypes;
167 }
168 
169 QSet<QByteArray> NotificationSubscriber::monitoredResources() const
170 {
171  return d->resources;
172 }
173 
174 void NotificationSubscriber::setMonitoredResources(const QSet<QByteArray> &resources)
175 {
176  d->resources = resources;
177 }
178 
179 QSet<QByteArray> NotificationSubscriber::ignoredSessions() const
180 {
181  return d->ignoredSessions;
182 }
183 
184 void NotificationSubscriber::setIgnoredSessions(const QSet<QByteArray> &ignoredSessions)
185 {
186  d->ignoredSessions = ignoredSessions;
187 }
188 
189 bool NotificationSubscriber::isAllMonitored() const
190 {
191  return d->isAllMonitored;
192 }
193 
194 void NotificationSubscriber::setIsAllMonitored(bool isAllMonitored)
195 {
196  d->isAllMonitored = isAllMonitored;
197 }
198 
199 bool NotificationSubscriber::isExclusive() const
200 {
201  return d->isExclusive;
202 }
203 
204 void NotificationSubscriber::setIsExclusive(bool isExclusive)
205 {
206  d->isExclusive = isExclusive;
207 }
208 
209 ItemFetchScope NotificationSubscriber::itemFetchScope() const
210 {
211  return d->itemFetchScope;
212 }
213 
214 void NotificationSubscriber::setItemFetchScope(const ItemFetchScope &itemFetchScope)
215 {
216  d->itemFetchScope = itemFetchScope;
217 }
218 
219 CollectionFetchScope NotificationSubscriber::collectionFetchScope() const
220 {
221  return d->collectionFetchScope;
222 }
223 
224 void NotificationSubscriber::setCollectionFetchScope(const CollectionFetchScope &fetchScope)
225 {
226  d->collectionFetchScope = fetchScope;
227 }
228 
229 TagFetchScope NotificationSubscriber::tagFetchScope() const
230 {
231  return d->tagFetchScope;
232 }
233 
234 void NotificationSubscriber::setTagFetchScope(const TagFetchScope &tagFetchScope)
235 {
236  d->tagFetchScope = tagFetchScope;
237 }
Specifies which parts of a collection should be fetched from the Akonadi storage. ...
Specifies which parts of a tag should be fetched from the Akonadi storage.
Definition: tagfetchscope.h:35
QStringList mimeTypes(Types)
Specifies which parts of an item should be fetched from the Akonadi storage.
Helper integration between Akonadi and Qt.
Types types(const QStringList &mimeTypes)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 23:08:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.