Akonadi::CollectionFetchJob Class

class Akonadi::CollectionFetchJob

Job that fetches collections from the Akonadi storage. More...

Header: #include <Akonadi/CollectionFetchJob>
CMake: find_package(KPim6 REQUIRED COMPONENTS AkonadiCore)
target_link_libraries(mytarget PRIVATE KPim6::AkonadiCore)
Inherits: Akonadi::Job

Public Types

enum Type { Base, FirstLevel, Recursive, NonOverlappingRoots }

Public Functions

CollectionFetchJob(const QList<Akonadi::Collection::Id> &collections, Akonadi::CollectionFetchJob::Type type = Base, QObject *parent = nullptr)
virtual ~CollectionFetchJob() override
Akonadi::Collection::List collections() const
Akonadi::CollectionFetchScope &fetchScope()
void setFetchScope(const Akonadi::CollectionFetchScope &fetchScope)

Signals

void collectionsReceived(const Akonadi::Collection::List &collections)

Detailed Description

This class can be used to retrieve the complete or partial collection tree from the Akonadi storage. This fetches collection data, not item data.

 using namespace Akonadi;
 using namespace Qt::StringLiterals;

 // fetching all collections containing emails recursively, starting at the root collection
 auto job = new CollectionFetchJob(Collection::root(), CollectionFetchJob::Recursive, this);
 job->fetchScope().setContentMimeTypes({ u"message/rfc822"_s });
 connect(job, &CollectionFetchJob::collectionsReceived, this &MyClass::myCollectionsReceived);
 connect(job, &KJob::result, this, &MyClass::collectionFetchResult);

Author: Volker Krause <vkrause@kde.org>

Member Type Documentation

enum CollectionFetchJob::Type

Describes the type of fetch depth.

Member Function Documentation

[explicit] CollectionFetchJob::CollectionFetchJob(const QList<Akonadi::Collection::Id> &collections, Akonadi::CollectionFetchJob::Type type = Base, QObject *parent = nullptr)

Convenience ctor equivalent to CollectionFetchJob(const Collection::List &collections, Type type, QObject *parent = nullptr) collections list of collection ids type fetch job type parent parent object

[override virtual noexcept] CollectionFetchJob::~CollectionFetchJob()

Destroys the collection fetch job.

Akonadi::Collection::List CollectionFetchJob::collections() const

Returns the list of fetched collection.

[signal] void CollectionFetchJob::collectionsReceived(const Akonadi::Collection::List &collections)

This signal is emitted whenever the job has received collections.

collections The received collections.

Akonadi::CollectionFetchScope &CollectionFetchJob::fetchScope()

Returns the collection fetch scope.

Since this returns a reference it can be used to conveniently modify the current scope in-place, i.e. by calling a method on the returned reference without storing it in a local variable. See the CollectionFetchScope documentation for an example.

Returns a reference to the current collection fetch scope

See also setFetchScope(), for, replacing, the, current, collection, fetch, and scope.

void CollectionFetchJob::setFetchScope(const Akonadi::CollectionFetchScope &fetchScope)

Sets the collection fetch scope.

The CollectionFetchScope controls how much of a collection's data is fetched from the server as well as a filter to select which collections to fetch.

fetchScope The new scope for collection fetch operations.

See also fetchScope().