Akonadi

handlerhelper.h
1/***************************************************************************
2 * SPDX-FileCopyrightText: 2006 Tobias Koenig <tokoe@kde.org> *
3 * *
4 * SPDX-License-Identifier: LGPL-2.0-or-later *
5 ***************************************************************************/
6
7#pragma once
8
9#include "entities.h"
10
11#include <QByteArray>
12#include <QStack>
13#include <QString>
14
15namespace Akonadi
16{
17class Scope;
18
19namespace Protocol
20{
21class Ancestor;
22class CachePolicy;
23class FetchCollectionsResponse;
24class TagFetchScope;
25class FetchTagsResponse;
26using FetchTagsResponsePtr = QSharedPointer<FetchTagsResponse>;
27class FetchRelationsResponse;
28using FetchRelationsResponsePtr = QSharedPointer<FetchRelationsResponse>;
29}
30
31namespace Server
32{
33class CommandContext;
34class Connection;
35class AkonadiServer;
36
37/**
38 Helper functions for command handlers.
39*/
41{
42public:
43 /**
44 Returns the collection identified by the given id or path.
45 */
47
48 /**
49 Returns the full path for the given collection.
50 */
51 static QString pathForCollection(const Collection &col);
52
53 /**
54 Returns the protocol representation of the cache policy of the given
55 Collection object.
56 */
57 static Protocol::CachePolicy cachePolicyResponse(const Collection &col);
58
59 /**
60 Returns the protocol representation of the given collection.
61 Make sure DataStore::activeCachePolicy() has been called before to include
62 the effective cache policy
63 */
64 static Protocol::FetchCollectionsResponse fetchCollectionsResponse(AkonadiServer &akonadi, const Collection &col);
65
66 /**
67 Returns the protocol representation of the given collection.
68 Make sure DataStore::activeCachePolicy() has been called before to include
69 the effective cache policy
70 */
71 static Protocol::FetchCollectionsResponse
72 fetchCollectionsResponse(AkonadiServer &akonadi,
73 const Collection &col,
74 const CollectionAttribute::List &attributeList,
75 bool includeStatistics = false,
76 int ancestorDepth = 0,
77 const QStack<Collection> &ancestors = QStack<Collection>(),
79 const QStringList &mimeTypes = QStringList());
80
81 /**
82 Returns the protocol representation of a collection ancestor chain.
83 */
84 static QList<Protocol::Ancestor> ancestorsResponse(int ancestorDepth,
85 const QStack<Collection> &ancestors,
87
88 static Protocol::FetchTagsResponse fetchTagsResponse(const Tag &tag, const Protocol::TagFetchScope &tagFetchScope, Connection *connection = nullptr);
89
90 static Protocol::FetchRelationsResponse fetchRelationsResponse(const Relation &relation);
91
92 /**
93 Converts a bytearray list of flag names into flag records.
94 @throws HandlerException on errors during database operations
95 */
96 static Flag::List resolveFlags(const QSet<QByteArray> &flagNames);
97
98 /**
99 Converts a imap set of tags into tag records.
100 @throws HandlerException on errors during database operations
101 */
102 static Tag::List resolveTagsByUID(const QList<qint64> &tags);
103
104 static Tag::List resolveTagsByGID(const QStringList &tagsGIDs);
105
106 static Tag::List resolveTagsByRID(const QStringList &tagsRIDs, const CommandContext &context);
107
108 static Collection collectionFromScope(const Scope &scope, const CommandContext &context);
109
110 static Tag::List tagsFromScope(const Scope &scope, const CommandContext &context);
111};
112
113} // namespace Server
114} // namespace Akonadi
Represents a collection of PIM items.
Definition collection.h:62
An Akonadi Relation.
Definition relation.h:41
An Connection represents one connection of a client to the server.
Definition connection.h:39
Helper functions for command handlers.
static Protocol::CachePolicy cachePolicyResponse(const Collection &col)
Returns the protocol representation of the cache policy of the given Collection object.
static Tag::List resolveTagsByUID(const QList< qint64 > &tags)
Converts a imap set of tags into tag records.
static Protocol::FetchCollectionsResponse fetchCollectionsResponse(AkonadiServer &akonadi, const Collection &col)
Returns the protocol representation of the given collection.
static Collection collectionFromIdOrName(const QByteArray &id)
Returns the collection identified by the given id or path.
static Flag::List resolveFlags(const QSet< QByteArray > &flagNames)
Converts a bytearray list of flag names into flag records.
static QList< Protocol::Ancestor > ancestorsResponse(int ancestorDepth, const QStack< Collection > &ancestors, const QStack< CollectionAttribute::List > &_ancestorsAttributes=QStack< CollectionAttribute::List >())
Returns the protocol representation of a collection ancestor chain.
static QString pathForCollection(const Collection &col)
Returns the full path for the given collection.
An Akonadi Tag.
Definition tag.h:26
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 7 2024 11:56:45 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.