# class ItemFetchScope

###

Module | akonadi
Namespace | Akonadi
Class | ItemFetchScope
Inherits |

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>

### methods

- ItemFetchScope ( )

  returns ctor

  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

- ItemFetchScope (other)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  other | Akonadi.ItemFetchScope |

  Creates a new item fetch scope from an other.

- allAttributes ( )

  returns bool

  Returns whether all available attributes should be fetched.

  See also fetchAllAttributes()

- attributes ( )

  returns QSet<QByteArray>

  Returns all explicitly fetched attributes.

  Undefined if fetchAllAttributes() returns true.

  See also fetchAttribute()

- cacheOnly ( )

  returns bool

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

  See also setCacheOnly()

- fetchAllAttributes (fetch)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  fetch | bool | 1

  Sets whether all available attributes should be fetched.

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

- fetchAttribute (type, fetch)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  type | QByteArray |
  fetch | bool | 1

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

  type - The attribute type to fetch.

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

- fetchFullPayload (fetch)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  fetch | bool | 1

  Sets whether the full payload shall be fetched.

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

- fetchPayloadPart (part, fetch)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  part | QByteArray |
  fetch | bool | 1

  Sets which payload parts shall be fetched.

  part - The payload part identifier. Valid values depend on the item type.

  fetch - true to fetch this part, false otherwise.

- fullPayload ( )

  returns bool

  Returns whether the full payload should be fetched.

  See also fetchFullPayload()

- isEmpty ( )

  returns bool

  Returns true if there is nothing to fetch.

- payloadParts ( )

  returns QSet<QByteArray>

  Returns the payload parts that should be fetched.

  See also fetchPayloadPart()

- setCacheOnly (cacheOnly)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  cacheOnly | bool |

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

  chacheOnly - true if no remote data should be requested, false otherwise (the default).