• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • Akonadi
  • ItemFetchJob
Public Types | Signals | Public Member Functions | Protected Member Functions | List of all members
Akonadi::ItemFetchJob Class Reference

#include <itemfetchjob.h>

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

Public Types

enum  DeliveryOption { ItemGetter = 0x1, EmitItemsIndividually = 0x2, EmitItemsInBatches = 0x4, Default = ItemGetter | EmitItemsInBatches }
 
- Public Types inherited from Akonadi::Job
enum  Error {
  ConnectionFailed = UserDefinedError, ProtocolVersionMismatch, UserCanceled, Unknown,
  UserError = UserDefinedError + 42
}
 
typedef QList< Job * > List
 

Signals

void itemsReceived (const Akonadi::Item::List &items)
 
- Signals inherited from Akonadi::Job
void aboutToStart (Akonadi::Job *job)
 
void writeFinished (Akonadi::Job *job)
 

Public Member Functions

 ItemFetchJob (const Collection &collection, QObject *parent=0)
 
 ItemFetchJob (const Item &item, QObject *parent=0)
 
 ItemFetchJob (const Item::List &items, QObject *parent=0)
 
 ItemFetchJob (const QList< Item::Id > &items, QObject *parent=0)
 
 ItemFetchJob (const Tag &tag, QObject *parent=0)
 
virtual ~ItemFetchJob ()
 
void clearItems ()
 
int count () const
 
DeliveryOptions deliveryOptions () const
 
ItemFetchScope & fetchScope ()
 
Item::List items () const
 
void setCollection (const Collection &collection)
 
void setDeliveryOption (DeliveryOptions options)
 
void setFetchScope (ItemFetchScope &fetchScope)
 
void setFetchScope (const ItemFetchScope &fetchScope)
 
- Public Member Functions inherited from Akonadi::Job
 Job (QObject *parent=0)
 
virtual ~Job ()
 
virtual QString errorString () const
 
void start ()
 

Protected Member Functions

virtual void doHandleResponse (const QByteArray &tag, const QByteArray &data)
 
virtual void doStart ()
 
- Protected Member Functions inherited from Akonadi::Job
virtual bool addSubjob (KJob *job)
 
virtual bool doKill ()
 
void emitWriteFinished ()
 
virtual bool removeSubjob (KJob *job)
 

Additional Inherited Members

- Protected Slots inherited from Akonadi::Job
virtual void slotResult (KJob *job)
 

Detailed Description

Job that fetches items from the Akonadi storage.

This class is used to fetch items from the Akonadi storage. Which parts of the items (e.g. headers only, attachments or all) can be specified by the ItemFetchScope.

Note that ItemFetchJob does not refresh the Akonadi storage from the backend; this is unnecessary due to the fact that backend updates automatically trigger an update to the Akonadi database whenever they occur (unless the resource is offline).

Note that items can not be created in the root collection (Collection::root()) and therefore can not be fetched from there either. That is - an item fetch in the root collection will yield an empty list.

Example:

// Fetch all items with full payload from a collection
const Collection collection = getCollection();
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob(collection);
connect(job, SIGNAL(result(KJob*)), SLOT(jobFinished(KJob*)));
job->fetchScope().fetchFullPayload();
...
MyClass::jobFinished(KJob *job)
{
if (job->error()) {
qDebug() << "Error occurred";
return;
}
Akonadi::ItemFetchJob *fetchJob = qobject_cast<Akonadi::ItemFetchJob*>(job);
const Akonadi::Item::List items = fetchJob->items();
foreach (const Akonadi::Item &item, items) {
qDebug() << "Item ID:" << item.id();
}
}
Author
Volker Krause vkrau.nosp@m.se@k.nosp@m.de.or.nosp@m.g

Definition at line 82 of file itemfetchjob.h.

Member Enumeration Documentation

enum Akonadi::ItemFetchJob::DeliveryOption
Enumerator
ItemGetter 

items available through items()

EmitItemsIndividually 

emitted via signal upon reception

EmitItemsInBatches 

emitted via signal in bulk (collected and emitted delayed via timer)

Definition at line 222 of file itemfetchjob.h.

Constructor & Destructor Documentation

ItemFetchJob::ItemFetchJob ( const Collection &  collection,
QObject *  parent = 0 
)
explicit

Creates a new item fetch job that retrieves all items inside the given collection.

Parameters
collectionThe parent collection to fetch all items from.
parentThe parent object.

Definition at line 116 of file itemfetchjob.cpp.

ItemFetchJob::ItemFetchJob ( const Item &  item,
QObject *  parent = 0 
)
explicit

Creates a new item fetch job that retrieves the specified item.

If the item has a uid set, this is used to identify the item on the Akonadi server. If only a remote identifier is available, that is used. However, as remote identifiers are not necessarily globally unique, you need to specify the collection to search in in that case, using setCollection().

