/usr/include/akonadi/itemfetchscope.h is in kdepimlibs5-dev 4:4.8.5-0ubuntu0.3.
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 | /*
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>
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 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;
/**
* Returns @c true if there is nothing to fetch.
*/
bool isEmpty() const;
private:
//@cond PRIVATE
QSharedDataPointer<ItemFetchScopePrivate> d;
//@endcond
};
}
#endif
|