Akonadi::CollectionFetchScope

Search for usage in LXR

Akonadi::CollectionFetchScope Class Reference

#include <collectionfetchscope.h>

Public Types

enum  AncestorRetrieval { None, Parent, All }
 
enum  ListFilter {
  NoFilter, Display, Sync, Index,
  Enabled
}
 

Public Member Functions

 CollectionFetchScope ()
 
 CollectionFetchScope (const CollectionFetchScope &other)
 
 ~CollectionFetchScope ()
 
CollectionFetchScope ancestorFetchScope () const
 
CollectionFetchScopeancestorFetchScope ()
 
AncestorRetrieval ancestorRetrieval () const
 
QSet< QByteArrayattributes () const
 
QStringList contentMimeTypes () const
 
void fetchAttribute (const QByteArray &type, bool fetch=true)
 
template<typename T >
void fetchAttribute (bool fetch=true)
 
bool fetchIdOnly () const
 
bool ignoreRetrievalErrors () const
 
bool includeStatistics () const
 
bool isEmpty () const
 
ListFilter listFilter () const
 
CollectionFetchScopeoperator= (const CollectionFetchScope &other)
 
QString resource () const
 
void setAncestorFetchScope (const CollectionFetchScope &scope)
 
void setAncestorRetrieval (AncestorRetrieval ancestorDepth)
 
void setContentMimeTypes (const QStringList &mimeTypes)
 
void setFetchIdOnly (bool fetchIdOnly)
 
void setIgnoreRetrievalErrors (bool enabled)
 
void setIncludeStatistics (bool include)
 
void setListFilter (ListFilter)
 
void setResource (const QString &resource)
 

Detailed Description

Specifies which parts of a collection should be fetched from the Akonadi storage.

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

job->fetchScope().setIncludeUnsubscribed( true );

Example: replacing a CollectionFetchJob's scope

scope.setIncludeUnsubscribed( true );
job->setFetchScope( scope );

This class is implicitly shared.

Author
Volker Krause vkrau[email protected][email protected][email protected]de.or[email protected]g
Since
4.4

Definition at line 55 of file collectionfetchscope.h.

Member Enumeration Documentation

Describes the ancestor retrieval depth.

Enumerator
None 

No ancestor retrieval at all (the default)

Parent 

Only retrieve the immediate parent collection.

All 

Retrieve all ancestors, up to Collection::root()

Definition at line 61 of file collectionfetchscope.h.

Describes the list filter.

Since
4.14
Enumerator
NoFilter 

No filtering, retrieve all collections.

Display 

Only retrieve collections for display, taking the local preference and enabled into account.

Sync 

Only retrieve collections for synchronization, taking the local preference and enabled into account.

Index 

Only retrieve collections for indexing, taking the local preference and enabled into account.

Enabled 

Only retrieve enabled collections, ignoring the local preference.

Definition at line 95 of file collectionfetchscope.h.

Constructor & Destructor Documentation

Akonadi::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.

Definition at line 55 of file collectionfetchscope.cpp.

Akonadi::CollectionFetchScope::CollectionFetchScope ( const CollectionFetchScope other)

Creates a new collection fetch scope from an other.

Definition at line 60 of file collectionfetchscope.cpp.

Akonadi::CollectionFetchScope::~CollectionFetchScope ( )

Destroys the collection fetch scope.

Definition at line 65 of file collectionfetchscope.cpp.

Member Function Documentation

CollectionFetchScope Akonadi::CollectionFetchScope::ancestorFetchScope ( ) const

Returns the fetch scope for ancestor retrieval.

Definition at line 173 of file collectionfetchscope.cpp.

CollectionFetchScope & Akonadi::CollectionFetchScope::ancestorFetchScope ( )

Returns the fetch scope for ancestor retrieval.

Definition at line 181 of file collectionfetchscope.cpp.

CollectionFetchScope::AncestorRetrieval Akonadi::CollectionFetchScope::ancestorRetrieval ( ) const

Returns the ancestor retrieval depth.

See also
setAncestorRetrieval()

Definition at line 113 of file collectionfetchscope.cpp.

QSet< QByteArray > Akonadi::CollectionFetchScope::attributes ( ) const

Returns all explicitly fetched attributes.

