KDE 4.2 PyKDE API Reference

- KDE's Python API

# CollectionFetchJob Class Reference

`from PyKDE4.akonadi import *`

Inherits: Akonadi.Job → KCompositeJob → KJob → QObject
Namespace: Akonadi

## Detailed Description

Job that fetches collections from the Akonadi storage.

This class can be used to retrieve the complete or partial collection tree from the Akonadi storage.

     using namespace Akonadi;

     // fetching all collections recursive, starting at the root collection
     CollectionFetchJob *job = new CollectionFetchJob( Collection.root(), CollectionFetchJob.Recursive );
     if ( job->exec() ) {
       Collection.List collections = job->collections();
       foreach( const Collection &collection, collections ) {
         qDebug() << "Name:" << collection.name();
       }
     }

Author:
  Volker Krause <vkrause@kde.org>

## Enumerations

Type | { Base, FirstLevel, Recursive }

## Signals

| collectionsReceived (Akonadi.Collection.List collections)

## Methods

| __init__ (self, Akonadi.Collection collection, Akonadi.CollectionFetchJob.Type type=Akonadi.CollectionFetchJob.FirstLevel, QObject parent=0)
| __init__ (self, Akonadi.Collection.List collections, QObject parent=0)
Akonadi.Collection.List | collections (self)
| collectionsReceived (self, Akonadi.Collection.List collections)
| doHandleResponse (self, QByteArray tag, QByteArray data)
| doStart (self)
| includeUnsubscribed (self, bool include=1)
| setResource (self, QString resource)
| slotResult (self, KJob job)

## Method Documentation

__init__ | ( | self, |
|  | Akonadi.Collection | collection,
|  | Akonadi.CollectionFetchJob.Type | type=Akonadi.CollectionFetchJob.FirstLevel,
|  | QObject | parent=0
| ) |  |  |

Creates a new collection fetch job.

Parameters:

  | collection | The base collection for the listing. Must be valid.
  | type | The type of fetch depth.
  | parent | The parent object.

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

Creates a new collection fetch job to retrieve a list of collections.

Parameters:

  | collections | A list of collections to fetch. Must not be empty, content must be valid.
  | parent | The parent object.

Akonadi.Collection.List collections | ( |  | self ) |

Returns the list of fetched collection.

collectionsReceived | ( | self, |
|  | Akonadi.Collection.List | collections
| ) |  |  |

This signal is emitted whenever the job has received collections.

Parameters:

  | collections | The received collections.

Signal syntax:
  `QObject.connect(source, SIGNAL("collectionsReceived(const List&)"), target_slot)`

doHandleResponse | ( | self, |
|  | QByteArray | tag,
|  | QByteArray | data
| ) |  |  |

doStart | ( |  | self ) |

includeUnsubscribed | ( | self, |
|  | bool | include=1
| ) |  |  |

Include also unsubscribed collections.

setResource | ( | self, |
|  | QString | resource
| ) |  |  |

Sets a resource identifier to limit collection listing to one resource.

Parameters:

  | resource | The resource identifier.

slotResult | ( | self, |
|  | KJob | job
| ) |  |  |

## Enumeration Documentation

Type

Describes the type of fetch depth.

Enumerator:

  Base |
  FirstLevel |
  Recursive |