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>;
27}
28
29namespace Server
30{
31class CommandContext;
32class Connection;
33class AkonadiServer;
34
35/**
36 Helper functions for command handlers.
37*/
39{
40public:
41 /**
42 Returns the collection identified by the given id or path.
43 */
45
46 /**
47 Returns the full path for the given collection.
48 */
49 static QString pathForCollection(const Collection &col);
50
51 /**
52 Returns the protocol representation of the cache policy of the given
53 Collection object.
54 */
55 static Protocol::CachePolicy cachePolicyResponse(const Collection &col);
56
57 /**
58 Returns the protocol representation of the given collection.
59 Make sure DataStore::activeCachePolicy() has been called before to include
60 the effective cache policy
61 */
62 static Protocol::FetchCollectionsResponse fetchCollectionsResponse(AkonadiServer &akonadi, const Collection &col);
63
64 /**
65 Returns the protocol representation of the given collection.
66 Make sure DataStore::activeCachePolicy() has been called before to include
67 the effective cache policy
68 */
69 static Protocol::FetchCollectionsResponse
70 fetchCollectionsResponse(AkonadiServer &akonadi,
71 const Collection &col,
72 const CollectionAttribute::List &attributeList,
73 bool includeStatistics = false,
74 int ancestorDepth = 0,
75 const QStack<Collection> &ancestors = QStack<Collection>(),
77 const QStringList &mimeTypes = QStringList());
78
79 /**
80 Returns the protocol representation of a collection ancestor chain.
81 */
82 static QList<Protocol::Ancestor> ancestorsResponse(int ancestorDepth,
83 const QStack<Collection> &ancestors,
85
86 static Protocol::FetchTagsResponse fetchTagsResponse(const Tag &tag, const Protocol::TagFetchScope &tagFetchScope, Connection *connection = nullptr);
87
88 /**
89 Converts a bytearray list of flag names into flag records.
90 @throws HandlerException on errors during database operations
91 */
92 static Flag::List resolveFlags(const QSet<QByteArray> &flagNames);
93
94 /**
95 Converts a imap set of tags into tag records.
96 @throws HandlerException on errors during database operations
97 */
98 static Tag::List resolveTagsByUID(const QList<qint64> &tags);
99
100 static Tag::List resolveTagsByGID(const QStringList &tagsGIDs);
101
102 static Tag::List resolveTagsByRID(const QStringList &tagsRIDs, const CommandContext &context);
103
104 static Collection collectionFromScope(const Scope &scope, const CommandContext &context);
105
106 static Tag::List tagsFromScope(const Scope &scope, const CommandContext &context);
107};
108
109} // namespace Server
110} // namespace Akonadi
Represents a collection of PIM items.
Definition collection.h:62
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 Mon Nov 4 2024 16:31:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.