Akonadi.CollectionDialog

KDE 4.5 PyKDE API Reference

- KDE's Python API

# CollectionDialog Class Reference

`from PyKDE4.akonadi import *`

Inherits: KDialog → QDialog → QWidget → QObject
Namespace: Akonadi

## Detailed Description

A collection selection dialog.

Provides a dialog that lists collections that are available on the Akonadi storage and allows to select one or multiple collections. The list of shown collections can be filtered by mime type and access rights.

Example:

     using namespace Akonadi;

     // Show the user a dialog to select a writable collection of contacts
     CollectionDialog dlg( this );
     dlg.setMimeTypeFilter( QStringList() << KABC.Addressee.mimeType() );
     dlg.setAccessRightsFilter( Collection.CanCreateItem );
     dlg.setDescription( i18n( "Select an address book for saving:" ) );

     if ( dlg.exec() ) {
       const Collection collection = dlg.selectedCollection();
       ...
     }

Author:
  Ingo Klöcker <kloecker@kde.org>

Since:
  4.3

## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, QAbstractItemModel model, QWidget parent=0)
Akonadi.Collection.Rights | accessRightsFilter (self)
QStringList | mimeTypeFilter (self)
Akonadi.Collection | selectedCollection (self)
[Akonadi.Collection] | selectedCollections (self)
QAbstractItemView.SelectionMode | selectionMode (self)
| setAccessRightsFilter (self, Akonadi.Collection.Rights rights)
| setDefaultCollection (self, Akonadi.Collection collection)
| setDescription (self, QString text)
| setMimeTypeFilter (self, QStringList mimeTypes)
| setSelectionMode (self, QAbstractItemView.SelectionMode mode)

## Method Documentation

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

Creates a new collection dialog.

Parameters:

  | parent | The parent widget.

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

Creates a new collection dialog 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.

Since:
  4.4

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

Sets the access rights that the listed collections shall match with.

Since:
  4.4

QStringList mimeTypeFilter | ( |  | self ) |

Returns the mime types any of which the selected collection(s) shall support.

Akonadi.Collection selectedCollection | ( |  | self ) |

Returns the selected collection if the selection mode is QAbstractItemView.SingleSelection. If another selection mode was set, or nothing is selected, an invalid collection is returned.

[Akonadi.Collection] selectedCollections | ( |  | self ) |

Returns the list of selected collections.

QAbstractItemView.SelectionMode selectionMode | ( |  | self ) |

Returns the selection mode.

See also:
  QAbstractItemView.selectionMode()

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

Sets the access rights that the listed collections shall match with.

Since:
  4.4

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

Sets the collection that shall be selected by default.

Since:
  4.4

setDescription | ( | self, |
|  | QString | text
| ) |  |  |

Sets the text that will be shown in the dialog.

Since:
  4.4

setMimeTypeFilter | ( | self, |
|  | QStringList | mimeTypes
| ) |  |  |

Sets the mime types any of which the selected collection(s) shall support.

setSelectionMode | ( | self, |
|  | QAbstractItemView.SelectionMode | mode
| ) |  |  |

Sets the selection mode. The initial default mode is QAbstractItemView.SingleSelection.

See also:
  QAbstractItemView.setSelectionMode()