Akonadi.ItemFetchScope

KDE 4.5 PyKDE API Reference

- KDE's Python API

# ItemFetchScope Class Reference

`from PyKDE4.akonadi import *`

Namespace: Akonadi

## Detailed Description

Specifies which parts of an item should be fetched from the Akonadi storage.

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

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

Example: modifying an ItemFetchJob's scope in-place

     Akonadi.ItemFetchJob *job = new Akonadi.ItemFetchJob( collection );
     job->fetchScope().fetchFullPayload();
     job->fetchScope().fetchAttribute<MyAttribute>();

Example: replacing an ItemFetchJob's scope

     Akonadi.ItemFetchScope scope;
     scope.fetchFullPayload();
     scope.fetchAttribute<MyAttribute>();

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

This class is implicitly shared.

Author:
  Kevin Krammer <kevin.krammer@gmx.at>

## Enumerations
AncestorRetrieval | { None, Parent, All }
## Methods
| __init__ (self)
| __init__ (self, Akonadi.ItemFetchScope other)
bool | allAttributes (self)
Akonadi.ItemFetchScope.AncestorRetrieval | ancestorRetrieval (self)
QSet | attributes (self)
bool | cacheOnly (self)
| fetchAllAttributes (self, bool fetch=1)
| fetchAttribute (self, QByteArray type, bool fetch=1)
| fetchFullPayload (self, bool fetch=1)
| fetchPayloadPart (self, QByteArray part, bool fetch=1)
bool | fullPayload (self)
bool | isEmpty (self)
QSet | payloadParts (self)
| setAncestorRetrieval (self, Akonadi.ItemFetchScope.AncestorRetrieval ancestorDepth)
| setCacheOnly (self, bool cacheOnly)

## Method Documentation

__init__ | ( |  | self ) |

Creates an empty item fetch scope.

Using an empty scope will only fetch the very basic meta data of items, e.g. local id, remote id and mime type

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

Creates a new item fetch scope from an other.

bool allAttributes | ( |  | self ) |

Returns whether all available attributes should be fetched.

See also:
  fetchAllAttributes()

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

Returns the ancestor retrieval depth.

See also:
  setAncestorRetrieval()

Since:
  4.4

QSet attributes | ( |  | self ) |

Returns all explicitly fetched attributes.

Undefined if fetchAllAttributes() returns true.

See also:
  fetchAttribute()

bool cacheOnly | ( |  | self ) |

Returns whether payload data should be requested from remote sources or just from the local cache.

See also:
  setCacheOnly()

fetchAllAttributes | ( | self, |
|  | bool | fetch=1
| ) |  |  |

Sets whether all available attributes should be fetched. The default is false.

Parameters:

  | fetch | true if all available attributes should be fetched, false otherwise.

fetchAttribute | ( | self, |
|  | QByteArray | type,
|  | bool | fetch=1
| ) |  |  |

Sets whether the attribute of the requested type should be fetched.

Parameters:

  | fetch | true if the attribute should be fetched, false otherwise.

fetchFullPayload | ( | self, |
|  | bool | fetch=1
| ) |  |  |

Sets whether the full payload shall be fetched. The default is false.

Parameters:

  | fetch | true if the full payload should be fetched, false otherwise.

fetchPayloadPart | ( | self, |
|  | QByteArray | part,
|  | bool | fetch=1
| ) |  |  |

Sets which payload parts shall be fetched.

Parameters:

  | part | The payload part identifier. Valid values depend on the item type.
  | fetch | true to fetch this part, false otherwise.

bool fullPayload | ( |  | self ) |

Returns whether the full payload should be fetched.

See also:
  fetchFullPayload()

bool isEmpty | ( |  | self ) |

Returns true if there is nothing to fetch.

QSet payloadParts | ( |  | self ) |

Returns the payload parts that should be fetched.

See also:
  fetchPayloadPart()

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

Sets how many levels of ancestor collections should be included in the retrieval. The default is AncestorRetrieval.None.

Parameters:

  | ancestorDepth | The desired ancestor retrieval depth.

Since:
  4.4

setCacheOnly | ( | self, |
|  | bool | cacheOnly
| ) |  |  |

Sets whether payload data should be requested from remote sources or just from the local cache.

Parameters:

  | cacheOnly | true if no remote data should be requested,

false otherwise (the default).

## Enumeration Documentation

AncestorRetrieval

Describes the ancestor retrieval depth.

Since:
  4.4

Enumerator:

  None |
  Parent |
  All |