Akonadi

tagfetchscope.h
1/*
2 SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com>
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
13namespace Akonadi
14{
15class TagFetchScopePrivate;
16
17/**
18 * @short Specifies which parts of a tag should be fetched from the Akonadi storage.
19 *
20 * @since 4.13
21 */
22class AKONADICORE_EXPORT TagFetchScope
23{
24public:
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 */
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 */
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 [[nodiscard]] 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 [[nodiscard]] 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 [[nodiscard]] 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>
93 inline void fetchAttribute(bool fetch = true)
94 {
95 T dummy;
96 fetchAttribute(dummy.type(), fetch);
97 }
98
99 /**
100 * Sets whether only the id or the complete tag should be fetched.
101 *
102 * The default is @c false.
103 *
104 * @since 4.15
105 */
106 void setFetchIdOnly(bool fetchIdOnly);
107
108 /**
109 * Sets whether only the id of the tags should be retrieved or the complete tag.
110 *
111 * @see tagFetchScope()
112 * @since 4.15
113 */
114 [[nodiscard]] bool fetchIdOnly() const;
115
116private:
117 /// @cond PRIVATE
119 /// @endcond
120};
121
122}
123
124// Q_DECLARE_METATYPE(Akonadi::TagFetchScope)
Specifies which parts of a tag should be fetched from the Akonadi storage.
void fetchAttribute(bool fetch=true)
Sets whether the attribute of the requested type should be fetched.
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:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.