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 ()
 
CollectionFetchScopeancestorFetchScope ()
 
CollectionFetchScope ancestorFetchScope () const
 
AncestorRetrieval ancestorRetrieval () const
 
QSet< QByteArrayattributes () const
 
QStringList contentMimeTypes () const
 
template<typename T >
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
 
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 );
Job that fetches collections from the Akonadi storage.
CollectionFetchScope & fetchScope()
Returns the collection fetch scope.

Example: replacing a CollectionFetchJob's scope

scope.setIncludeUnsubscribed( true );
job->setFetchScope( scope );
void setFetchScope(const CollectionFetchScope &fetchScope)
Sets the collection fetch scope.
Specifies which parts of a collection should be fetched from the Akonadi storage.

This class is implicitly shared.

Author
Volker Krause vkrau.nosp@m.se@k.nosp@m.de.or.nosp@m.g
Since
4.4

Definition at line 55 of file collectionfetchscope.h.

Member Enumeration Documentation

◆ AncestorRetrieval

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.

◆ ListFilter

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

◆ CollectionFetchScope() [1/2]

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.

◆ CollectionFetchScope() [2/2]

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

Creates a new collection fetch scope from an other.

Definition at line 60 of file collectionfetchscope.cpp.

◆ ~CollectionFetchScope()

Akonadi::CollectionFetchScope::~CollectionFetchScope ( )

Destroys the collection fetch scope.

Definition at line 65 of file collectionfetchscope.cpp.

Member Function Documentation

◆ ancestorFetchScope() [1/2]

CollectionFetchScope & Akonadi::CollectionFetchScope::ancestorFetchScope ( )

Returns the fetch scope for ancestor retrieval.

Definition at line 181 of file collectionfetchscope.cpp.

◆ ancestorFetchScope() [2/2]

CollectionFetchScope Akonadi::CollectionFetchScope::ancestorFetchScope ( ) const
nodiscard

Returns the fetch scope for ancestor retrieval.

Definition at line 173 of file collectionfetchscope.cpp.

◆ ancestorRetrieval()

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

Returns the ancestor retrieval depth.

See also
setAncestorRetrieval()

Definition at line 113 of file collectionfetchscope.cpp.

◆ attributes()

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

Returns all explicitly fetched attributes.

See also
fetchAttribute()

Definition at line 133 of file collectionfetchscope.cpp.

◆ contentMimeTypes()

QStringList Akonadi::CollectionFetchScope::contentMimeTypes ( ) const
nodiscard

Returns the content mimetypes filter.

See also
setContentMimeTypes()

Definition at line 103 of file collectionfetchscope.cpp.

◆ fetchAttribute() [1/2]

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 220 of file collectionfetchscope.h.

◆ fetchAttribute() [2/2]

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.

◆ fetchIdOnly()

bool Akonadi::CollectionFetchScope::fetchIdOnly ( ) const
nodiscard

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.

◆ ignoreRetrievalErrors()

bool Akonadi::CollectionFetchScope::ignoreRetrievalErrors ( ) const
nodiscard

Returns whether retrieval errors should be ignored.

See also
setIgnoreRetrievalErrors()
Since
KF6

Definition at line 163 of file collectionfetchscope.cpp.

◆ includeStatistics()

bool Akonadi::CollectionFetchScope::includeStatistics ( ) const
nodiscard

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

See also
setIncludeStatistics()

Definition at line 83 of file collectionfetchscope.cpp.

◆ isEmpty()

bool Akonadi::CollectionFetchScope::isEmpty ( ) const
nodiscard

Returns true if there is nothing to fetch.

Definition at line 78 of file collectionfetchscope.cpp.

◆ listFilter()

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

Returns the list filter.

See also
setListFilter()
Since
4.14

Definition at line 123 of file collectionfetchscope.cpp.

◆ operator=()

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.

◆ resource()

QString Akonadi::CollectionFetchScope::resource ( ) const
nodiscard

Returns the resource identifier that is used as filter.

See also
setResource()

Definition at line 93 of file collectionfetchscope.cpp.

◆ setAncestorFetchScope()

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.

◆ setAncestorRetrieval()

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.

◆ setContentMimeTypes()

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.

◆ setFetchIdOnly()

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.

◆ setIgnoreRetrievalErrors()

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
KF6

Definition at line 158 of file collectionfetchscope.cpp.

◆ setIncludeStatistics()

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.

◆ setListFilter()

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.

◆ setResource()

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-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.