ItemFetchJob Class Reference
from PyKDE4.akonadi import *
Inherits: Akonadi.Job → KCompositeJob → KJob → QObject
Namespace: Akonadi
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.
Example:
// Fetch all items with full payload from the root collection Akonadi.ItemFetchJob *job = new Akonadi.ItemFetchJob( Akonadi.Collection.root() ); job->fetchScope().fetchFullPayload(); if ( job->exec() ) { Akonadi.Item.List items = job->items(); foreach( const Akonadi.Item &item, items ) { qDebug() << "Item ID:" << item.id(); } } else { qDebug() << "Error occurred"; }
Signals | |
itemsReceived (Akonadi.Item.List items) | |
Methods | |
__init__ (self, Akonadi.Collection collection, QObject parent=0) | |
__init__ (self, Akonadi.Item item, QObject parent=0) | |
doHandleResponse (self, QByteArray tag, QByteArray data) | |
doStart (self) | |
Akonadi.ItemFetchScope | fetchScope (self) |
Akonadi.Item.List | items (self) |
itemsReceived (self, Akonadi.Item.List items) | |
setCollection (self, Akonadi.Collection collection) | |
setFetchScope (self, Akonadi.ItemFetchScope fetchScope) |
Method Documentation
__init__ | ( | self, | ||
Akonadi.Collection | collection, | |||
QObject | parent=0 | |||
) |
Creates a new item fetch job that retrieves all items inside the given collection.
- Parameters:
-
collection The parent collection to fetch all items from. parent The parent object.
__init__ | ( | self, | ||
Akonadi.Item | item, | |||
QObject | parent=0 | |||
) |
Creates a new item fetch job that retrieves the specified item. If the item has an uid set, this is used to identify the item on the Akonadi server. If only a remote identifier is available, that one is used. However, as remote identifier are not necessarily globally unique, you need to specify the resource and/or collection to search in in that case, using setCollection() or Akonadi.ResourceSelectJob.
- Parameters:
-
item The item to fetch. parent The parent object.
doHandleResponse | ( | self, | ||
QByteArray | tag, | |||
QByteArray | data | |||
) |
doStart | ( | self ) |
Akonadi.ItemFetchScope fetchScope | ( | self ) |
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
Akonadi.Item.List items | ( | self ) |
Returns the fetched item.
- Note:
- The items are invalid before the result( KJob* ) signal has been emitted or if an error occurred.
itemsReceived | ( | self, | ||
Akonadi.Item.List | items | |||
) |
This signal is emitted when the items are fetched completely.
- Parameters:
-
items The fetched items.
- Signal syntax:
QObject.connect(source, SIGNAL("itemsReceived(const List&)"), target_slot)
setCollection | ( | self, | ||
Akonadi.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:
- Akonadi.ResourceSelectJob
setFetchScope | ( | self, | ||
Akonadi.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:
-
fetchScope The new scope for item fetch operations.
- See also:
- fetchScope()