Akonadi

collectionfetchhandler.h
1/*
2 SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "entities.h"
10#include "handler.h"
11
12template<typename T>
13class QStack;
14
15namespace Akonadi
16{
17namespace Server
18{
19/**
20 @ingroup akonadi_server_handler
21
22 Handler for the LIST command.
23
24 This command is used to get a (limited) listing of the available collections.
25 It is different from the LIST command and is more similar to FETCH.
26
27 The @c RID command prefix indicates that @c collection-id is a remote identifier
28 instead of a unique identifier. In this case a resource context has to be specified
29 previously using the @c RESSELECT command.
30
31 @c depths chooses between recursive (@c INF), flat (1) and local (0, ie. just the
32 base collection) listing, 0 indicates the root collection.
33
34 The @c filter-list is used to restrict the listing to collection of a specific
35 resource or content type.
36
37 The @c option-list allows to specify the response content to some extend:
38 - @c STATISTICS (boolean) allows to include the collection statistics (see Status)
39 - @c ANCESTORDEPTH (numeric) allows you to specify the number of ancestor nodes that
40 should be included additionally to the @c parent-id included anyway.
41 Possible values are @c 0 (the default), @c 1 for the direct parent node and @c INF for all,
42 terminating with the root collection.
43
44 The name is encoded as an quoted UTF-8 string. There is no order defined for the
45 single responses.
46
47 The ancestors property is encoded as a list of UID/RID pairs.
48*/
50{
51public:
52 CollectionFetchHandler(AkonadiServer &akonadi);
53 ~CollectionFetchHandler() override = default;
54
55 bool parseStream() override;
56
57private:
58 void listCollection(const Collection &root, const QStack<Collection> &ancestors, const QStringList &mimeTypes, const CollectionAttribute::List &attributes);
59 QStack<Collection> ancestorsForCollection(const Collection &col);
60 void retrieveCollections(const Collection &topParent, int depth);
61 bool checkFilterCondition(const Collection &col) const;
62 CollectionAttribute::List getAttributes(const Collection &colId, const QSet<QByteArray> &filter = QSet<QByteArray>());
63 void retrieveAttributes(const QVariantList &collectionIds);
64
65 Resource mResource;
66 QList<MimeType::Id> mMimeTypes;
67 int mAncestorDepth = 0;
68 bool mIncludeStatistics = false;
69 bool mEnabledCollections = false;
70 bool mCollectionsToDisplay = false;
71 bool mCollectionsToSynchronize = false;
72 bool mCollectionsToIndex = false;
73 QSet<QByteArray> mAncestorAttributes;
74 QMap<qint64 /*id*/, Collection> mCollections;
75 QHash<qint64 /*id*/, Collection> mAncestors;
76 QMultiHash<qint64 /*collectionId*/, CollectionAttribute /*mimetypeId*/> mCollectionAttributes;
77};
78
79} // namespace Server
80} // namespace Akonadi
Represents a collection of PIM items.
Definition collection.h:62
bool parseStream() override
Parse and handle the IMAP message using the streaming parser.
The handler interfaces describes an entity capable of handling an AkonadiIMAP command.
Definition handler.h:32
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.