# class Collection

###

Module | akonadi
Namespace | Akonadi
Class | Collection
Inherits | Akonadi::Entity

Represents a collection of PIM items.

This class represents a collection of PIM items, such as a folder on a mail- or groupware-server.

Collections are hierarchical, i.e., they may have a parent collection.

    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>

See also akonadi_concepts_collections "Akonadi Collection Concept"

### enums

- Right { ReadOnly, CanChangeItem, CanCreateItem, CanDeleteItem, CanChangeCollection, CanCreateCollection, CanDeleteCollection, AllRights }

enum details

### methods

- Collection ( )

  returns ctor

  Creates an invalid collection.

- Collection (id)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  id | Id |

  Create a new collection.

  id - The unique identifier of the collection.

- Collection (other)

  returns ctor

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

  Creates a collection from an other collection.

- cachePolicy ( )

  returns Akonadi.CachePolicy

  Returns the cache policy of the collection.

- contentMimeTypes ( )

  returns QStringList

  Returns a list of possible content mimetypes, e.g. message/rfc822, x-akonadi/collection for a mail folder that supports sub-folders.

- fromUrl (url)

  returns Akonadi.Collection
  static

  Argument | Type | Default
  --- | --- | ---
  url | KUrl |

  Creates a collection from the given url.

- mimeType ( )

  returns QString
  static

  Returns the mimetype used for collections.

- name ( )

  returns QString

  Returns the i18n'ed name of the collection.

- parent ( )

  returns Id

  Returns the identifier of the parent collection.

- parentRemoteId ( )

  returns QString

  Returns the parent remote identifier. This usually returns nothing for collections retrieved from the backend.

- resource ( )

  returns QString

  Returns the identifier of the resource owning the collection.

- rights ( )

  returns Akonadi.Collection.Rights

  Returns the rights the user has on the collection.

- root ( )

  returns Akonadi.Collection
  static

  Returns the root collection.

- setCachePolicy (policy)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  policy | Akonadi.CachePolicy |

  Sets the cache policy of the collection.

- setContentMimeTypes (types)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  types | QStringList |

  Sets the list of possible content mime types.

- setName (name)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  name | QString |

  Sets the i18n'ed name of the collection.

  name - The new collection name

- setParent (parent)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  parent | Id |

  Sets the identifier of the parent collection.

- setParent (collection)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  collection | Akonadi.Collection |

  Sets the parent collection.

- setParentRemoteId (identifier)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  identifier | QString |

  Sets the parent's remote identifier.

- setResource (identifier)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  identifier | QString |

  Sets the identifier of the resource owning the collection.

- setRights (rights)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  rights | Akonadi.Collection.Rights |

  Sets the rights the user has on the collection.

- setStatistics (statistics)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  statistics | Akonadi.CollectionStatistics |

  Sets the collection statistics for the collection.

- statistics ( )

  returns Akonadi.CollectionStatistics

  Returns the collection statistics of the collection.

- url ( )

  returns KUrl

  Returns the collection url

### enums - detail

- Right { ReadOnly, CanChangeItem, CanCreateItem, CanDeleteItem, CanChangeCollection, CanCreateCollection, CanDeleteCollection, AllRights }

  Describes rights of a collection.

  | ReadOnly | - 0x0 | - |
  | CanChangeItem | - 0x1 | - |
  | CanCreateItem | - 0x2 | - |
  | CanDeleteItem | - 0x4 | - |
  | CanChangeCollection | - 0x8 | - |
  | CanCreateCollection | - 0x16 | - |
  | CanDeleteCollection | - 0x32 | - |
  | AllRights | - (CanChangeItem|CanCreateItem|CanDeleteItem|CanChangeCollection|CanCreateCollection|CanDeleteCollection) | - |