akonadi
Akonadi::ItemFetchScope Class Reference
#include <itemfetchscope.h>
Detailed Description
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 in-place
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection ); job->fetchScope().fetchFullPayload(); job->fetchScope().fetchAttribute<MyAttribute>();
Example: replacing
an ItemFetchJob's scope
Akonadi::ItemFetchScope scope; scope.fetchFullPayload(); scope.fetchAttribute<MyAttribute>(); Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection ); job->setFetchScope( scope );
This class is implicitly shared.
Definition at line 67 of file itemfetchscope.h.
Public Member Functions | |
bool | allAttributes () const |
QSet< QByteArray > | attributes () const |
bool | cacheOnly () const |
void | fetchAllAttributes (bool fetch=true) |
template<typename T> | |
void | fetchAttribute (bool fetch=true) |
void | fetchAttribute (const QByteArray &type, bool fetch=true) |
void | fetchFullPayload (bool fetch=true) |
void | fetchPayloadPart (const QByteArray &part, bool fetch=true) |
bool | fullPayload () const |
bool | isEmpty () const |
ItemFetchScope (const ItemFetchScope &other) | |
ItemFetchScope () | |
ItemFetchScope & | operator= (const ItemFetchScope &other) |
QSet< QByteArray > | payloadParts () const |
void | setCacheOnly (bool cacheOnly) |
~ItemFetchScope () |
Constructor & Destructor Documentation
ItemFetchScope::ItemFetchScope | ( | ) |
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
Definition at line 28 of file itemfetchscope.cpp.
ItemFetchScope::ItemFetchScope | ( | const ItemFetchScope & | other | ) |
ItemFetchScope::~ItemFetchScope | ( | ) |
Member Function Documentation
bool ItemFetchScope::allAttributes | ( | ) | const |
Returns whether all available attributes should be fetched.
- See also:
- fetchAllAttributes()
Definition at line 86 of file itemfetchscope.cpp.
QSet< QByteArray > ItemFetchScope::attributes | ( | ) | const |
Returns all explicitly fetched attributes.
Undefined if fetchAllAttributes() returns true.
- See also:
- fetchAttribute()
Definition at line 73 of file itemfetchscope.cpp.
bool ItemFetchScope::cacheOnly | ( | ) | const |
Returns whether payload data should be requested from remote sources or just from the local cache.
- See also:
- setCacheOnly()
Definition at line 101 of file itemfetchscope.cpp.
void ItemFetchScope::fetchAllAttributes | ( | bool | fetch = true |
) |
Sets whether all available attributes should be fetched.
- Parameters:
-
fetch true
if all available attributes should be fetched,false
otherwise.
Definition at line 91 of file itemfetchscope.cpp.
void Akonadi::ItemFetchScope::fetchAttribute | ( | bool | fetch = true |
) | [inline] |
Sets whether the attribute of the requested type should be fetched.
- Parameters:
-
fetch true
if the attribute should be fetched,false
otherwise.
Definition at line 145 of file itemfetchscope.h.
void ItemFetchScope::fetchAttribute | ( | const QByteArray & | type, | |
bool | fetch = true | |||
) |
Sets whether the attribute of the given type
should be fetched.
- Parameters:
-
type The attribute type to fetch. fetch true
if the attribute should be fetched,false
otherwise.
Definition at line 78 of file itemfetchscope.cpp.
void ItemFetchScope::fetchFullPayload | ( | bool | fetch = true |
) |
Sets whether the full payload shall be fetched.
- Parameters:
-
fetch true
if the full payload should be fetched,false
otherwise.
Definition at line 68 of file itemfetchscope.cpp.
void ItemFetchScope::fetchPayloadPart | ( | const QByteArray & | part, | |
bool | fetch = true | |||
) |
Sets which payload parts shall be fetched.
- Parameters:
-
part The payload part identifier. Valid values depend on the item type. fetch true
to fetch this part,false
otherwise.
Definition at line 55 of file itemfetchscope.cpp.
bool ItemFetchScope::fullPayload | ( | ) | const |
Returns whether the full payload should be fetched.
- See also:
- fetchFullPayload()
Definition at line 63 of file itemfetchscope.cpp.
bool ItemFetchScope::isEmpty | ( | ) | const |
ItemFetchScope & ItemFetchScope::operator= | ( | const ItemFetchScope & | other | ) |
Assigns the other
to this scope and returns a reference to this scope.
Definition at line 42 of file itemfetchscope.cpp.
QSet< QByteArray > ItemFetchScope::payloadParts | ( | ) | const |
Returns the payload parts that should be fetched.
- See also:
- fetchPayloadPart()
Definition at line 50 of file itemfetchscope.cpp.
void ItemFetchScope::setCacheOnly | ( | bool | cacheOnly | ) |
Sets whether payload data should be requested from remote sources or just from the local cache.
- Parameters:
-
cacheOnly true
if no remote data should be requested,false
otherwise (the default).
Definition at line 106 of file itemfetchscope.cpp.
The documentation for this class was generated from the following files: