• Skip to content
  • Skip to link menu
KDE 4.8 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

akonadi

  • Akonadi
  • Job
Public Types | Signals | Public Member Functions | Protected Slots | Protected Member Functions
Akonadi::Job Class Reference

#include <job.h>

Inheritance diagram for Akonadi::Job:
Inheritance graph
[legend]

List of all members.

Public Types

enum  Error {
  ConnectionFailed = UserDefinedError, ProtocolVersionMismatch, UserCanceled, Unknown,
  UserError = UserDefinedError + 42
}
typedef QList< Job * > List

Signals

void aboutToStart (Akonadi::Job *job)
void writeFinished (Akonadi::Job *job)

Public Member Functions

 Job (QObject *parent=0)
virtual ~Job ()
virtual QString errorString () const
void start ()

Protected Slots

virtual void slotResult (KJob *job)

Protected Member Functions

virtual bool addSubjob (KJob *job)
virtual void doHandleResponse (const QByteArray &tag, const QByteArray &data)
virtual bool doKill ()
virtual void doStart ()=0
void emitWriteFinished ()
virtual bool removeSubjob (KJob *job)

Detailed Description

Base class for all actions in the Akonadi storage.

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. See the documentation of KJob::exec() for more details.

Subclasses must reimplement doStart().

Note:
KJob-derived objects delete itself, it is thus not possible to create job objects on the stack!
Author:
Volker Krause <vkrause@kde.org>, Tobias Koenig <tokoe@kde.org>, Marc Mutz <mutz@kde.org>

Definition at line 86 of file job.h.


Member Typedef Documentation

typedef QList<Job*> Akonadi::Job::List

Describes a list of jobs.

Definition at line 97 of file job.h.


Member Enumeration Documentation

enum Akonadi::Job::Error

Describes the error codes that can be emitted by this class.

Subclasses can provide additional codes, starting from UserError onwards

Enumerator:
ConnectionFailed 

The connection to the Akonadi server failed.

ProtocolVersionMismatch 

The server protocol version is too old or too new.

UserCanceled 

The user canceld this job.

Unknown 

Unknown error.

UserError 

Starting point for error codes defined by sub-classes.

Definition at line 104 of file job.h.


Constructor & Destructor Documentation

Job::Job ( QObject *  parent = 0) [explicit]

Creates a new job.

If the parent object is a Job object, the new job will be a subjob of parent. If the parent object is a Session object, it will be used for server communication instead of the default session.

Parameters:
parentThe parent object, job or session.

Definition at line 238 of file job.cpp.

Job::~Job ( ) [virtual]

Destroys the job.

Definition at line 252 of file job.cpp.


Member Function Documentation

void Akonadi::Job::aboutToStart ( Akonadi::Job *  job) [signal]

This signal is emitted directly before the job will be started.

Parameters:
jobThe started job.
bool Job::addSubjob ( KJob *  job) [protected, virtual]

Adds the given job as a subjob to this job.

This method is automatically called if you construct a job using another job as parent object. The base implementation does the necessary setup to share the network connection with the backend.

Parameters:
jobThe new subjob.

Reimplemented in Akonadi::TransactionSequence.

Definition at line 302 of file job.cpp.

void Job::doHandleResponse ( const QByteArray &  tag,
const QByteArray &  data 
) [protected, virtual]

This method should be reimplemented in the concrete jobs in case you want to handle incoming data.

It will be called on received data from the backend. The default implementation does nothing.

Parameters:
tagThe tag of the corresponding command, empty if this is an untagged response.
dataThe received data.

Reimplemented in Akonadi::ItemFetchJob, Akonadi::ItemModifyJob, Akonadi::CollectionFetchJob, Akonadi::ItemSearchJob, Akonadi::SearchCreateJob, Akonadi::ItemCreateJob, Akonadi::CollectionStatisticsJob, Akonadi::CollectionCreateJob, and Akonadi::SubscriptionJob.

Definition at line 322 of file job.cpp.

bool Job::doKill ( ) [protected, virtual]

Kills the execution of the job.

Definition at line 269 of file job.cpp.

virtual void Akonadi::Job::doStart ( ) [protected, pure virtual]

This method must be reimplemented in the concrete jobs.

It will be called after the job has been started and a connection to the Akonadi backend has been established.

Implemented in Akonadi::ItemFetchJob, Akonadi::ItemModifyJob, Akonadi::CollectionFetchJob, Akonadi::ItemSync, Akonadi::DefaultResourceJob, Akonadi::ItemSearchJob, Akonadi::TransactionCommitJob, Akonadi::TrashJob, Akonadi::TransactionSequence, Akonadi::SpecialCollectionsRequestJob, Akonadi::ItemDeleteJob, Akonadi::CollectionModifyJob, Akonadi::CollectionSync, Akonadi::TransactionRollbackJob, Akonadi::ItemCreateJob, Akonadi::SearchCreateJob, Akonadi::ResourceSelectJob, Akonadi::CollectionStatisticsJob, Akonadi::ItemMoveJob, Akonadi::ItemCopyJob, Akonadi::CollectionDeleteJob, Akonadi::CollectionPathResolver, Akonadi::LinkJob, Akonadi::ResourceScanJob, Akonadi::UnlinkJob, Akonadi::TrashRestoreJob, Akonadi::CollectionCreateJob, Akonadi::CollectionCopyJob, Akonadi::SubscriptionJob, Akonadi::CollectionMoveJob, Akonadi::TransactionBeginJob, Akonadi::CollectionSelectJob, and Akonadi::InvalidateCacheJob.

void Job::emitWriteFinished ( ) [protected]

Call this method to indicate that this job will not call writeData() again.

See also:
writeFinished()

Definition at line 343 of file job.cpp.

QString Job::errorString ( ) const [virtual]

Returns the error string, if there has been an error, an empty string otherwise.

Definition at line 276 of file job.cpp.

bool Job::removeSubjob ( KJob *  job) [protected, virtual]

Removes the given subjob of this job.

Parameters:
jobThe subjob to remove.

Definition at line 312 of file job.cpp.

void Job::start ( )

Jobs are started automatically once entering the event loop again, no need to explicitly call this.

Definition at line 265 of file job.cpp.

void Akonadi::Job::writeFinished ( Akonadi::Job *  job) [signal]

This signal is emitted if the job has finished all write operations, ie.

if this signal is emitted, the job guarantees to not call writeData() again. Do not emit this signal directly, call emitWriteFinished() instead.

Parameters:
jobThis job.
See also:
emitWriteFinished()

The documentation for this class was generated from the following files:
  • job.h
  • job.cpp

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal