KDE 4.7 PyKDE API Reference

- KDE's Python API

# CollectionComboBox Class Reference

`from PyKDE4.akonadi import *`

Inherits: KComboBox → QComboBox → QWidget → QObject
Namespace: Akonadi

## Detailed Description

A combobox for selecting an Akonadi collection.

This widget provides a combobox to select a collection from the Akonadi storage. The available collections can be filtered by mime type and access rights.

Example:

     using namespace Akonadi;

     QStringList contentMimeTypes;
     contentMimeTypes << KABC.Addressee.mimeType();
     contentMimeTypes << KABC.ContactGroup.mimeType();

     CollectionComboBox *box = new CollectionComboBox( this );
     box->setMimeTypeFilter( contentMimeTypes );
     box->setAccessRightsFilter( Collection.CanCreateItem );
     ...

     const Collection collection = box->currentCollection();

Author:
  Tobias Koenig <tokoe@kde.org>

Since:
  4.4

## Signals

| currentChanged (Akonadi.Collection collection)

## Methods

| __init__ (self, QWidget parent=0)
| __init__ (self, QAbstractItemModel model, QWidget parent=0)
Akonadi.Collection.Rights | accessRightsFilter (self)
Akonadi.Collection | currentCollection (self)
QStringList | mimeTypeFilter (self)
| setAccessRightsFilter (self, Akonadi.Collection.Rights rights)
| setDefaultCollection (self, Akonadi.Collection collection)
| setMimeTypeFilter (self, QStringList mimetypes)

## Signal Documentation

currentChanged | ( | Akonadi.Collection | collection
| ) |  |  |

This signal is emitted whenever the current selection has been changed.

Parameters:

  | collection | The current selection.

Signal syntax:
  `QObject.connect(source, SIGNAL("currentChanged(const Akonadi::Collection&)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Creates a new collection combobox.

Parameters:

  | parent | The parent widget.

__init__ | ( | self, |
|  | QAbstractItemModel | model,
|  | QWidget | parent=0
| ) |  |  |

Creates a new collection combobox with a custom model.

The filtering by content mime type and access rights is done on top of the custom model.

Parameters:

  | model | The custom model to use.
  | parent | The parent widget.

Akonadi.Collection.Rights accessRightsFilter | ( |  | self ) |

Returns the access rights the collections are filtered by.

Akonadi.Collection currentCollection | ( |  | self ) |

Returns the current selection.

QStringList mimeTypeFilter | ( |  | self ) |

Returns the content mimetype the collections are filtered by. Don't assume this list has the original order.

setAccessRightsFilter | ( | self, |
|  | Akonadi.Collection.Rights | rights
| ) |  |  |

Sets the access rights the collections shall be filtered by.

setDefaultCollection | ( | self, |
|  | Akonadi.Collection | collection
| ) |  |  |

Sets the collection that shall be selected by default.

setMimeTypeFilter | ( | self, |
|  | QStringList | mimetypes
| ) |  |  |

Sets the content mimetypes the collections shall be filtered by.