File indexing completed on 2024-11-10 04:40:48
0001 /* 0002 SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org> 0003 SPDX-FileCopyrightText: 2015 Daniel Vrátil <dvratil@redhat.com> 0004 SPDX-FileCopyrightText: 2016 Daniel Vrátil <dvratil@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #pragma once 0010 0011 #include "akonadiprivate_export.h" 0012 0013 #include <QByteArray> 0014 #include <QDateTime> 0015 #include <QDebug> 0016 #include <QJsonObject> 0017 #include <QList> 0018 #include <QSharedPointer> 0019 0020 #include "scope_p.h" 0021 #include "tristate_p.h" 0022 0023 // clazy:excludeall=function-args-by-value 0024 0025 /** 0026 @file protocol_p.h Shared constants used in the communication protocol between 0027 the Akonadi server and its clients. 0028 */ 0029 0030 namespace Akonadi 0031 { 0032 namespace Protocol 0033 { 0034 class Factory; 0035 class DataStream; 0036 0037 class Command; 0038 class Response; 0039 class ItemFetchScope; 0040 class ScopeContext; 0041 class ChangeNotification; 0042 0043 using Attributes = QMap<QByteArray, QByteArray>; 0044 0045 } // namespace Protocol 0046 } // namespace Akonadi 0047 0048 namespace Akonadi 0049 { 0050 namespace Protocol 0051 { 0052 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::Command &cmd); 0053 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::Command &cmd); 0054 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::Command &cmd); 0055 0056 AKONADIPRIVATE_EXPORT void toJson(const Command *cmd, QJsonObject &json); 0057 0058 using CommandPtr = QSharedPointer<Command>; 0059 0060 class AKONADIPRIVATE_EXPORT Command 0061 { 0062 public: 0063 enum Type : quint8 { 0064 Invalid = 0, 0065 0066 // Session management 0067 Hello = 1, 0068 Login, 0069 Logout, 0070 0071 // Transactions 0072 Transaction = 10, 0073 0074 // Items 0075 CreateItem = 20, 0076 CopyItems, 0077 DeleteItems, 0078 FetchItems, 0079 LinkItems, 0080 ModifyItems, 0081 MoveItems, 0082 0083 // Collections 0084 CreateCollection = 40, 0085 CopyCollection, 0086 DeleteCollection, 0087 FetchCollections, 0088 FetchCollectionStats, 0089 ModifyCollection, 0090 MoveCollection, 0091 0092 // Search 0093 Search = 60, 0094 SearchResult, 0095 StoreSearch, 0096 0097 // Tag 0098 CreateTag = 70, 0099 DeleteTag, 0100 FetchTags, 0101 ModifyTag, 0102 0103 // Relation 0104 FetchRelations = 80, 0105 ModifyRelation, 0106 RemoveRelations, 0107 0108 // Resources 0109 SelectResource = 90, 0110 0111 // Other 0112 StreamPayload = 100, 0113 0114 // Notifications 0115 ItemChangeNotification = 110, 0116 CollectionChangeNotification, 0117 TagChangeNotification, 0118 RelationChangeNotification, 0119 SubscriptionChangeNotification, 0120 DebugChangeNotification, 0121 CreateSubscription, 0122 ModifySubscription, 0123 0124 // _MaxValue = 127 0125 _ResponseBit = 0x80U // reserved 0126 }; 0127 0128 explicit Command() = default; 0129 explicit Command(const Command &) = default; 0130 Command(Command &&) = default; 0131 ~Command() = default; 0132 0133 Command &operator=(const Command &) = default; 0134 Command &operator=(Command &&) = default; 0135 0136 bool operator==(const Command &other) const; 0137 inline bool operator!=(const Command &other) const 0138 { 0139 return !operator==(other); 0140 } 0141 0142 inline Type type() const 0143 { 0144 return static_cast<Type>(mType & ~_ResponseBit); 0145 } 0146 inline bool isValid() const 0147 { 0148 return type() != Invalid; 0149 } 0150 inline bool isResponse() const 0151 { 0152 return mType & _ResponseBit; 0153 } 0154 0155 void toJson(QJsonObject &stream) const; 0156 0157 protected: 0158 explicit Command(quint8 type); 0159 0160 quint8 mType = Invalid; 0161 // unused 7 bytes 0162 0163 private: 0164 friend class Factory; 0165 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::Command &cmd); 0166 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::Command &cmd); 0167 friend AKONADIPRIVATE_EXPORT QDebug operator<<(::QDebug dbg, const Akonadi::Protocol::Command &cmd); 0168 friend AKONADIPRIVATE_EXPORT void toJson(const Akonadi::Protocol::Command *cmd, QJsonObject &json); 0169 }; 0170 0171 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, Command::Type type); 0172 0173 } // namespace Protocol 0174 } // namespace Akonadi 0175 0176 Q_DECLARE_METATYPE(Akonadi::Protocol::Command::Type) 0177 Q_DECLARE_METATYPE(Akonadi::Protocol::CommandPtr) 0178 0179 namespace Akonadi 0180 { 0181 namespace Protocol 0182 { 0183 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::Response &cmd); 0184 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::Response &cmd); 0185 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::Response &response); 0186 0187 using ResponsePtr = QSharedPointer<Response>; 0188 0189 class AKONADIPRIVATE_EXPORT Response : public Command 0190 { 0191 public: 0192 explicit Response(); 0193 explicit Response(const Response &) = default; 0194 Response(Response &&) = default; 0195 Response &operator=(const Response &) = default; 0196 Response &operator=(Response &&) = default; 0197 0198 inline void setError(int code, const QString &message) 0199 { 0200 mErrorCode = code; 0201 mErrorMsg = message; 0202 } 0203 0204 bool operator==(const Response &other) const; 0205 inline bool operator!=(const Response &other) const 0206 { 0207 return !operator==(other); 0208 } 0209 0210 inline bool isError() const 0211 { 0212 return mErrorCode > 0; 0213 } 0214 0215 inline int errorCode() const 0216 { 0217 return mErrorCode; 0218 } 0219 inline QString errorMessage() const 0220 { 0221 return mErrorMsg; 0222 } 0223 0224 void toJson(QJsonObject &json) const; 0225 0226 protected: 0227 explicit Response(Command::Type type); 0228 0229 int mErrorCode; 0230 QString mErrorMsg; 0231 0232 private: 0233 friend class Factory; 0234 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::Response &cmd); 0235 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::Response &cmd); 0236 friend AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::Response &cmd); 0237 }; 0238 0239 } // namespace Protocol 0240 } // namespace Akonadi 0241 0242 namespace Akonadi 0243 { 0244 namespace Protocol 0245 { 0246 template<typename X, typename T> 0247 inline const X &cmdCast(const QSharedPointer<T> &p) 0248 { 0249 return static_cast<const X &>(*p); 0250 } 0251 0252 template<typename X, typename T> 0253 inline X &cmdCast(QSharedPointer<T> &p) 0254 { 0255 return static_cast<X &>(*p); 0256 } 0257 0258 class AKONADIPRIVATE_EXPORT Factory 0259 { 0260 public: 0261 static CommandPtr command(Command::Type type); 0262 static ResponsePtr response(Command::Type type); 0263 0264 private: 0265 template<typename T> 0266 friend AKONADIPRIVATE_EXPORT CommandPtr deserialize(QIODevice *device); 0267 }; 0268 0269 AKONADIPRIVATE_EXPORT void serialize(DataStream &stream, const CommandPtr &command); 0270 AKONADIPRIVATE_EXPORT CommandPtr deserialize(QIODevice *device); 0271 AKONADIPRIVATE_EXPORT QString debugString(const Command &command); 0272 AKONADIPRIVATE_EXPORT inline QString debugString(const CommandPtr &command) 0273 { 0274 return debugString(*command); 0275 } 0276 0277 } // namespace Protocol 0278 } // namespace Akonadi 0279 0280 namespace Akonadi 0281 { 0282 namespace Protocol 0283 { 0284 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::ItemFetchScope &scope); 0285 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ItemFetchScope &scope); 0286 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ItemFetchScope &scope); 0287 0288 class AKONADIPRIVATE_EXPORT ItemFetchScope 0289 { 0290 public: 0291 enum FetchFlag : int { 0292 None = 0, 0293 CacheOnly = 1 << 0, 0294 CheckCachedPayloadPartsOnly = 1 << 1, 0295 FullPayload = 1 << 2, 0296 AllAttributes = 1 << 3, 0297 Size = 1 << 4, 0298 MTime = 1 << 5, 0299 RemoteRevision = 1 << 6, 0300 IgnoreErrors = 1 << 7, 0301 Flags = 1 << 8, 0302 RemoteID = 1 << 9, 0303 GID = 1 << 10, 0304 Tags = 1 << 11, 0305 Relations = 1 << 12, 0306 VirtReferences = 1 << 13 0307 }; 0308 Q_DECLARE_FLAGS(FetchFlags, FetchFlag) 0309 0310 enum AncestorDepth : ushort { 0311 NoAncestor, 0312 ParentAncestor, 0313 AllAncestors, 0314 }; 0315 0316 explicit ItemFetchScope() = default; 0317 ItemFetchScope(const ItemFetchScope &) = default; 0318 ItemFetchScope(ItemFetchScope &&other) = default; 0319 ~ItemFetchScope() = default; 0320 0321 ItemFetchScope &operator=(const ItemFetchScope &) = default; 0322 ItemFetchScope &operator=(ItemFetchScope &&) = default; 0323 0324 bool operator==(const ItemFetchScope &other) const; 0325 inline bool operator!=(const ItemFetchScope &other) const 0326 { 0327 return !operator==(other); 0328 } 0329 0330 inline void setRequestedParts(const QList<QByteArray> &requestedParts) 0331 { 0332 mRequestedParts = requestedParts; 0333 } 0334 inline QList<QByteArray> requestedParts() const 0335 { 0336 return mRequestedParts; 0337 } 0338 QList<QByteArray> requestedPayloads() const; 0339 0340 inline void setChangedSince(const QDateTime &changedSince) 0341 { 0342 mChangedSince = changedSince; 0343 } 0344 inline QDateTime changedSince() const 0345 { 0346 return mChangedSince; 0347 } 0348 0349 inline void setAncestorDepth(AncestorDepth depth) 0350 { 0351 mAncestorDepth = depth; 0352 } 0353 inline AncestorDepth ancestorDepth() const 0354 { 0355 return mAncestorDepth; 0356 } 0357 0358 inline bool cacheOnly() const 0359 { 0360 return mFlags & CacheOnly; 0361 } 0362 inline bool checkCachedPayloadPartsOnly() const 0363 { 0364 return mFlags & CheckCachedPayloadPartsOnly; 0365 } 0366 inline bool fullPayload() const 0367 { 0368 return mFlags & FullPayload; 0369 } 0370 inline bool allAttributes() const 0371 { 0372 return mFlags & AllAttributes; 0373 } 0374 inline bool fetchSize() const 0375 { 0376 return mFlags & Size; 0377 } 0378 inline bool fetchMTime() const 0379 { 0380 return mFlags & MTime; 0381 } 0382 inline bool fetchRemoteRevision() const 0383 { 0384 return mFlags & RemoteRevision; 0385 } 0386 inline bool ignoreErrors() const 0387 { 0388 return mFlags & IgnoreErrors; 0389 } 0390 inline bool fetchFlags() const 0391 { 0392 return mFlags & Flags; 0393 } 0394 inline bool fetchRemoteId() const 0395 { 0396 return mFlags & RemoteID; 0397 } 0398 inline bool fetchGID() const 0399 { 0400 return mFlags & GID; 0401 } 0402 inline bool fetchTags() const 0403 { 0404 return mFlags & Tags; 0405 } 0406 inline bool fetchRelations() const 0407 { 0408 return mFlags & Relations; 0409 } 0410 inline bool fetchVirtualReferences() const 0411 { 0412 return mFlags & VirtReferences; 0413 } 0414 0415 void setFetch(FetchFlags attributes, bool fetch = true); 0416 bool fetch(FetchFlags flags) const; 0417 0418 void toJson(QJsonObject &json) const; 0419 0420 private: 0421 AncestorDepth mAncestorDepth = NoAncestor; 0422 // 2 bytes free 0423 FetchFlags mFlags = None; 0424 QList<QByteArray> mRequestedParts; 0425 QDateTime mChangedSince; 0426 0427 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, 0428 const Akonadi::Protocol::ItemFetchScope &scope); 0429 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ItemFetchScope &scope); 0430 friend AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ItemFetchScope &scope); 0431 }; 0432 0433 } // namespace Protocol 0434 } // namespace Akonadi 0435 0436 Q_DECLARE_OPERATORS_FOR_FLAGS(Akonadi::Protocol::ItemFetchScope::FetchFlags) 0437 0438 namespace Akonadi 0439 { 0440 namespace Protocol 0441 { 0442 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::ScopeContext &ctx); 0443 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ScopeContext &ctx); 0444 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ScopeContext &ctx); 0445 0446 class AKONADIPRIVATE_EXPORT ScopeContext 0447 { 0448 public: 0449 enum Type : uchar { 0450 Any = 0, 0451 Collection, 0452 Tag, 0453 }; 0454 0455 explicit ScopeContext() = default; 0456 ScopeContext(Type type, qint64 id); 0457 ScopeContext(Type type, const QString &id); 0458 ScopeContext(const ScopeContext &) = default; 0459 ScopeContext(ScopeContext &&) = default; 0460 ~ScopeContext() = default; 0461 0462 ScopeContext &operator=(const ScopeContext &) = default; 0463 ScopeContext &operator=(ScopeContext &&) = default; 0464 0465 bool operator==(const ScopeContext &other) const; 0466 inline bool operator!=(const ScopeContext &other) const 0467 { 0468 return !operator==(other); 0469 } 0470 0471 inline bool isEmpty() const 0472 { 0473 return mColCtx.isNull() && mTagCtx.isNull(); 0474 } 0475 0476 inline void setContext(Type type, qint64 id) 0477 { 0478 setCtx(type, id); 0479 } 0480 inline void setContext(Type type, const QString &id) 0481 { 0482 setCtx(type, id); 0483 } 0484 inline void clearContext(Type type) 0485 { 0486 setCtx(type, QVariant()); 0487 } 0488 0489 inline bool hasContextId(Type type) const 0490 { 0491 return ctx(type).typeId() == QMetaType::LongLong; 0492 } 0493 inline qint64 contextId(Type type) const 0494 { 0495 return hasContextId(type) ? ctx(type).toLongLong() : 0; 0496 } 0497 0498 inline bool hasContextRID(Type type) const 0499 { 0500 return ctx(type).typeId() == QMetaType::QString; 0501 } 0502 inline QString contextRID(Type type) const 0503 { 0504 return hasContextRID(type) ? ctx(type).toString() : QString(); 0505 } 0506 0507 void toJson(QJsonObject &json) const; 0508 0509 private: 0510 QVariant mColCtx; 0511 QVariant mTagCtx; 0512 0513 inline QVariant ctx(Type type) const 0514 { 0515 return type == Collection ? mColCtx : type == Tag ? mTagCtx : QVariant(); 0516 } 0517 0518 inline void setCtx(Type type, const QVariant &v) 0519 { 0520 if (type == Collection) { 0521 mColCtx = v; 0522 } else if (type == Tag) { 0523 mTagCtx = v; 0524 } 0525 } 0526 0527 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, 0528 const Akonadi::Protocol::ScopeContext &context); 0529 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ScopeContext &context); 0530 friend AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ScopeContext &ctx); 0531 }; 0532 0533 } // namespace Protocol 0534 } // namespace akonadi 0535 0536 namespace Akonadi 0537 { 0538 namespace Protocol 0539 { 0540 class FetchItemsResponse; 0541 using FetchItemsResponsePtr = QSharedPointer<FetchItemsResponse>; 0542 0543 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, const Akonadi::Protocol::ChangeNotification &ntf); 0544 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ChangeNotification &ntf); 0545 AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ChangeNotification &ntf); 0546 0547 using ChangeNotificationPtr = QSharedPointer<ChangeNotification>; 0548 using ChangeNotificationList = QList<ChangeNotificationPtr>; 0549 0550 class AKONADIPRIVATE_EXPORT ChangeNotification : public Command 0551 { 0552 public: 0553 static QList<qint64> itemsToUids(const QList<Akonadi::Protocol::FetchItemsResponse> &items); 0554 0555 class Relation 0556 { 0557 public: 0558 Relation() = default; 0559 Relation(const Relation &) = default; 0560 Relation(Relation &&) = default; 0561 inline Relation(qint64 leftId, qint64 rightId, const QString &type) 0562 : leftId(leftId) 0563 , rightId(rightId) 0564 , type(type) 0565 { 0566 } 0567 0568 Relation &operator=(const Relation &) = default; 0569 Relation &operator=(Relation &&) = default; 0570 0571 inline bool operator==(const Relation &other) const 0572 { 0573 return leftId == other.leftId && rightId == other.rightId && type == other.type; 0574 } 0575 0576 void toJson(QJsonObject &json) const 0577 { 0578 json[QStringLiteral("leftId")] = leftId; 0579 json[QStringLiteral("rightId")] = rightId; 0580 json[QStringLiteral("type")] = type; 0581 } 0582 0583 qint64 leftId = -1; 0584 qint64 rightId = -1; 0585 QString type; 0586 }; 0587 0588 ChangeNotification &operator=(const ChangeNotification &) = default; 0589 ChangeNotification &operator=(ChangeNotification &&) = default; 0590 0591 bool operator==(const ChangeNotification &other) const; 0592 inline bool operator!=(const ChangeNotification &other) const 0593 { 0594 return !operator==(other); 0595 } 0596 0597 bool isRemove() const; 0598 bool isMove() const; 0599 0600 inline QByteArray sessionId() const 0601 { 0602 return mSessionId; 0603 } 0604 inline void setSessionId(const QByteArray &sessionId) 0605 { 0606 mSessionId = sessionId; 0607 } 0608 0609 inline void addMetadata(const QByteArray &metadata) 0610 { 0611 mMetaData << metadata; 0612 } 0613 inline void removeMetadata(const QByteArray &metadata) 0614 { 0615 mMetaData.removeAll(metadata); 0616 } 0617 QList<QByteArray> metadata() const 0618 { 0619 return mMetaData; 0620 } 0621 0622 static bool appendAndCompress(ChangeNotificationList &list, const ChangeNotificationPtr &msg); 0623 0624 void toJson(QJsonObject &json) const; 0625 0626 protected: 0627 explicit ChangeNotification() = default; 0628 explicit ChangeNotification(Command::Type type); 0629 ChangeNotification(const ChangeNotification &) = default; 0630 ChangeNotification(ChangeNotification &&) = default; 0631 0632 QByteArray mSessionId; 0633 0634 // For internal use only: Akonadi server can add some additional information 0635 // that might be useful when evaluating the notification for example, but 0636 // it is never transferred to clients 0637 QList<QByteArray> mMetaData; 0638 0639 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, 0640 const Akonadi::Protocol::ChangeNotification &ntf); 0641 friend AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, Akonadi::Protocol::ChangeNotification &ntf); 0642 friend AKONADIPRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Akonadi::Protocol::ChangeNotification &ntf); 0643 }; 0644 0645 inline size_t qHash(const ChangeNotification::Relation &rel, size_t seed = 0) noexcept 0646 { 0647 return ::qHashMulti(seed, rel.leftId, rel.rightId); 0648 } 0649 0650 // TODO: Internalize? 0651 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator<<(Akonadi::Protocol::DataStream &stream, 0652 const Akonadi::Protocol::ChangeNotification::Relation &relation); 0653 AKONADIPRIVATE_EXPORT Akonadi::Protocol::DataStream &operator>>(Akonadi::Protocol::DataStream &stream, 0654 Akonadi::Protocol::ChangeNotification::Relation &relation); 0655 0656 } // namespace Protocol 0657 } // namespace Akonadi 0658 0659 Q_DECLARE_METATYPE(Akonadi::Protocol::ChangeNotificationPtr) 0660 Q_DECLARE_METATYPE(Akonadi::Protocol::ChangeNotificationList) 0661 Q_DECLARE_TYPEINFO(Akonadi::Protocol::ChangeNotification::Relation, Q_RELOCATABLE_TYPE); 0662 0663 /******************************************************************************/ 0664 0665 // Here comes the actual generated Protocol. See protocol.xml for definitions, 0666 // and genprotocol folder for the generator. 0667 #include "protocol_gen.h" 0668 0669 /******************************************************************************/ 0670 0671 // Command parameters 0672 #define AKONADI_PARAM_ATR "ATR:" 0673 #define AKONADI_PARAM_CACHEPOLICY "CACHEPOLICY" 0674 #define AKONADI_PARAM_DISPLAY "DISPLAY" 0675 #define AKONADI_PARAM_ENABLED "ENABLED" 0676 #define AKONADI_PARAM_FLAGS "FLAGS" 0677 #define AKONADI_PARAM_TAGS "TAGS" 0678 #define AKONADI_PARAM_GID "GID" 0679 #define AKONADI_PARAM_INDEX "INDEX" 0680 #define AKONADI_PARAM_MIMETYPE "MIMETYPE" 0681 #define AKONADI_PARAM_NAME "NAME" 0682 #define AKONADI_PARAM_PARENT "PARENT" 0683 #define AKONADI_PARAM_PERSISTENTSEARCH "PERSISTENTSEARCH" 0684 #define AKONADI_PARAM_PLD "PLD:" 0685 #define AKONADI_PARAM_PLD_RFC822 "PLD:RFC822" 0686 #define AKONADI_PARAM_RECURSIVE "RECURSIVE" 0687 #define AKONADI_PARAM_REMOTE "REMOTE" 0688 #define AKONADI_PARAM_REMOTEID "REMOTEID" 0689 #define AKONADI_PARAM_REMOTEREVISION "REMOTEREVISION" 0690 #define AKONADI_PARAM_REVISION "REV" 0691 #define AKONADI_PARAM_SIZE "SIZE" 0692 #define AKONADI_PARAM_SYNC "SYNC" 0693 #define AKONADI_PARAM_TAG "TAG" 0694 #define AKONADI_PARAM_TYPE "TYPE" 0695 #define AKONADI_PARAM_VIRTUAL "VIRTUAL" 0696 0697 // Flags 0698 #define AKONADI_FLAG_GID "\\Gid" 0699 #define AKONADI_FLAG_IGNORED "$IGNORED" 0700 #define AKONADI_FLAG_MIMETYPE "\\MimeType" 0701 #define AKONADI_FLAG_REMOTEID "\\RemoteId" 0702 #define AKONADI_FLAG_REMOTEREVISION "\\RemoteRevision" 0703 #define AKONADI_FLAG_TAG "\\Tag" 0704 #define AKONADI_FLAG_RTAG "\\RTag" 0705 #define AKONADI_FLAG_SEEN "\\SEEN" 0706 0707 // Attributes 0708 #define AKONADI_ATTRIBUTE_HIDDEN "ATR:HIDDEN" 0709 #define AKONADI_ATTRIBUTE_MESSAGES "MESSAGES" 0710 #define AKONADI_ATTRIBUTE_UNSEEN "UNSEEN" 0711 0712 // special resource names 0713 #define AKONADI_SEARCH_RESOURCE "akonadi_search_resource" 0714 0715 namespace Akonadi 0716 { 0717 static const QString CollectionMimeType = QStringLiteral("inode/directory"); 0718 static const QString VirtualCollectionMimeType = QStringLiteral("application/x-vnd.akonadi.collection.virtual"); 0719 0720 }