Akonadi::CollectionFetchScope Class
class Akonadi::CollectionFetchScopeSpecifies which parts of a collection should be fetched from the Akonadi storage. More...
| Header: | #include <Akonadi/CollectionFetchScope> |
| CMake: | find_package(KPim6 REQUIRED COMPONENTS AkonadiCore)target_link_libraries(mytarget PRIVATE KPim6::AkonadiCore) |
Public Types
| enum | AncestorRetrieval { None, Parent, All } |
| enum | ListFilter { NoFilter, Display, Sync, Index, Enabled } |
Public Functions
| CollectionFetchScope() | |
| CollectionFetchScope(const Akonadi::CollectionFetchScope &other) | |
| ~CollectionFetchScope() | |
| Akonadi::CollectionFetchScope & | ancestorFetchScope() |
| Akonadi::CollectionFetchScope | ancestorFetchScope() const |
| Akonadi::CollectionFetchScope::AncestorRetrieval | ancestorRetrieval() const |
| QSet<QByteArray> | attributes() const |
| QStringList | contentMimeTypes() const |
| void | fetchAttribute(bool fetch = true) |
| void | fetchAttribute(const QByteArray &type, bool fetch = true) |
| bool | fetchIdOnly() const |
| bool | ignoreRetrievalErrors() const |
| bool | includeStatistics() const |
| bool | isEmpty() const |
| Akonadi::CollectionFetchScope::ListFilter | listFilter() const |
| QString | resource() const |
| void | setAncestorFetchScope(const Akonadi::CollectionFetchScope &scope) |
| void | setAncestorRetrieval(Akonadi::CollectionFetchScope::AncestorRetrieval ancestorDepth) |
| void | setContentMimeTypes(const QStringList &mimeTypes) |
| void | setFetchIdOnly(bool fetchIdOnly) |
| void | setIgnoreRetrievalErrors(bool enabled) |
| void | setIncludeStatistics(bool include) |
| void | setListFilter(Akonadi::CollectionFetchScope::ListFilter) |
| void | setResource(const QString &resource) |
| Akonadi::CollectionFetchScope & | operator=(const Akonadi::CollectionFetchScope &other) |
Detailed Description
When collections are fetched from the server either by using CollectionFetchJob explicitly or when it is being used internally by other classes, e.g. Akonadi::Monitor, the scope of the fetch operation can be tailored to the application's current needs.
Note that CollectionFetchScope always includes fetching collection attributes.
There are two supported ways of changing the currently active CollectionFetchScope of classes: - in-place: modify the CollectionFetchScope object the other class holds as a member - replace: replace the other class' member with a new scope object
Example: modifying a CollectionFetchJob's scope \ in-place
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob( collection ); job->fetchScope().setIncludeUnsubscribed( true );
Example: \ replacing a CollectionFetchJob's scope
Akonadi::CollectionFetchScope scope; scope.setIncludeUnsubscribed( true ); Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob( collection ); job->setFetchScope( scope );
This class is implicitly shared.
Author: Volker Krause <vkrause@kde.org>
Member Type Documentation
enum CollectionFetchScope::AncestorRetrieval
Describes the ancestor retrieval depth.
enum CollectionFetchScope::ListFilter
Describes the list filter
Member Function Documentation
CollectionFetchScope::CollectionFetchScope()
Creates an empty collection fetch scope.
Using an empty scope will only fetch the very basic meta data of collections, e.g. local id, remote id and content mimetypes.
CollectionFetchScope::CollectionFetchScope(const Akonadi::CollectionFetchScope &other)
Creates a new collection fetch scope from an other.
[noexcept] CollectionFetchScope::~CollectionFetchScope()
Destroys the collection fetch scope.
Akonadi::CollectionFetchScope &CollectionFetchScope::ancestorFetchScope()
Returns the fetch scope for ancestor retrieval.
See also setAncestorFetchScope().
Akonadi::CollectionFetchScope CollectionFetchScope::ancestorFetchScope() const
Returns the fetch scope for ancestor retrieval.
Akonadi::CollectionFetchScope::AncestorRetrieval CollectionFetchScope::ancestorRetrieval() const
Returns the ancestor retrieval depth.
See also setAncestorRetrieval().
QSet<QByteArray> CollectionFetchScope::attributes() const
Returns all explicitly fetched attributes.
See also fetchAttribute().
QStringList CollectionFetchScope::contentMimeTypes() const
Returns the content mimetypes filter.
See also setContentMimeTypes().
template <typename T> void CollectionFetchScope::fetchAttribute(bool fetch = true)
Sets whether the attribute of the requested type should be fetched.
fetch \ true if the attribute should be fetched, \ false otherwise.
void CollectionFetchScope::fetchAttribute(const QByteArray &type, bool fetch = true)
Sets whether the attribute of the given type should be fetched.
type The attribute type to fetch. fetch \ true if the attribute should be fetched, \ false otherwise.
bool CollectionFetchScope::fetchIdOnly() const
Sets whether only the id of the tags should be retrieved or the complete tag.
See also setFetchIdOnly() and tagFetchScope().
bool CollectionFetchScope::ignoreRetrievalErrors() const
Returns whether retrieval errors should be ignored.
See also setIgnoreRetrievalErrors().
bool CollectionFetchScope::includeStatistics() const
Returns whether collection statistics should be included in the retrieved results.
See also setIncludeStatistics().
bool CollectionFetchScope::isEmpty() const
Returns true if there is nothing to fetch.
Akonadi::CollectionFetchScope::ListFilter CollectionFetchScope::listFilter() const
Returns the list filter.
See also setListFilter().
QString CollectionFetchScope::resource() const
Returns the resource identifier that is used as filter.
See also setResource().
void CollectionFetchScope::setAncestorFetchScope(const Akonadi::CollectionFetchScope &scope)
Sets the fetch scope for ancestor retrieval.
See also ancestorFetchScope() and setAncestorRetrieval().
void CollectionFetchScope::setAncestorRetrieval(Akonadi::CollectionFetchScope::AncestorRetrieval ancestorDepth)
Sets how many levels of ancestor collections should be included in the retrieval.
Only the ID and the remote ID of the ancestor collections are fetched. If you want more information about the ancestor collections, like their name, you will need to do an additional CollectionFetchJob for them.
ancestorDepth The desired ancestor retrieval depth.
See also ancestorRetrieval().
void CollectionFetchScope::setContentMimeTypes(const QStringList &mimeTypes)
Sets a content mimetypes filter, that is only collections that contain at least one of the given mimetypes (or their parents) are retrieved.
mimeTypes A list of mime types
See also contentMimeTypes().
void CollectionFetchScope::setFetchIdOnly(bool fetchIdOnly)
Sets whether only the id or the complete tag should be fetched.
The default is \ false.
See also fetchIdOnly().
void CollectionFetchScope::setIgnoreRetrievalErrors(bool enabled)
Ignore retrieval errors while fetching collections, and always deliver what is available.
This flag is useful to fetch a list of collections, where some might no longer be available.
See also ignoreRetrievalErrors().
void CollectionFetchScope::setIncludeStatistics(bool include)
Sets whether collection statistics should be included in the retrieved results.
include \ true to include collection statistics, \ false otherwise (the default).
See also includeStatistics().
void CollectionFetchScope::setListFilter(Akonadi::CollectionFetchScope::ListFilter)
Sets a filter for the collections to be listed.
Note that collections that do not match the filter are included if required to complete the tree.
See also listFilter().
void CollectionFetchScope::setResource(const QString &resource)
Sets a resource filter, that is only collections owned by the specified resource are retrieved.
resource The resource identifier.
See also resource().
Akonadi::CollectionFetchScope &CollectionFetchScope::operator=(const Akonadi::CollectionFetchScope &other)
Assigns the other to this scope and returns a reference to this scope.