KDE 4.7 PyKDE API Reference

- KDE's Python API

# SpecialMailCollections Class Reference

`from PyKDE4.akonadi import *`

Inherits: Akonadi.SpecialCollections → QObject
Namespace: Akonadi

## Detailed Description

Abstract class:
  This class can be used as a base class for new classes, but can not be instantiated directly.

Interface to special mail collections such as inbox, outbox etc.

This class is the central interface to the local mail folders. These folders can either be in the default resource (stored in ~/.local/share/local-mail) or in any number of custom resources. Special collections of the following types are supported: inbox, outbox, sent-mail, trash, drafts, templates and spam.

To check whether a special mail collection is available, simply use the hasCollection() and hasDefaultCollection() methods. Available special mail collections are accessible through the collection() and defaultCollection() methods.

To create a special mail collection, use a SpecialMailCollectionsRequestJob. This will create the special mail collections you request and automatically register them with SpecialMailCollections, so that it now knows they are available.

This class monitors all special mail collections known to it, and removes it from the known list if they are deleted. Note that this class does not automatically rebuild the collections that disappeared.

The defaultCollectionsChanged() and collectionsChanged() signals are emitted when the special mail collections for a resource change (i.e. some became available or some become unavailable).

    if( SpecialMailCollections.self()->hasDefaultCollection( SpecialMailCollections.Outbox ) ) {
    const Collection col = SpecialMailCollections.self()->defaultCollection( SpecialMailCollections.Outbox );
    // ...
    } else {
    // ... use SpecialMailCollectionsRequestJob to request the collection...
    }

Author:
  Constantin Berzan <exit3219@gmail.com>

Since:
  4.4

## Enumerations
Type | { Invalid, Root, Inbox, Outbox, SentMail, Trash, Drafts, Templates, LastType }
## Methods
Akonadi.Collection | collection (self, Akonadi.SpecialMailCollections.Type type, Akonadi.AgentInstance instance)
Akonadi.Collection | defaultCollection (self, Akonadi.SpecialMailCollections.Type type)
bool | hasCollection (self, Akonadi.SpecialMailCollections.Type type, Akonadi.AgentInstance instance)
bool | hasDefaultCollection (self, Akonadi.SpecialMailCollections.Type type)
bool | registerCollection (self, Akonadi.SpecialMailCollections.Type type, Akonadi.Collection collection)
## Static Methods
Akonadi.SpecialMailCollections | self ()

## Method Documentation

Akonadi.Collection collection | ( | self, |
|  | Akonadi.SpecialMailCollections.Type | type,
|  | Akonadi.AgentInstance | instance
| ) |  |  |

Returns the special mail collection of the given type in the given agent instance, or an invalid collection if such a collection is unknown.

Akonadi.Collection defaultCollection | ( | self, |
|  | Akonadi.SpecialMailCollections.Type | type
| ) |  |  |

Returns the special mail collection of given type in the default resource, or an invalid collection if such a collection is unknown.

bool hasCollection | ( | self, |
|  | Akonadi.SpecialMailCollections.Type | type,
|  | Akonadi.AgentInstance | instance
| ) |  |  |

Returns whether the given agent instance has a special collection of the given type.

bool hasDefaultCollection | ( | self, |
|  | Akonadi.SpecialMailCollections.Type | type
| ) |  |  |

Returns whether the default resource has a special mail collection of the given type.

bool registerCollection | ( | self, |
|  | Akonadi.SpecialMailCollections.Type | type,
|  | Akonadi.Collection | collection
| ) |  |  |

Registers the given collection as a special mail collection with the given type.

The collection must be owned by a valid resource. Registering a new collection of a previously registered type forgets the old collection.

## Static Method Documentation

Akonadi.SpecialMailCollections self | ( |  | ) |

Returns the global SpecialMailCollections instance.

## Enumeration Documentation

Type

Describes the possible types of special mail collections.

Generally, there may not be two special mail collections of the same type in the same resource.

Enumerator:

  CreateCollection |
  CopyCollections |
  DeleteCollections |
  SynchronizeCollections |
  CollectionProperties |
  CopyItems |
  Paste |
  DeleteItems |
  ManageLocalSubscriptions |
  AddToFavoriteCollections |
  RemoveFromFavoriteCollections |
  RenameFavoriteCollection |
  CopyCollectionToMenu |
  CopyItemToMenu |
  MoveItemToMenu |
  MoveCollectionToMenu |
  CutItems |
  CutCollections |
  CreateResource |
  DeleteResources |
  ResourceProperties |
  SynchronizeResources |
  ToggleWorkOffline |
  CopyCollectionToDialog |
  MoveCollectionToDialog |
  CopyItemToDialog |
  MoveItemToDialog |
  SynchronizeCollectionsRecursive |
  LastType |