Akonadi::CollectionCreateJob Class

class Akonadi::CollectionCreateJob

Job that creates a new collection in the Akonadi storage. More...

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

Public Functions

CollectionCreateJob(const Akonadi::Collection &collection, QObject *parent = nullptr)
virtual ~CollectionCreateJob() override
Akonadi::Collection collection() const

Detailed Description

This job creates a new collection with all the set properties. You have to use setParentCollection() to define the collection the new collection shall be located in.

Example:

 using namespace Qt::StringLiterals;

 // create a new top-level collection
 Akonadi::Collection collection;
 collection.setParentCollection(Collection::root());
 collection.setName(u"Events"_s);
 collection.setContentMimeTypes({ u""text/calendar"_s });

 auto job = new Akonadi::CollectionCreateJob(collection);
 connect(job, &KJob::result, this, &MyClass::createResult);
 

Author: Volker Krause <vkrause@kde.org>

Member Function Documentation

[explicit] CollectionCreateJob::CollectionCreateJob(const Akonadi::Collection &collection, QObject *parent = nullptr)

Creates a new collection create job.

collection The new collection. collection must have a parent collection set with a unique identifier. If a resource context is specified in the current session (that is you are using it within Akonadi::ResourceBase), the parent collection can be identified by its remote identifier as well. parent The parent object.

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

Destroys the collection create job.

Akonadi::Collection CollectionCreateJob::collection() const

Returns the created collection if the job was executed successfully.