Akonadi.ItemFetchJob

KDE 4.2 PyKDE API Reference

- KDE's Python API

# 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";
     }

Author:
  Volker Krause <vkrause@kde.org>

## 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)
| setFetchScope (self, Akonadi.ItemFetchScope fetchScope)

## Method Documentation

__init__ | ( | self, |
|  | Akonadi.Collection | collection,
|  | QObject | parent=0
| ) |  |  |

Creates a new item fetch job.

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.

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)`

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()