1 /*
2 SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org>
3 SPDX-FileCopyrightText: 2015 Daniel Vrátil <dvratil@redhat.com>
4 SPDX-FileCopyrightText: 2016 Daniel Vrátil <dvratil@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8
9 #pragma once
10
11 #include "akonadiprivate_export.h"
12
13 #include <QByteArray>
14 #include <QDateTime>
15 #include <QDebug>
16 #include <QJsonObject>
17 #include <QSharedPointer>
18 #include <QVector>
19
20 #include "scope_p.h"
21 #include "tristate_p.h"
22
23 // clazy:excludeall=function-args-by-value
24
25 /**
26 @file protocol_p.h Shared constants used in the communication protocol between
27 the Akonadi server and its clients.
28 */
29
30 namespace Akonadi
31 {
32 namespace Protocol
33 {
34 class Factory;
35 class DataStream;
36
37 class Command;
38 class Response;
39 class ItemFetchScope;
40 class ScopeContext;
41 class ChangeNotification;
42
43 using Attributes = QMap<QByteArray, QByteArray>;
44
45 } // namespace Protocol
46 } // namespace Akonadi
47
48 namespace Akonadi
49 {
50 namespace Protocol
51 {
52 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::Command &cmd);
53 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::Command &cmd);
54 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::Command &cmd);
55
56 AKONADIPRIVATE_EXPORT void toJson(const Command *cmd, QJsonObject &json);
57
58 using CommandPtr = QSharedPointer<Command>;
59
60 class AKONADIPRIVATE_EXPORT Command
61 {
62 public:
63 enum Type : quint8 {
64 Invalid = 0,
65
66 // Session management
67 Hello = 1,
68 Login,
69 Logout,
70
71 // Transactions
72 Transaction = 10,
73
74 // Items
75 CreateItem = 20,
76 CopyItems,
77 DeleteItems,
78 FetchItems,
79 LinkItems,
80 ModifyItems,
81 MoveItems,
82
83 // Collections
84 CreateCollection = 40,
85 CopyCollection,
86 DeleteCollection,
87 FetchCollections,
88 FetchCollectionStats,
89 ModifyCollection,
90 MoveCollection,
91
92 // Search
93 Search = 60,
94 SearchResult,
95 StoreSearch,
96
97 // Tag
98 CreateTag = 70,
99 DeleteTag,
100 FetchTags,
101 ModifyTag,
102
103 // Relation
104 FetchRelations = 80,
105 ModifyRelation,
106 RemoveRelations,
107
108 // Resources
109 SelectResource = 90,
110
111 // Other
112 StreamPayload = 100,
113
114 // Notifications
115 ItemChangeNotification = 110,
116 CollectionChangeNotification,
117 TagChangeNotification,
118 RelationChangeNotification,
119 SubscriptionChangeNotification,
120 DebugChangeNotification,
121 CreateSubscription,
122 ModifySubscription,
123
124 // _MaxValue = 127
125 _ResponseBit = 0x80U // reserved
126 };
127
128 explicit Command() = default;
129 explicit Command(const Command &) = default;
130 Command(Command &&) = default;
131 ~Command() = default;
132
133 Command &operator=(const Command &) = default;
134 Command &operator=(Command &&) = default;
135
136 bool operator==(const Command &other) const;
137 inline bool operator!=(const Command &other) const
138 {
139 return !operator==(other);
140 }
141
type()142 inline Type type() const
143 {
144 return static_cast<Type>(mType & ~_ResponseBit);
145 }
isValid()146 inline bool isValid() const
147 {
148 return type() != Invalid;
149 }
isResponse()150 inline bool isResponse() const
151 {
152 return mType & _ResponseBit;
153 }
154
155 void toJson(QJsonObject &stream) const;
156
157 protected:
158 explicit Command(quint8 type);
159
160 quint8 mType = Invalid;
161 // unused 7 bytes
162
163 private:
164 friend class Factory;
165 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::Command &cmd);
166 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::Command &cmd);
167 friend AKONADIPRIVATE_EXPORT QDebug operator<<(::QDebug dbg, const Akonadi::Protocol::Command &cmd);
168 friend AKONADIPRIVATE_EXPORT void toJson(const Akonadi::Protocol::Command *cmd, QJsonObject &json);
169 };
170
171 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, Command::Type type);
172
173 } // namespace Protocol
174 } // namespace Akonadi
175
176 Q_DECLARE_METATYPE(Akonadi::Protocol::Command::Type)
Q_DECLARE_METATYPE(Akonadi::Protocol::CommandPtr)177 Q_DECLARE_METATYPE(Akonadi::Protocol::CommandPtr)
178
179 namespace Akonadi
180 {
181 namespace Protocol
182 {
183 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::Response &cmd);
184 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::Response &cmd);
185 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::Response &response);
186
187 using ResponsePtr = QSharedPointer<Response>;
188
189 class AKONADIPRIVATE_EXPORT Response : public Command
190 {
191 public:
192 explicit Response();
193 explicit Response(const Response &) = default;
194 Response(Response &&) = default;
195 Response &operator=(const Response &) = default;
196 Response &operator=(Response &&) = default;
197
198 inline void setError(int code, const QString &message)
199 {
200 mErrorCode = code;
201 mErrorMsg = message;
202 }
203
204 bool operator==(const Response &other) const;
205 inline bool operator!=(const Response &other) const
206 {
207 return !operator==(other);
208 }
209
210 inline bool isError() const
211 {
212 return mErrorCode > 0;
213 }
214
215 inline int errorCode() const
216 {
217 return mErrorCode;
218 }
219 inline QString errorMessage() const
220 {
221 return mErrorMsg;
222 }
223
224 void toJson(QJsonObject &json) const;
225
226 protected:
227 explicit Response(Command::Type type);
228
229 int mErrorCode;
230 QString mErrorMsg;
231
232 private:
233 friend class Factory;
234 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::Response &cmd);
235 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::Response &cmd);
236 friend AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::Response &cmd);
237 };
238
239 } // namespace Protocol
240 } // namespace Akonadi
241
242 namespace Akonadi
243 {
244 namespace Protocol
245 {
cmdCast(const QSharedPointer<T> & p)246 template<typename X, typename T> inline const X &cmdCast(const QSharedPointer<T> &p)
247 {
248 return static_cast<const X &>(*p);
249 }
250
cmdCast(QSharedPointer<T> & p)251 template<typename X, typename T> inline X &cmdCast(QSharedPointer<T> &p)
252 {
253 return static_cast<X &>(*p);
254 }
255
256 class AKONADIPRIVATE_EXPORT Factory
257 {
258 public:
259 static CommandPtr command(Command::Type type);
260 static ResponsePtr response(Command::Type type);
261
262 private:
263 template<typename T> friend AKONADIPRIVATE_EXPORT CommandPtr deserialize(QIODevice *device);
264 };
265
266 AKONADIPRIVATE_EXPORT void serialize(DataStream &stream, const CommandPtr &command);
267 AKONADIPRIVATE_EXPORT CommandPtr deserialize(QIODevice *device);
268 AKONADIPRIVATE_EXPORT QString debugString(const Command &command);
debugString(const CommandPtr & command)269 AKONADIPRIVATE_EXPORT inline QString debugString(const CommandPtr &command)
270 {
271 return debugString(*command);
272 }
273
274 } // namespace Protocol
275 } // namespace Akonadi
276
277 namespace Akonadi
278 {
279 namespace Protocol
280 {
281 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::ItemFetchScope &scope);
282 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ItemFetchScope &scope);
283 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ItemFetchScope &scope);
284
285 class AKONADIPRIVATE_EXPORT ItemFetchScope
286 {
287 public:
288 enum FetchFlag : int {
289 None = 0,
290 CacheOnly = 1 << 0,
291 CheckCachedPayloadPartsOnly = 1 << 1,
292 FullPayload = 1 << 2,
293 AllAttributes = 1 << 3,
294 Size = 1 << 4,
295 MTime = 1 << 5,
296 RemoteRevision = 1 << 6,
297 IgnoreErrors = 1 << 7,
298 Flags = 1 << 8,
299 RemoteID = 1 << 9,
300 GID = 1 << 10,
301 Tags = 1 << 11,
302 Relations = 1 << 12,
303 VirtReferences = 1 << 13
304 };
305 Q_DECLARE_FLAGS(FetchFlags, FetchFlag)
306
307 enum AncestorDepth : ushort {
308 NoAncestor,
309 ParentAncestor,
310 AllAncestors,
311 };
312
313 explicit ItemFetchScope() = default;
314 ItemFetchScope(const ItemFetchScope &) = default;
315 ItemFetchScope(ItemFetchScope &&other) = default;
316 ~ItemFetchScope() = default;
317
318 ItemFetchScope &operator=(const ItemFetchScope &) = default;
319 ItemFetchScope &operator=(ItemFetchScope &&) = default;
320
321 bool operator==(const ItemFetchScope &other) const;
322 inline bool operator!=(const ItemFetchScope &other) const
323 {
324 return !operator==(other);
325 }
326
setRequestedParts(const QVector<QByteArray> & requestedParts)327 inline void setRequestedParts(const QVector<QByteArray> &requestedParts)
328 {
329 mRequestedParts = requestedParts;
330 }
requestedParts()331 inline QVector<QByteArray> requestedParts() const
332 {
333 return mRequestedParts;
334 }
335 QVector<QByteArray> requestedPayloads() const;
336
setChangedSince(const QDateTime & changedSince)337 inline void setChangedSince(const QDateTime &changedSince)
338 {
339 mChangedSince = changedSince;
340 }
changedSince()341 inline QDateTime changedSince() const
342 {
343 return mChangedSince;
344 }
345
setAncestorDepth(AncestorDepth depth)346 inline void setAncestorDepth(AncestorDepth depth)
347 {
348 mAncestorDepth = depth;
349 }
ancestorDepth()350 inline AncestorDepth ancestorDepth() const
351 {
352 return mAncestorDepth;
353 }
354
cacheOnly()355 inline bool cacheOnly() const
356 {
357 return mFlags & CacheOnly;
358 }
checkCachedPayloadPartsOnly()359 inline bool checkCachedPayloadPartsOnly() const
360 {
361 return mFlags & CheckCachedPayloadPartsOnly;
362 }
fullPayload()363 inline bool fullPayload() const
364 {
365 return mFlags & FullPayload;
366 }
allAttributes()367 inline bool allAttributes() const
368 {
369 return mFlags & AllAttributes;
370 }
fetchSize()371 inline bool fetchSize() const
372 {
373 return mFlags & Size;
374 }
fetchMTime()375 inline bool fetchMTime() const
376 {
377 return mFlags & MTime;
378 }
fetchRemoteRevision()379 inline bool fetchRemoteRevision() const
380 {
381 return mFlags & RemoteRevision;
382 }
ignoreErrors()383 inline bool ignoreErrors() const
384 {
385 return mFlags & IgnoreErrors;
386 }
fetchFlags()387 inline bool fetchFlags() const
388 {
389 return mFlags & Flags;
390 }
fetchRemoteId()391 inline bool fetchRemoteId() const
392 {
393 return mFlags & RemoteID;
394 }
fetchGID()395 inline bool fetchGID() const
396 {
397 return mFlags & GID;
398 }
fetchTags()399 inline bool fetchTags() const
400 {
401 return mFlags & Tags;
402 }
fetchRelations()403 inline bool fetchRelations() const
404 {
405 return mFlags & Relations;
406 }
fetchVirtualReferences()407 inline bool fetchVirtualReferences() const
408 {
409 return mFlags & VirtReferences;
410 }
411
412 void setFetch(FetchFlags attributes, bool fetch = true);
413 bool fetch(FetchFlags flags) const;
414
415 void toJson(QJsonObject &json) const;
416
417 private:
418 AncestorDepth mAncestorDepth = NoAncestor;
419 // 2 bytes free
420 FetchFlags mFlags = None;
421 QVector<QByteArray> mRequestedParts;
422 QDateTime mChangedSince;
423
424 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream,
425 const Akonadi::Protocol::ItemFetchScope &scope);
426 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ItemFetchScope &scope);
427 friend AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ItemFetchScope &scope);
428 };
429
430 } // namespace Protocol
431 } // namespace Akonadi
432
Q_DECLARE_OPERATORS_FOR_FLAGS(Akonadi::Protocol::ItemFetchScope::FetchFlags)433 Q_DECLARE_OPERATORS_FOR_FLAGS(Akonadi::Protocol::ItemFetchScope::FetchFlags)
434
435 namespace Akonadi
436 {
437 namespace Protocol
438 {
439 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::ScopeContext &ctx);
440 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ScopeContext &ctx);
441 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ScopeContext &ctx);
442
443 class AKONADIPRIVATE_EXPORT ScopeContext
444 {
445 public:
446 enum Type : uchar {
447 Any = 0,
448 Collection,
449 Tag,
450 };
451
452 explicit ScopeContext() = default;
453 ScopeContext(Type type, qint64 id);
454 ScopeContext(Type type, const QString &id);
455 ScopeContext(const ScopeContext &) = default;
456 ScopeContext(ScopeContext &&) = default;
457 ~ScopeContext() = default;
458
459 ScopeContext &operator=(const ScopeContext &) = default;
460 ScopeContext &operator=(ScopeContext &&) = default;
461
462 bool operator==(const ScopeContext &other) const;
463 inline bool operator!=(const ScopeContext &other) const
464 {
465 return !operator==(other);
466 }
467
468 inline bool isEmpty() const
469 {
470 return mColCtx.isNull() && mTagCtx.isNull();
471 }
472
473 inline void setContext(Type type, qint64 id)
474 {
475 setCtx(type, id);
476 }
477 inline void setContext(Type type, const QString &id)
478 {
479 setCtx(type, id);
480 }
481 inline void clearContext(Type type)
482 {
483 setCtx(type, QVariant());
484 }
485
486 inline bool hasContextId(Type type) const
487 {
488 return ctx(type).type() == QVariant::LongLong;
489 }
490 inline qint64 contextId(Type type) const
491 {
492 return hasContextId(type) ? ctx(type).toLongLong() : 0;
493 }
494
495 inline bool hasContextRID(Type type) const
496 {
497 return ctx(type).type() == QVariant::String;
498 }
499 inline QString contextRID(Type type) const
500 {
501 return hasContextRID(type) ? ctx(type).toString() : QString();
502 }
503
504 void toJson(QJsonObject &json) const;
505
506 private:
507 QVariant mColCtx;
508 QVariant mTagCtx;
509
510 inline QVariant ctx(Type type) const
511 {
512 return type == Collection ? mColCtx : type == Tag ? mTagCtx : QVariant();
513 }
514
515 inline void setCtx(Type type, const QVariant &v)
516 {
517 if (type == Collection) {
518 mColCtx = v;
519 } else if (type == Tag) {
520 mTagCtx = v;
521 }
522 }
523
524 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream,
525 const Akonadi::Protocol::ScopeContext &context);
526 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ScopeContext &context);
527 friend AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ScopeContext &ctx);
528 };
529
530 } // namespace Protocol
531 } // namespace akonadi
532
533 namespace Akonadi
534 {
535 namespace Protocol
536 {
537 class FetchItemsResponse;
538 using FetchItemsResponsePtr = QSharedPointer<FetchItemsResponse>;
539
540 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::ChangeNotification &ntf);
541 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ChangeNotification &ntf);
542 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ChangeNotification &ntf);
543
544 using ChangeNotificationPtr = QSharedPointer<ChangeNotification>;
545 using ChangeNotificationList = QVector<ChangeNotificationPtr>;
546
547 class AKONADIPRIVATE_EXPORT ChangeNotification : public Command
548 {
549 public:
550 static QList<qint64> itemsToUids(const QVector<Akonadi::Protocol::FetchItemsResponse> &items);
551
552 class Relation
553 {
554 public:
555 Relation() = default;
556 Relation(const Relation &) = default;
557 Relation(Relation &&) = default;
Relation(qint64 leftId,qint64 rightId,const QString & type)558 inline Relation(qint64 leftId, qint64 rightId, const QString &type)
559 : leftId(leftId)
560 , rightId(rightId)
561 , type(type)
562 {
563 }
564
565 Relation &operator=(const Relation &) = default;
566 Relation &operator=(Relation &&) = default;
567
568 inline bool operator==(const Relation &other) const
569 {
570 return leftId == other.leftId && rightId == other.rightId && type == other.type;
571 }
572
toJson(QJsonObject & json)573 void toJson(QJsonObject &json) const
574 {
575 json[QStringLiteral("leftId")] = leftId;
576 json[QStringLiteral("rightId")] = rightId;
577 json[QStringLiteral("type")] = type;
578 }
579
580 qint64 leftId = -1;
581 qint64 rightId = -1;
582 QString type;
583 };
584
585 ChangeNotification &operator=(const ChangeNotification &) = default;
586 ChangeNotification &operator=(ChangeNotification &&) = default;
587
588 bool operator==(const ChangeNotification &other) const;
589 inline bool operator!=(const ChangeNotification &other) const
590 {
591 return !operator==(other);
592 }
593
594 bool isRemove() const;
595 bool isMove() const;
596
sessionId()597 inline QByteArray sessionId() const
598 {
599 return mSessionId;
600 }
setSessionId(const QByteArray & sessionId)601 inline void setSessionId(const QByteArray &sessionId)
602 {
603 mSessionId = sessionId;
604 }
605
addMetadata(const QByteArray & metadata)606 inline void addMetadata(const QByteArray &metadata)
607 {
608 mMetaData << metadata;
609 }
removeMetadata(const QByteArray & metadata)610 inline void removeMetadata(const QByteArray &metadata)
611 {
612 mMetaData.removeAll(metadata);
613 }
metadata()614 QVector<QByteArray> metadata() const
615 {
616 return mMetaData;
617 }
618
619 static bool appendAndCompress(ChangeNotificationList &list, const ChangeNotificationPtr &msg);
620
621 void toJson(QJsonObject &json) const;
622
623 protected:
624 explicit ChangeNotification() = default;
625 explicit ChangeNotification(Command::Type type);
626 ChangeNotification(const ChangeNotification &) = default;
627 ChangeNotification(ChangeNotification &&) = default;
628
629 QByteArray mSessionId;
630
631 // For internal use only: Akonadi server can add some additional information
632 // that might be useful when evaluating the notification for example, but
633 // it is never transferred to clients
634 QVector<QByteArray> mMetaData;
635
636 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream,
637 const Akonadi::Protocol::ChangeNotification &ntf);
638 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ChangeNotification &ntf);
639 friend AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ChangeNotification &ntf);
640 };
641
qHash(const ChangeNotification::Relation & rel)642 inline uint qHash(const ChangeNotification::Relation &rel)
643 {
644 return ::qHash(rel.leftId + rel.rightId);
645 }
646
647 // TODO: Internalize?
648 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream,
649 const Akonadi::Protocol::ChangeNotification::Relation &relation);
650 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream,
651 Akonadi::Protocol::ChangeNotification::Relation &relation);
652
653 } // namespace Protocol
654 } // namespace Akonadi
655
656 Q_DECLARE_METATYPE(Akonadi::Protocol::ChangeNotificationPtr)
657 Q_DECLARE_METATYPE(Akonadi::Protocol::ChangeNotificationList)
658 Q_DECLARE_TYPEINFO(Akonadi::Protocol::ChangeNotification::Relation, Q_MOVABLE_TYPE);
659
660 /******************************************************************************/
661
662 // Here comes the actual generated Protocol. See protocol.xml for definitions,
663 // and genprotocol folder for the generator.
664 #include "protocol_gen.h"
665
666 /******************************************************************************/
667
668 // Command parameters
669 #define AKONADI_PARAM_ATR "ATR:"
670 #define AKONADI_PARAM_CACHEPOLICY "CACHEPOLICY"
671 #define AKONADI_PARAM_DISPLAY "DISPLAY"
672 #define AKONADI_PARAM_ENABLED "ENABLED"
673 #define AKONADI_PARAM_FLAGS "FLAGS"
674 #define AKONADI_PARAM_TAGS "TAGS"
675 #define AKONADI_PARAM_GID "GID"
676 #define AKONADI_PARAM_INDEX "INDEX"
677 #define AKONADI_PARAM_MIMETYPE "MIMETYPE"
678 #define AKONADI_PARAM_NAME "NAME"
679 #define AKONADI_PARAM_PARENT "PARENT"
680 #define AKONADI_PARAM_PERSISTENTSEARCH "PERSISTENTSEARCH"
681 #define AKONADI_PARAM_PLD "PLD:"
682 #define AKONADI_PARAM_PLD_RFC822 "PLD:RFC822"
683 #define AKONADI_PARAM_RECURSIVE "RECURSIVE"
684 #define AKONADI_PARAM_REMOTE "REMOTE"
685 #define AKONADI_PARAM_REMOTEID "REMOTEID"
686 #define AKONADI_PARAM_REMOTEREVISION "REMOTEREVISION"
687 #define AKONADI_PARAM_REVISION "REV"
688 #define AKONADI_PARAM_SIZE "SIZE"
689 #define AKONADI_PARAM_SYNC "SYNC"
690 #define AKONADI_PARAM_TAG "TAG"
691 #define AKONADI_PARAM_TYPE "TYPE"
692 #define AKONADI_PARAM_VIRTUAL "VIRTUAL"
693
694 // Flags
695 #define AKONADI_FLAG_GID "\\Gid"
696 #define AKONADI_FLAG_IGNORED "$IGNORED"
697 #define AKONADI_FLAG_MIMETYPE "\\MimeType"
698 #define AKONADI_FLAG_REMOTEID "\\RemoteId"
699 #define AKONADI_FLAG_REMOTEREVISION "\\RemoteRevision"
700 #define AKONADI_FLAG_TAG "\\Tag"
701 #define AKONADI_FLAG_RTAG "\\RTag"
702 #define AKONADI_FLAG_SEEN "\\SEEN"
703
704 // Attributes
705 #define AKONADI_ATTRIBUTE_HIDDEN "ATR:HIDDEN"
706 #define AKONADI_ATTRIBUTE_MESSAGES "MESSAGES"
707 #define AKONADI_ATTRIBUTE_UNSEEN "UNSEEN"
708
709 // special resource names
710 #define AKONADI_SEARCH_RESOURCE "akonadi_search_resource"
711
712 namespace Akonadi
713 {
714 static const QString CollectionMimeType = QStringLiteral("inode/directory");
715 static const QString VirtualCollectionMimeType = QStringLiteral("application/x-vnd.akonadi.collection.virtual");
716
717 }
718
719