Akonadi.CollectionFetchJob

KDE 4.5 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 containing emails recursively, starting at the root collection
     CollectionFetchJob *job = new CollectionFetchJob( Collection.root(), CollectionFetchJob.Recursive, this );
     job->fetchScope().setContentMimeTypes( QStringList() << "message/rfc822" );
     connect( job, SIGNAL( collectionsReceived( const Akonadi.Collection.List& ) ),
              this, SLOT( myCollectionsReceived( const Akonadi.Collection.List& ) ) );
     connect( job, SIGNAL( result( KJob* ) ), this, SLOT( collectionFetchResult( KJob* ) ) );

Author:
  Volker Krause <vkrause@kde.org>

## Enumerations
Type | { Base, FirstLevel, Recursive }
## Signals
| collectionsReceived ([Akonadi.Collection] collections)
## Methods
| __init__ (self, Akonadi.Collection collection, Akonadi.CollectionFetchJob.Type type=Akonadi.CollectionFetchJob.FirstLevel, QObject parent=0)
| __init__ (self, [Akonadi.Collection] collections, QObject parent=0)
[Akonadi.Collection] | collections (self)
| doHandleResponse (self, QByteArray tag, QByteArray data)
| doStart (self)
Akonadi.CollectionFetchScope | fetchScope (self)
| includeStatistics (self, bool include=1)
| includeUnsubscribed (self, bool include=1)
| setFetchScope (self, Akonadi.CollectionFetchScope fetchScope)
| setResource (self, QString resource)
| slotResult (self, KJob job)

## Signal Documentation

collectionsReceived | ( | [Akonadi.Collection] | collections
| ) |  |  |

This signal is emitted whenever the job has received collections.

Parameters:

  | collections | The received collections.

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

## Method Documentation

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

Creates a new collection fetch job. If the given base collection has a unique identifier, this is used to identify the collection in the Akonadi server. If only a remote identifier is avaiable the collection is identified using that, given a resource search context has been specified. There two ways of doing that: by calling setResource() or globally using Akonadi.ResourceSelectJob.

Parameters:

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

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

Creates a new collection fetch job to retrieve a list of collections. The same rules for identifiers apply as noted in the constructor above.

Parameters:

  | collections | A list of collections to fetch. Must not be empty.
  | parent | The parent object.

[Akonadi.Collection] collections | ( |  | self ) |

Returns the list of fetched collection.

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

doStart | ( |  | self ) |

Akonadi.CollectionFetchScope fetchScope | ( |  | self ) |

Returns the collection 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 CollectionFetchScope documentation for an example.

Returns:
  a reference to the current collection fetch scope

See also:
  setFetchScope() for replacing the current collection fetch scope

Since:
  4.4

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

Include also statistics about the collections.

Since:
  4.3

Deprecated:
  Use CollectionFetchScope instead.

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

Include also unsubscribed collections.

Deprecated:
  Use CollectionFetchScope instead.

setFetchScope | ( | self, |
|  | Akonadi.CollectionFetchScope | fetchScope
| ) |  |  |

Sets the collection fetch scope.

The CollectionFetchScope controls how much of a collection's data is fetched from the server as well as filter to select which collections to fetch.

Parameters:

  | fetchScope | The new scope for collection fetch operations.

See also:
  fetchScope()

Since:
  4.4

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

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

Parameters:

  | resource | The resource identifier.

Deprecated:
  Use CollectionFetchScope instead.

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

## Enumeration Documentation

Type

Describes the type of fetch depth.

Enumerator:

  CreateCollection |
  CopyCollections |
  DeleteCollections |
  SynchronizeCollections |
  CollectionProperties |
  CopyItems |
  Paste |
  DeleteItems |
  ManageLocalSubscriptions |
  AddToFavoriteCollections |
  RemoveFromFavoriteCollections |
  RenameFavoriteCollection |
  CopyCollectionToMenu |
  CopyItemToMenu |
  MoveItemToMenu |
  MoveCollectionToMenu |
  CutItems |
  CutCollections |
  LastType |