class Job


abstract

Module akonadi
Namespace Akonadi
Class Job
Inherits KCompositeJob
This class encapsulates a request to the pim storage service, the code looks like

Akonadi.Job *job = new Akonadi.SomeJob( some parameter );
connect( job, SIGNAL( result( KJob* ) ),
this, SLOT( slotResult( KJob* ) ) );

The job is queued for execution as soon as the event loop is entered again.

And the slotResult is usually at least:

if ( job->error() )
// handle error...

With the synchronous interface the code looks like

Akonadi.SomeJob *job = new Akonadi.SomeJob( some parameter );
if ( !job->exec() ) {
qDebug() << "Error:" << job->errorString();
} else {
// do something
}

Warning: Using the synchronous method is error prone, use this only if the asynchronous access is not possible and none of the following known issues apply: - exec() must not be called directly from a result slot of another job in the same Session. This will trigger a dead-lock since the program won't return from the result slot and thus will never complete the finishing of the current job, keeping it in the internal queue and blocking the execution of any following job. - exec() must not be called from within another event-loop that might finish before the newly started inner sub-eventloop. This will crash.

Subclasses must reimplement

See also doStart().

KJob-derived objects delete itself, it is thus not possible to create job objects on the stack!



enums

enum details

methods