Collection Class Reference
from PyKDE4.akonadi import *
Inherits: Akonadi.Entity
Namespace: Akonadi
Detailed Description
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 );
 connect( job, SIGNAL( result( KJob* ) ), SLOT( fetchFinished( KJob* ) ) );
 ...
 MyClass.fetchFinished( KJob *job )
 {
   if ( job->error() ) {
     qDebug() << "Error occurred";
     return;
   }
   CollectionFetchJob *fetchJob = qobject_cast<CollectionFetchJob*>( job );
   const Collection.List collections = fetchJob->collections();
   foreach ( const Collection &collection, collections ) {
     qDebug() << "Name:" << collection.name();
   }
 }
| Enumerations | |
| Right | { ReadOnly, CanChangeItem, CanCreateItem, CanDeleteItem, CanChangeCollection, CanCreateCollection, CanDeleteCollection, CanLinkItem, CanUnlinkItem, AllRights } | 
| UrlType | { UrlShort, UrlWithName } | 
| Methods | |
| __init__ (self) | |
| __init__ (self, Akonadi.Collection other) | |
| __init__ (self, long id) | |
| Akonadi.CachePolicy | cachePolicy (self) | 
| QStringList | contentMimeTypes (self) | 
| bool | isVirtual (self) | 
| QString | name (self) | 
| Id | parent (self) | 
| QString | parentRemoteId (self) | 
| QString | resource (self) | 
| Akonadi.Collection.Rights | rights (self) | 
| setCachePolicy (self, Akonadi.CachePolicy policy) | |
| setContentMimeTypes (self, QStringList types) | |
| setName (self, QString name) | |
| setParent (self, Akonadi.Collection collection) | |
| setParent (self, long parent) | |
| setParentRemoteId (self, QString identifier) | |
| setResource (self, QString identifier) | |
| setRights (self, Akonadi.Collection.Rights rights) | |
| setStatistics (self, Akonadi.CollectionStatistics statistics) | |
| Akonadi.CollectionStatistics | statistics (self) | 
| KUrl | url (self) | 
| KUrl | url (self, Akonadi.Collection.UrlType type) | 
| Static Methods | |
| Akonadi.Collection | fromUrl (KUrl url) | 
| QString | mimeType () | 
| Akonadi.Collection | root () | 
Method Documentation
| __init__ | ( | self ) | 
Creates an invalid collection.
| __init__ | ( | self, | ||
| Akonadi.Collection | other | |||
| ) | 
Creates a collection from an other collection.
| __init__ | ( | self, | ||
| long | id | |||
| ) | 
Create a new collection.
- Parameters:
- 
id The unique identifier of the collection. 
| Akonadi.CachePolicy cachePolicy | ( | self ) | 
Returns the cache policy of the collection.
| QStringList contentMimeTypes | ( | self ) | 
Returns a list of possible content mimetypes, e.g. message/rfc822, x-akonadi/collection for a mail folder that supports sub-folders.
| bool isVirtual | ( | self ) | 
Returns whether the collection is virtual, for example a search collection.
- Since:
- 4.6
| QString name | ( | self ) | 
Returns the i18n'ed name of the collection.
| Id parent | ( | self ) | 
Returns the identifier of the parent collection.
- Deprecated:
- Use parentCollection()
| QString parentRemoteId | ( | self ) | 
Returns the parent remote identifier.
- Note:
- This usually returns nothing for collections retrieved from the backend.
- Deprecated:
- Use parentCollection()
| QString resource | ( | self ) | 
Returns the identifier of the resource owning the collection.
| Akonadi.Collection.Rights rights | ( | self ) | 
Returns the rights the user has on the collection.
| setCachePolicy | ( | self, | ||
| Akonadi.CachePolicy | policy | |||
| ) | 
Sets the cache policy of the collection.
| setContentMimeTypes | ( | self, | ||
| QStringList | types | |||
| ) | 
Sets the list of possible content mime types.
| setName | ( | self, | ||
| QString | name | |||
| ) | 
Sets the i18n'ed name of the collection.
- Parameters:
- 
name The new collection name. 
| setParent | ( | self, | ||
| Akonadi.Collection | collection | |||
| ) | 
Sets the parent collection.
- Deprecated:
- Use setParentCollection()
| setParent | ( | self, | ||
| long | parent | |||
| ) | 
Sets the parent collection.
- Deprecated:
- Use setParentCollection()
| setParentRemoteId | ( | self, | ||
| QString | identifier | |||
| ) | 
Sets the parent's remote identifier.
- Deprecated:
- Use setParentCollection()
| setResource | ( | self, | ||
| QString | identifier | |||
| ) | 
Sets the identifier of the resource owning the collection.
| setRights | ( | self, | ||
| Akonadi.Collection.Rights | rights | |||
| ) | 
Sets the rights the user has on the collection.
| setStatistics | ( | self, | ||
| Akonadi.CollectionStatistics | statistics | |||
| ) | 
Sets the collection statistics for the collection.
| Akonadi.CollectionStatistics statistics | ( | self ) | 
Returns the collection statistics of the collection.
| KUrl url | ( | self ) | 
Returns the url of the collection.
- Since:
- 4.7
| KUrl url | ( | self, | ||
| Akonadi.Collection.UrlType | type | |||
| ) | 
Returns the url of the collection.
- Since:
- 4.7
Static Method Documentation
| Akonadi.Collection fromUrl | ( | KUrl | url | |
| ) | 
Creates a collection from the given url.
| QString mimeType | ( | ) | 
Returns the mimetype used for collections.
| Akonadi.Collection root | ( | ) | 
Returns the root collection.
Enumeration Documentation
| Right | 
Describes rights of a collection.
- Enumerator:
- 
ReadOnly = 0x0 CanChangeItem = 0x1 CanCreateItem = 0x2 CanDeleteItem = 0x4 CanChangeCollection = 0x8 CanCreateCollection = 0x10 CanDeleteCollection = 0x20 CanLinkItem = 0x40 CanUnlinkItem = 0x80 AllRights = (CanChangeItem|CanCreateItem|CanDeleteItem|CanChangeCollection|CanCreateCollection|CanDeleteCollection) 
| UrlType | 
Describes the type of url which is returned in url().
- Since:
- 4.7
- Enumerator:
- 
UrlShort = 0 UrlWithMimeType = 1 
 KDE 4.9 PyKDE API Reference
        KDE 4.9 PyKDE API Reference