Akonadi::ResourceSynchronizationJob Class

class Akonadi::ResourceSynchronizationJob

Job that synchronizes a resource. More...

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

Public Functions

ResourceSynchronizationJob(const Akonadi::AgentInstance &instance, QObject *parent = nullptr)
virtual ~ResourceSynchronizationJob() override
bool collectionTreeOnly() const
Akonadi::AgentInstance resource() const
void setCollectionTreeOnly(bool collectionTreeOnly)
int timeoutCountLimit() const

Detailed Description

This job will trigger a resource to synchronize the backend it is responsible for (e.g. a local file or a groupware server) with the Akonadi storage.

If you only want to trigger the synchronization without being interested in the result, using Akonadi::AgentInstance::synchronize() is enough. If you want to wait until it's finished, use this class.

Example:

 using namespace Akonadi;

 const AgentInstance resource = AgentManager::self()->instance( "myresourceidentifier" );

 ResourceSynchronizationJob *job = new ResourceSynchronizationJob( resource );
 connect(job, &KJob::result, this, &MyClass::synchronizationFinished);
 job->start();

Note: This is a KJob, not an Akonadi::Job, so it won't auto-start!

Author: Volker Krause <vkrause@kde.org>

Member Function Documentation

[explicit] ResourceSynchronizationJob::ResourceSynchronizationJob(const Akonadi::AgentInstance &instance, QObject *parent = nullptr)

Creates a new synchronization job for the given resource.

instance The resource instance to synchronize.

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

Destroys the synchronization job.

bool ResourceSynchronizationJob::collectionTreeOnly() const

Returns whether a full synchronization will be done, or just the collection tree (without items). The default is \ false, i.e. a full sync will be requested.

See also setCollectionTreeOnly().

Akonadi::AgentInstance ResourceSynchronizationJob::resource() const

Returns the resource that has been synchronized.

void ResourceSynchronizationJob::setCollectionTreeOnly(bool collectionTreeOnly)

Sets the collectionTreeOnly property.

collectionTreeOnly If set, only the collection tree will be synchronized.

See also collectionTreeOnly().

int ResourceSynchronizationJob::timeoutCountLimit() const