akonadi
Akonadi::CollectionDialog Class Reference
A collection selection dialog. More...
#include <collectiondialog.h>
Inherits KDialog.
Public Member Functions | |
CollectionDialog (QAbstractItemModel *model, QWidget *parent=0) | |
CollectionDialog (QWidget *parent=0) | |
~CollectionDialog () | |
Collection::Rights | accessRightsFilter () const |
QStringList | mimeTypeFilter () const |
Akonadi::Collection | selectedCollection () const |
Akonadi::Collection::List | selectedCollections () const |
QAbstractItemView::SelectionMode | selectionMode () const |
void | setAccessRightsFilter (Collection::Rights rights) |
void | setDefaultCollection (const Collection &collection) |
void | setDescription (const QString &text) |
void | setMimeTypeFilter (const QStringList &mimeTypes) |
void | setSelectionMode (QAbstractItemView::SelectionMode mode) |
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(); ... }
- Since:
- 4.3
Definition at line 64 of file collectiondialog.h.
Constructor & Destructor Documentation
CollectionDialog::CollectionDialog | ( | QWidget * | parent = 0 |
) | [explicit] |
Creates a new collection dialog.
- Parameters:
-
parent The parent widget.
Definition at line 119 of file collectiondialog.cpp.
CollectionDialog::CollectionDialog | ( | QAbstractItemModel * | model, | |
QWidget * | parent = 0 | |||
) | [explicit] |
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
Definition at line 125 of file collectiondialog.cpp.
CollectionDialog::~CollectionDialog | ( | ) |
Destroys the collection dialog.
Definition at line 131 of file collectiondialog.cpp.
Member Function Documentation
Collection::Rights CollectionDialog::accessRightsFilter | ( | ) | const |
Sets the access rights
that the listed collections shall match with.
- Since:
- 4.4
Definition at line 183 of file collectiondialog.cpp.
QStringList CollectionDialog::mimeTypeFilter | ( | ) | const |
Returns the mime types any of which the selected collection(s) shall support.
Definition at line 173 of file collectiondialog.cpp.
Akonadi::Collection CollectionDialog::selectedCollection | ( | ) | const |
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.
Definition at line 136 of file collectiondialog.cpp.
Akonadi::Collection::List CollectionDialog::selectedCollections | ( | ) | const |
Returns the list of selected collections.
Definition at line 147 of file collectiondialog.cpp.
QAbstractItemView::SelectionMode CollectionDialog::selectionMode | ( | ) | const |
Returns the selection mode.
- See also:
- QAbstractItemView::selectionMode()
Definition at line 204 of file collectiondialog.cpp.
void CollectionDialog::setAccessRightsFilter | ( | Collection::Rights | rights | ) |
Sets the access rights
that the listed collections shall match with.
- Since:
- 4.4
Definition at line 178 of file collectiondialog.cpp.
void CollectionDialog::setDefaultCollection | ( | const Collection & | collection | ) |
Sets the collection
that shall be selected by default.
- Since:
- 4.4
Definition at line 194 of file collectiondialog.cpp.
void CollectionDialog::setDescription | ( | const QString & | text | ) |
Sets the text
that will be shown in the dialog.
- Since:
- 4.4
Definition at line 188 of file collectiondialog.cpp.
void CollectionDialog::setMimeTypeFilter | ( | const QStringList & | mimeTypes | ) |
Sets the mime types any of which the selected collection(s) shall support.
Definition at line 163 of file collectiondialog.cpp.
void CollectionDialog::setSelectionMode | ( | QAbstractItemView::SelectionMode | mode | ) |
Sets the selection mode.
The initial default mode is QAbstractItemView::SingleSelection.
- See also:
- QAbstractItemView::setSelectionMode()
Definition at line 199 of file collectiondialog.cpp.
The documentation for this class was generated from the following files: