Akonadi

tagfetchscope.cpp
1/*
2 SPDX-FileCopyrightText: 2014 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "tagfetchscope.h"
8#include <QSet>
9
10using namespace Akonadi;
11
12class Akonadi::TagFetchScopePrivate
13{
14public:
15 TagFetchScopePrivate()
16 {
17 }
18
19 QSet<QByteArray> mAttributes;
20 bool mFetchIdOnly = false;
21 bool mFetchAllAttrs = true;
22 bool mFetchRemotId = false;
23};
24
25TagFetchScope::TagFetchScope()
26 : d(new TagFetchScopePrivate)
27{
28}
29
33
35 : d(new TagFetchScopePrivate)
36{
37 operator=(other);
38}
39
41{
42 d->mAttributes = other.d->mAttributes;
43 d->mFetchIdOnly = other.d->mFetchIdOnly;
44 d->mFetchRemotId = other.d->mFetchRemotId;
45 d->mFetchAllAttrs = other.d->mFetchAllAttrs;
46 return *this;
47}
48
50{
51 return d->mAttributes;
52}
53
54void TagFetchScope::fetchAttribute(const QByteArray &type, bool fetch)
55{
56 if (fetch) {
57 d->mAttributes.insert(type);
58 } else {
59 d->mAttributes.remove(type);
60 }
61}
62
64{
65 d->mFetchIdOnly = idOnly;
66 d->mAttributes.clear();
67}
68
70{
71 return d->mFetchIdOnly;
72}
73
74void TagFetchScope::setFetchRemoteId(bool fetchRemoteId)
75{
76 d->mFetchRemotId = fetchRemoteId;
77}
78
80{
81 return d->mFetchRemotId;
82}
83
85{
86 d->mFetchAllAttrs = fetchAllAttrs;
87}
88
90{
91 return d->mFetchAllAttrs;
92}
Specifies which parts of a tag should be fetched from the Akonadi storage.
~TagFetchScope()
Destroys the tag fetch scope.
void setFetchRemoteId(bool fetchRemoteId)
Sets whether to fetch tag remote ID.
void setFetchAllAttributes(bool fetchAllAttributes)
Sets whether to fetch all attributes.
void fetchAttribute(const QByteArray &type, bool fetch=true)
Sets whether the attribute of the given type should be fetched.
TagFetchScope & operator=(const TagFetchScope &other)
Assigns the other to this scope and returns a reference to this scope.
bool fetchIdOnly() const
Sets whether only the id of the tags should be retrieved or the complete tag.
bool fetchAllAttributes() const
Returns whether to fetch all attributes.
void setFetchIdOnly(bool fetchIdOnly)
Sets whether only the id or the complete tag should be fetched.
TagFetchScope()
Creates an empty tag fetch scope.
QSet< QByteArray > attributes() const
Returns all explicitly fetched attributes.
bool fetchRemoteId() const
Returns whether tag remote ID 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 Fri Dec 13 2024 11:54:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.