Akonadi

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

KDE's Doxygen guidelines are available online.