Akonadi

tagfetchscope.h
1 /*
2  SPDX-FileCopyrightText: 2014 Christian Mollekopf <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "akonadicore_export.h"
10 
11 #include <QSharedPointer>
12 
13 namespace Akonadi
14 {
15 class TagFetchScopePrivate;
16 
17 /**
18  * @short Specifies which parts of a tag should be fetched from the Akonadi storage.
19  *
20  * @since 4.13
21  */
22 class AKONADICORE_EXPORT TagFetchScope
23 {
24 public:
25  /**
26  * Creates an empty tag fetch scope.
27  *
28  * Using an empty scope will only fetch the very basic meta data of tags,
29  * e.g. local id, remote id and mime type
30  */
31  TagFetchScope();
32 
33  /**
34  * Creates a new tag fetch scope from an @p other.
35  */
36  TagFetchScope(const TagFetchScope &other);
37 
38  /**
39  * Destroys the tag fetch scope.
40  */
41  ~TagFetchScope();
42 
43  /**
44  * Assigns the @p other to this scope and returns a reference to this scope.
45  */
46  TagFetchScope &operator=(const TagFetchScope &other);
47 
48  /**
49  * Returns all explicitly fetched attributes.
50  *
51  * Undefined if fetchAllAttributes() returns true.
52  *
53  * @see fetchAttribute()
54  */
55  Q_REQUIRED_RESULT QSet<QByteArray> attributes() const;
56 
57  /**
58  * Sets whether to fetch tag remote ID.
59  *
60  * This option only has effect for Resources.
61  */
62  void setFetchRemoteId(bool fetchRemoteId);
63 
64  /**
65  * Returns whether tag remote ID should be fetched.
66  */
67  Q_REQUIRED_RESULT bool fetchRemoteId() const;
68 
69  /**
70  * Sets whether to fetch all attributes.
71  */
72  void setFetchAllAttributes(bool fetchAllAttributes);
73 
74  /**
75  * Returns whether to fetch all attributes
76  */
77  Q_REQUIRED_RESULT bool fetchAllAttributes() const;
78 
79  /**
80  * Sets whether the attribute of the given @p type should be fetched.
81  *
82  * @param type The attribute type to fetch.
83  * @param fetch @c true if the attribute should be fetched, @c false otherwise.
84  */
85  void fetchAttribute(const QByteArray &type, bool fetch = true);
86 
87  /**
88  * Sets whether the attribute of the requested type should be fetched.
89  *
90  * @param fetch @c true if the attribute should be fetched, @c false otherwise.
91  */
92  template<typename T> inline void fetchAttribute(bool fetch = true)
93  {
94  T dummy;
95  fetchAttribute(dummy.type(), fetch);
96  }
97 
98  /**
99  * Sets whether only the id or the complete tag should be fetched.
100  *
101  * The default is @c false.
102  *
103  * @since 4.15
104  */
105  void setFetchIdOnly(bool fetchIdOnly);
106 
107  /**
108  * Sets whether only the id of the tags should be retrieved or the complete tag.
109  *
110  * @see tagFetchScope()
111  * @since 4.15
112  */
113  Q_REQUIRED_RESULT bool fetchIdOnly() const;
114 
115 private:
116  /// @cond PRIVATE
118  /// @endcond
119 };
120 
121 }
122 
123 // Q_DECLARE_METATYPE(Akonadi::TagFetchScope)
124 
Specifies which parts of a tag should be fetched from the Akonadi storage.
Definition: tagfetchscope.h:22
void fetchAttribute(bool fetch=true)
Sets whether the attribute of the requested type should be fetched.
Definition: tagfetchscope.h:92
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jul 2 2022 06:41:49 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.