For internal use only when using remote identifiers, the resource search context can be set globally by ResourceSelectJob.

Parameters
itemThe item to fetch.
parentThe parent object.

Definition at line 126 of file itemfetchjob.cpp.

Akonadi::ItemFetchJob::ItemFetchJob ( const Item::List &  items,
QObject *  parent = 0 
)
explicit

Creates a new item fetch job that retrieves the specified items.

If the items have a uid set, this is used to identify the item on the Akonadi server. If only a remote identifier is available, that is used. However, as remote identifiers are not necessarily globally unique, you need to specify the collection to search in in that case, using setCollection().

For internal use only when using remote identifiers, the resource search context can be set globally by ResourceSelectJob.

Parameters
itemsThe items to fetch.
parentThe parent object.
Since
4.4
Akonadi::ItemFetchJob::ItemFetchJob ( const QList< Item::Id > &  items,
QObject *  parent = 0 
)
explicit

Convenience ctor equivalent to ItemFetchJob(const Item::List &items, QObject *parent = 0)

Since
4.8
ItemFetchJob::ItemFetchJob ( const Tag &  tag,
QObject *  parent = 0 
)
explicit

Creates a new item fetch job that retrieves all items tagged with specified tag.

Parameters
tagThe tag to fetch all items from.
parentThe parent object.
Since
4.14

Definition at line 155 of file itemfetchjob.cpp.

ItemFetchJob::~ItemFetchJob ( )
virtual

Destroys the item fetch job.

Definition at line 165 of file itemfetchjob.cpp.

Member Function Documentation

void ItemFetchJob::clearItems ( )

Save memory by clearing the fetched items.

Since
4.12

Definition at line 240 of file itemfetchjob.cpp.

int ItemFetchJob::count ( ) const

Returns the total number of retrieved items.

This works also without the ItemGetter DeliveryOption.

Since
4.14

Definition at line 289 of file itemfetchjob.cpp.

ItemFetchJob::DeliveryOptions ItemFetchJob::deliveryOptions ( ) const

Returns the delivery options.

Since
4.13

Definition at line 282 of file itemfetchjob.cpp.

void ItemFetchJob::doHandleResponse ( const QByteArray &  tag,
const QByteArray &  data 
)
protectedvirtual

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 from Akonadi::Job.

Definition at line 195 of file itemfetchjob.cpp.

void ItemFetchJob::doStart ( )
protectedvirtual

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.

Implements Akonadi::Job.

Definition at line 169 of file itemfetchjob.cpp.

ItemFetchScope & ItemFetchJob::fetchScope ( )

Returns the item 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 ItemFetchScope documentation for an example.

Returns
a reference to the current item fetch scope
See also
setFetchScope() for replacing the current item fetch scope

Definition at line 261 of file itemfetchjob.cpp.

Item::List ItemFetchJob::items ( ) const

Returns the fetched items.

This returns an empty list when not using the ItemGetter DeliveryOption.

Note
The items are invalid before the result(KJob*) signal has been emitted or if an error occurred.

Definition at line 233 of file itemfetchjob.cpp.

void Akonadi::ItemFetchJob::itemsReceived ( const Akonadi::Item::List &  items)
signal

This signal is emitted whenever new items have been fetched completely.

Note
This is an optimization; instead of waiting for the end of the job and calling items(), you can connect to this signal and get the items incrementally.
Parameters
itemsThe fetched items.
void ItemFetchJob::setCollection ( const Collection &  collection)

Specifies the collection the item is in.

This is only required when retrieving an item based on its remote id which might not be unique globally.

See also
ResourceSelectJob (for internal use only)

Definition at line 268 of file itemfetchjob.cpp.

void ItemFetchJob::setDeliveryOption ( DeliveryOptions  options)

Sets the mechanisms by which the items should be fetched.

Since
4.13

Definition at line 275 of file itemfetchjob.cpp.

void ItemFetchJob::setFetchScope ( ItemFetchScope &  fetchScope)

Sets the item fetch scope.

The ItemFetchScope controls how much of an item's data is fetched from the server, e.g. whether to fetch the full item payload or only meta data.

Parameters
fetchScopeThe new scope for item fetch operations.
See also
fetchScope()

Definition at line 247 of file itemfetchjob.cpp.

void ItemFetchJob::setFetchScope ( const ItemFetchScope &  fetchScope)

Sets the item fetch scope.

The ItemFetchScope controls how much of an item's data is fetched from the server, e.g. whether to fetch the full item payload or only meta data.

Parameters
fetchScopeThe new scope for item fetch operations.
See also
fetchScope()
Since
4.4

Definition at line 254 of file itemfetchjob.cpp.


The documentation for this class was generated from the following files:
  • itemfetchjob.h
  • itemfetchjob.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:05 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

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

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal