KDE 4.9 PyKDE API Reference

- KDE's Python API

# CollectionFetchScope Class Reference

`from PyKDE4.akonadi import *`

Namespace: Akonadi

## Detailed Description

Specifies which parts of a collection should be fetched from the Akonadi storage.

When collections are fetched from the server either by using CollectionFetchJob explicitly or when it is being used internally by other classes, e.g. Akonadi.Monitor, the scope of the fetch operation can be tailored to the application's current needs.

Note that CollectionFetchScope always includes fetching collection attributes.

There are two supported ways of changing the currently active CollectionFetchScope of classes: - in-place: modify the CollectionFetchScope object the other class holds as a member - replace: replace the other class' member with a new scope object

Example: modifying a CollectionFetchJob's scope in-place

     Akonadi.CollectionFetchJob *job = new Akonadi.CollectionFetchJob( collection );
     job->fetchScope().setIncludeUnsubscribed( true );

Example: replacing a CollectionFetchJob's scope

     Akonadi.CollectionFetchScope scope;
     scope.setIncludeUnsubscribed( true );

     Akonadi.CollectionFetchJob *job = new Akonadi.CollectionFetchJob( collection );
     job->setFetchScope( scope );

This class is implicitly shared.

Author:
  Volker Krause <vkrause@kde.org>

Since:
  4.4

## Enumerations

AncestorRetrieval | { None, Parent, All }

## Methods

| __init__ (self)
| __init__ (self, Akonadi.CollectionFetchScope other)
Akonadi.CollectionFetchScope.AncestorRetrieval | ancestorRetrieval (self)
QStringList | contentMimeTypes (self)
bool | includeStatistics (self)
bool | includeUnsubscribed (self)
bool | includeUnubscribed (self)
bool | isEmpty (self)
QString | resource (self)
| setAncestorRetrieval (self, Akonadi.CollectionFetchScope.AncestorRetrieval ancestorDepth)
| setContentMimeTypes (self, QStringList mimeTypes)
| setIncludeStatistics (self, bool include)
| setIncludeUnsubscribed (self, bool include)
| setResource (self, QString resource)

## Method Documentation

__init__ | ( |  | self ) |

Creates an empty collection fetch scope.

Using an empty scope will only fetch the very basic meta data of collections, e.g. local id, remote id and content mimetypes.

__init__ | ( | self, |
|  | Akonadi.CollectionFetchScope | other
| ) |  |  |

Creates a new collection fetch scope from an other.

Akonadi.CollectionFetchScope.AncestorRetrieval ancestorRetrieval | ( |  | self ) |

Returns the ancestor retrieval depth.

See also:
  setAncestorRetrieval()

QStringList contentMimeTypes | ( |  | self ) |

Returns the content mimetypes filter.

See also:
  setContentMimeTypes()

bool includeStatistics | ( |  | self ) |

Returns whether collection statistics should be included in the retrieved results.

See also:
  setIncludeStatistics()

bool includeUnsubscribed | ( |  | self ) |

Returns whether unsubscribed collection should be included.

See also:
  setIncludeUnsubscribed()

Since:
  4.5

bool includeUnubscribed | ( |  | self ) |

Returns whether unsubscribed collection should be included.

Deprecated:
  Use includeUnsubscribed()

bool isEmpty | ( |  | self ) |

Returns true if there is nothing to fetch.

QString resource | ( |  | self ) |

Returns the resource identifier that is used as filter.

See also:
  setResource()

setAncestorRetrieval | ( | self, |
|  | Akonadi.CollectionFetchScope.AncestorRetrieval | ancestorDepth
| ) |  |  |

Sets how many levels of ancestor collections should be included in the retrieval.

Only the ID and the remote ID of the ancestor collections are fetched. If you want more information about the ancestor collections, like their name, you will need to do an additional CollectionFetchJob for them.

Parameters:

  | ancestorDepth | The desired ancestor retrieval depth.

setContentMimeTypes | ( | self, |
|  | QStringList | mimeTypes
| ) |  |  |

Sets a content mimetypes filter, that is only collections that contain at least one of the given mimetypes (or their parents) are retrieved.

Parameters:

  | mimeTypes | A list of mime types

setIncludeStatistics | ( | self, |
|  | bool | include
| ) |  |  |

Sets whether collection statistics should be included in the retrieved results.

Parameters:

  | include | true to include collction statistics, false otherwise (the default).

setIncludeUnsubscribed | ( | self, |
|  | bool | include
| ) |  |  |

Sets whether unsubscribed collections should be included in the collection listing.

Parameters:

  | include | true to include unsubscribed collections, false otherwise (the default).

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

Sets a resource filter, that is only collections owned by the specified resource are retrieved.

Parameters:

  | resource | The resource identifier.

## Enumeration Documentation

AncestorRetrieval

Describes the ancestor retrieval depth.

Enumerator:

  None |
  Parent |
  All |