See also
fetchAttribute()

Definition at line 133 of file collectionfetchscope.cpp.

QStringList Akonadi::CollectionFetchScope::contentMimeTypes ( ) const

Returns the content mimetypes filter.

See also
setContentMimeTypes()

Definition at line 103 of file collectionfetchscope.cpp.

void Akonadi::CollectionFetchScope::fetchAttribute ( const QByteArray type,
bool  fetch = true 
)

Sets whether the attribute of the given type should be fetched.

Parameters
typeThe attribute type to fetch.
fetchtrue if the attribute should be fetched, false otherwise.

Definition at line 138 of file collectionfetchscope.cpp.

template<typename T >
void Akonadi::CollectionFetchScope::fetchAttribute ( bool  fetch = true)
inline

Sets whether the attribute of the requested type should be fetched.

Parameters
fetchtrue if the attribute should be fetched, false otherwise.

Definition at line 219 of file collectionfetchscope.h.

bool Akonadi::CollectionFetchScope::fetchIdOnly ( ) const

Sets whether only the id of the tags should be retrieved or the complete tag.

See also
tagFetchScope()
Since
4.15

Definition at line 153 of file collectionfetchscope.cpp.

bool Akonadi::CollectionFetchScope::ignoreRetrievalErrors ( ) const

Returns whether retrieval errors should be ignored.

See also
setIgnoreRetrievalErrors()
Since
KF5

Definition at line 163 of file collectionfetchscope.cpp.

bool Akonadi::CollectionFetchScope::includeStatistics ( ) const

Returns whether collection statistics should be included in the retrieved results.

See also
setIncludeStatistics()

Definition at line 83 of file collectionfetchscope.cpp.

bool Akonadi::CollectionFetchScope::isEmpty ( ) const

Returns true if there is nothing to fetch.

Definition at line 78 of file collectionfetchscope.cpp.

CollectionFetchScope::ListFilter Akonadi::CollectionFetchScope::listFilter ( ) const

Returns the list filter.

See also
setListFilter()
Since
4.14

Definition at line 123 of file collectionfetchscope.cpp.

CollectionFetchScope & Akonadi::CollectionFetchScope::operator= ( const CollectionFetchScope other)

Assigns the other to this scope and returns a reference to this scope.

Definition at line 69 of file collectionfetchscope.cpp.

QString Akonadi::CollectionFetchScope::resource ( ) const

Returns the resource identifier that is used as filter.

See also
setResource()

Definition at line 93 of file collectionfetchscope.cpp.

void Akonadi::CollectionFetchScope::setAncestorFetchScope ( const CollectionFetchScope scope)

Sets the fetch scope for ancestor retrieval.

See also
setAncestorRetrieval()

Definition at line 168 of file collectionfetchscope.cpp.

void Akonadi::CollectionFetchScope::setAncestorRetrieval ( 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.

Parameters
ancestorDepthThe desired ancestor retrieval depth.

Definition at line 118 of file collectionfetchscope.cpp.

void Akonadi::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.

Parameters
mimeTypesA list of mime types

Definition at line 108 of file collectionfetchscope.cpp.

void Akonadi::CollectionFetchScope::setFetchIdOnly ( bool  fetchIdOnly)

Sets whether only the id or the complete tag should be fetched.

The default is false.

Since
4.15

Definition at line 148 of file collectionfetchscope.cpp.

void Akonadi::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.

Since
KF5

Definition at line 158 of file collectionfetchscope.cpp.

void Akonadi::CollectionFetchScope::setIncludeStatistics ( bool  include)

Sets whether collection statistics should be included in the retrieved results.

Parameters
includetrue to include collection statistics, false otherwise (the default).

Definition at line 88 of file collectionfetchscope.cpp.

void Akonadi::CollectionFetchScope::setListFilter ( CollectionFetchScope::ListFilter  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.

Since
4.14

Definition at line 128 of file collectionfetchscope.cpp.

void Akonadi::CollectionFetchScope::setResource ( const QString resource)

Sets a resource filter, that is only collections owned by the specified resource are retrieved.

Parameters
resourceThe resource identifier.

Definition at line 98 of file collectionfetchscope.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Dec 6 2021 23:07:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.