Akonadi

itemfetchscope.cpp
1 /*
2  SPDX-FileCopyrightText: 2008 Kevin Krammer <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "itemfetchscope.h"
8 
9 #include "itemfetchscope_p.h"
10 
11 
12 using namespace Akonadi;
13 
15 {
16  d = new ItemFetchScopePrivate();
17 }
18 
20  : d(other.d)
21 {
22 }
23 
25 {
26 }
27 
29 {
30  if (&other != this) {
31  d = other.d;
32  }
33 
34  return *this;
35 }
36 
38 {
39  return d->mPayloadParts;
40 }
41 
42 void ItemFetchScope::fetchPayloadPart(const QByteArray &part, bool fetch)
43 {
44  if (fetch) {
45  d->mPayloadParts.insert(part);
46  } else {
47  d->mPayloadParts.remove(part);
48  }
49 }
50 
52 {
53  return d->mFullPayload;
54 }
55 
57 {
58  d->mFullPayload = fetch;
59 }
60 
62 {
63  return d->mAttributes;
64 }
65 
66 void ItemFetchScope::fetchAttribute(const QByteArray &type, bool fetch)
67 {
68  if (fetch) {
69  d->mAttributes.insert(type);
70  } else {
71  d->mAttributes.remove(type);
72  }
73 }
74 
76 {
77  return d->mAllAttributes;
78 }
79 
81 {
82  d->mAllAttributes = fetch;
83 }
84 
86 {
87  return d->mPayloadParts.isEmpty()
88  && d->mAttributes.isEmpty()
89  && !d->mFullPayload
90  && !d->mAllAttributes
91  && !d->mCacheOnly
92  && !d->mCheckCachedPayloadPartsOnly
93  && d->mFetchMtime // true by deafult -> false = non-empty
94  && !d->mIgnoreRetrievalErrors
95  && d->mFetchRid // true by default
96  && !d->mFetchGid
97  && !d->mFetchTags
98  && !d->mFetchVRefs
99  && !d->mFetchRelations
100  && d->mAncestorDepth == AncestorRetrieval::None;
101 }
102 
104 {
105  return d->mCacheOnly;
106 }
107 
109 {
110  d->mCacheOnly = cacheOnly;
111 }
112 
114 {
115  if (check) {
116  setCacheOnly(true);
117  }
118  d->mCheckCachedPayloadPartsOnly = check;
119 }
120 
122 {
123  return d->mCheckCachedPayloadPartsOnly;
124 }
125 
127 {
128  return d->mAncestorDepth;
129 }
130 
132 {
133  d->mAncestorDepth = depth;
134 }
135 
137 {
138  d->mFetchMtime = retrieveMtime;
139 }
140 
142 {
143  return d->mFetchMtime;
144 }
145 
146 void ItemFetchScope::setFetchGid(bool retrieveGid)
147 {
148  d->mFetchGid = retrieveGid;
149 }
150 
152 {
153  return d->mFetchGid;
154 }
155 
157 {
158  d->mIgnoreRetrievalErrors = ignore;
159 }
160 
162 {
163  return d->mIgnoreRetrievalErrors;
164 }
165 
167 {
168  d->mChangedSince = changedSince;
169 }
170 
172 {
173  return d->mChangedSince;
174 }
175 
177 {
178  d->mFetchRid = retrieveRid;
179 }
180 
182 {
183  return d->mFetchRid;
184 }
185 
187 {
188  d->mFetchTags = fetchTags;
189 }
190 
192 {
193  return d->mFetchTags;
194 }
195 
197 {
198  d->mTagFetchScope = tagFetchScope;
199 }
200 
202 {
203  return d->mTagFetchScope;
204 }
205 
207 {
208  return d->mTagFetchScope;
209 }
210 
212 {
213  d->mFetchVRefs = fetchVRefs;
214 }
215 
217 {
218  return d->mFetchVRefs;
219 }
220 
222 {
223  d->mFetchRelations = fetchRelations;
224 }
225 
227 {
228  return d->mFetchRelations;
229 }
void fetchAttribute(const QByteArray &type, bool fetch=true)
Sets whether the attribute of the given type should be fetched.
void setIgnoreRetrievalErrors(bool enabled)
Ignore retrieval errors while fetching items, and always deliver what is available.
AncestorRetrieval ancestorRetrieval() const
Returns the ancestor retrieval depth.
void fetchAllAttributes(bool fetch=true)
Sets whether all available attributes should be fetched.
Specifies which parts of a tag should be fetched from the Akonadi storage.
Definition: tagfetchscope.h:22
void setCheckForCachedPayloadPartsOnly(bool check=true)
Sets whether payload will be fetched or there will be only a test performed if the requested payload ...
bool fullPayload() const
Returns whether the full payload should be fetched.
~ItemFetchScope()
Destroys the item fetch scope.
bool fetchModificationTime() const
Returns whether item modification time should be retrieved.
void fetchFullPayload(bool fetch=true)
Sets whether the full payload shall be fetched.
bool fetchTags() const
Returns whether tags should be retrieved.
void setFetchTags(bool fetchTags)
Fetch tags for items.
ItemFetchScope()
Creates an empty item fetch scope.
void setTagFetchScope(const TagFetchScope &fetchScope)
Sets the tag fetch scope.
AncestorRetrieval
Describes the ancestor retrieval depth.
void setFetchRemoteIdentification(bool retrieveRid)
Fetch remote identification for items.
void setFetchChangedSince(const QDateTime &changedSince)
Only fetch items that were added or modified after given timestamp.
QSet< QByteArray > attributes() const
Returns all explicitly fetched attributes.
bool fetchRemoteIdentification() const
Returns whether item remote identification should be retrieved.
bool isEmpty() const
Returns true if there is nothing to fetch.
QSet< QByteArray > payloadParts() const
Returns the payload parts that should be fetched.
Specifies which parts of an item should be fetched from the Akonadi storage.
void setAncestorRetrieval(AncestorRetrieval ancestorDepth)
Sets how many levels of ancestor collections should be included in the retrieval. ...
bool fetchGid() const
Returns whether item GID should be retrieved.
bool checkForCachedPayloadPartsOnly() const
Returns whether payload data should be fetched or only checked for presence in the cache...
void setFetchRelations(bool fetchRelations)
Fetch relations for items.
bool fetchRelations() const
Returns whether relations should be retrieved.
bool fetchVirtualReferences() const
Returns whether virtual references should be retrieved.
void setFetchModificationTime(bool retrieveMtime)
Enables retrieval of the item modification time.
Helper integration between Akonadi and Qt.
void setFetchGid(bool retrieveGID)
Enables retrieval of the item GID.
bool ignoreRetrievalErrors() const
Returns whether retrieval errors should be ignored.
bool allAttributes() const
Returns whether all available attributes should be fetched.
bool cacheOnly() const
Returns whether payload data should be requested from remote sources or just from the local cache...
TagFetchScope & tagFetchScope()
Returns the tag fetch scope.
void setFetchVirtualReferences(bool fetchVRefs)
Returns whether to fetch list of virtual collections the item is linked to.
ItemFetchScope & operator=(const ItemFetchScope &other)
Assigns the other to this scope and returns a reference to this scope.
void fetchPayloadPart(const QByteArray &part, bool fetch=true)
Sets which payload parts shall be fetched.
QDateTime fetchChangedSince() const
Returns timestamp of the oldest item to fetch.
void setCacheOnly(bool cacheOnly)
Sets whether payload data should be requested from remote sources or just from the local cache...
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jul 4 2020 23:16:51 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.