/usr/include/akonadi/itemfetchscope.h is in kdepimlibs5-dev 4:4.13.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | /*
Copyright (c) 2008 Kevin Krammer <kevin.krammer@gmx.at>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef ITEMFETCHSCOPE_H
#define ITEMFETCHSCOPE_H
#include "akonadi_export.h"
#include <QtCore/QSharedDataPointer>
#include <KDE/KDateTime>
class QStringList;
template <typename T> class QSet;
namespace Akonadi {
class ItemFetchScopePrivate;
/**
* @short Specifies which parts of an item should be fetched from the Akonadi storage.
*
* When items are fetched from server either by using ItemFetchJob explicitly or
* when it is being used internally by other classes, e.g. ItemModel, the scope
* of the fetch operation can be tailored to the application's current needs.
*
* There are two supported ways of changing the currently active ItemFetchScope
* of classes:
* - in-place: modify the ItemFetchScope object the other class holds as a member
* - replace: replace the other class' member with a new scope object
*
* Example: modifying an ItemFetchJob's scope @c in-place
* @code
* Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection );
* job->fetchScope().fetchFullPayload();
* job->fetchScope().fetchAttribute<MyAttribute>();
* @endcode
*
* Example: @c replacing an ItemFetchJob's scope
* @code
* Akonadi::ItemFetchScope scope;
* scope.fetchFullPayload();
* scope.fetchAttribute<MyAttribute>();
*
* Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection );
* job->setFetchScope( scope );
* @endcode
*
* This class is implicitly shared.
*
* @author Kevin Krammer <kevin.krammer@gmx.at>
*/
class AKONADI_EXPORT ItemFetchScope
{
public:
/**
* Describes the ancestor retrieval depth.
* @since 4.4
*/
enum AncestorRetrieval {
None, ///< No ancestor retrieval at all (the default)
Parent, ///< Only retrieve the immediate parent collection
All ///< Retrieve all ancestors, up to Collection::root()
};
/**
* Creates an empty item fetch scope.
*
* Using an empty scope will only fetch the very basic meta data of items,
* e.g. local id, remote id and mime type
*/
ItemFetchScope();
/**
* Creates a new item fetch scope from an @p other.
*/
ItemFetchScope( const ItemFetchScope &other );
/**
* Destroys the item fetch scope.
*/
~ItemFetchScope();
/**
* Assigns the @p other to this scope and returns a reference to this scope.
*/
ItemFetchScope &operator=( const ItemFetchScope &other );
/**
* Returns the payload parts that should be fetched.
*
* @see fetchPayloadPart()
*/
QSet<QByteArray> payloadParts() const;
/**
* Sets which payload parts shall be fetched.
*
* @param part The payload part identifier.
* Valid values depend on the item type.
* @param fetch @c true to fetch this part, @c false otherwise.
*/
void fetchPayloadPart( const QByteArray &part, bool fetch = true );
/**
* Returns whether the full payload should be fetched.
*
* @see fetchFullPayload()
*/
bool fullPayload() const;
/**
* Sets whether the full payload shall be fetched.
* The default is @c false.
*
* @param fetch @c true if the full payload should be fetched, @c false otherwise.
*/
void fetchFullPayload( bool fetch = true );
/**
* Returns all explicitly fetched attributes.
*
* Undefined if fetchAllAttributes() returns true.
*
* @see fetchAttribute()
*/
QSet<QByteArray> attributes() const;
/**
* Sets whether the attribute of the given @p type should be fetched.
*
* @param type The attribute type to fetch.
* @param fetch @c true if the attribute should be fetched, @c false otherwise.
*/
void fetchAttribute( const QByteArray &type, bool fetch = true );
/**
* Sets whether the attribute of the requested type should be fetched.
*
* @param fetch @c true if the attribute should be fetched, @c false otherwise.
*/
template <typename T> inline void fetchAttribute( bool fetch = true )
{
T dummy;
fetchAttribute( dummy.type(), fetch );
}
/**
* Returns whether all available attributes should be fetched.
*
* @see fetchAllAttributes()
*/
bool allAttributes() const;
/**
* Sets whether all available attributes should be fetched.
* The default is @c false.
*
* @param fetch @c true if all available attributes should be fetched, @c false otherwise.
*/
void fetchAllAttributes( bool fetch = true );
/**
* Returns whether payload data should be requested from remote sources or just
* from the local cache.
*
* @see setCacheOnly()
*/
bool cacheOnly() const;
/**
* Sets whether payload data should be requested from remote sources or just
* from the local cache.
*
* @param cacheOnly @c true if no remote data should be requested,
* @c false otherwise (the default).
*/
void setCacheOnly( bool cacheOnly );
/**
* Sets whether payload will be fetched or there will be only a test performed if the
* requested payload is in the cache. Calling it calls @see setCacheOnly with true automatically.
* Default is fetching the data.
*
* @since 4.11
*/
void setCheckForCachedPayloadPartsOnly( bool check = true );
/**
* Returns whether payload data should be fetched or only checked for presence in the cache.
*
* @see setCheckForCachedPayloadPartsOnly()
*
* @since 4.11
*/
bool checkForCachedPayloadPartsOnly() const;
/**
* Sets how many levels of ancestor collections should be included in the retrieval.
* The default is AncestorRetrieval::None.
*
* @param ancestorDepth The desired ancestor retrieval depth.
* @since 4.4
*/
void setAncestorRetrieval( AncestorRetrieval ancestorDepth );
/**
* Returns the ancestor retrieval depth.
*
* @see setAncestorRetrieval()
* @since 4.4
*/
AncestorRetrieval ancestorRetrieval() const;
/**
* Enables retrieval of the item modification time.
* This is enabled by default for backward compatibility reasons.
*
* @param retrieveMtime @c true to retrieve the modification time, @c false otherwise
* @since 4.6
*/
void setFetchModificationTime( bool retrieveMtime );
/**
* Returns whether item modification time should be retrieved.
*
* @see setFetchModificationTime()
* @since 4.6
*/
bool fetchModificationTime() const;
/**
* Enables retrieval of the item GID.
* This is disabled by default.
*
* @param retrieveGID @c true to retrieve the GID, @c false otherwise
* @since 4.12
*/
void setFetchGid( bool retrieveGID );
/**
* Returns whether item GID should be retrieved.
*
* @see setFetchGid()
* @since 4.12
*/
bool fetchGid() const;
/**
* Ignore retrieval errors while fetching items, and always deliver what is available.
* If items have missing parts and the part can't be retrieved from the resource (i.e. because the system is offline),
* the fetch job would normally just fail. By setting this flag, the errors are ignored,
* and all items which could be fetched completely are returned.
* Note that all items that are returned are completely fetched, and incomplete items are simply ignored.
* This flag is useful for displaying everything that is available, where it is not crucial to have all items.
* Never use this for things like data migration or alike.
*
* @since 4.10
*/
void setIgnoreRetrievalErrors( bool enabled );
/**
* Returns whether retrieval errors should be ignored.
*
* @see setIgnoreRetrievalErrors()
* @since 4.10
*/
bool ignoreRetrievalErrors() const;
/**
* Returns @c true if there is nothing to fetch.
*/
bool isEmpty() const;
/**
* Only fetch items that were added or modified after given timestamp
*
* When this property is set, all results are filtered, i.e. even when you
* request an item with a specific ID, it will not be fetched unless it was
* modified after @p changedSince timestamp.
*
* @param changedSince The timestamp of oldest modified item to fetch
* @since 4.11
*/
void setFetchChangedSince( const KDateTime &changedSince );
/**
* Returns timestamp of the oldest item to fetch.
*/
KDateTime fetchChangedSince() const;
/**
* Fetch remote identification for items.
*
* These include Akonadi::Item::remoteId() and Akonadi::Item::remoteRevision(). This should
* be off for normal clients usually, to save memory (not to mention normal clients should
* not be concerned with these information anyway). It is however crucial for resource agents.
* For backward compatibility the default is @c true.
*
* @param retrieveRid whether or not to load remote identification.
* @since 4.12
*/
void setFetchRemoteIdentification( bool retrieveRid );
/**
* Returns whether item remote identification should be retrieved.
*
* @see setFetchRemoteIdentification()
* @since 4.12
*/
bool fetchRemoteIdentification() const;
/**
* Fetch tags for items.
*
* The fetched tags have only the Tag::id() set and need to be fetched first to access further attributes.
*
* The default is @c false.
*
* @param fetchTags whether or not to load tags.
* @since 4.13
*/
void setFetchTags( bool fetchTags );
/**
* Returns whether tags should be retrieved.
*
* @see setFetchTags()
* @since 4.13
*/
bool fetchTags() const;
private:
//@cond PRIVATE
QSharedDataPointer<ItemFetchScopePrivate> d;
//@endcond
};
}
Q_DECLARE_METATYPE(Akonadi::ItemFetchScope)
#endif
|