FavoriteCollectionsModel Class Reference
from PyKDE4.akonadi import *
Inherits: Akonadi.SelectionProxyModel → KSelectionProxyModel → QAbstractProxyModel → QAbstractItemModel → QObject
Namespace: Akonadi
Detailed Description
A model that lists a set of favorite collections.
In some applications you want to provide fast access to a list of often used collections (e.g. Inboxes from different email accounts in a mail application). Therefor you can use the FavoriteCollectionsModel which stores the list of favorite collections in a given configuration file.
Example:
using namespace Akonadi; EntityTreeModel *sourceModel = new EntityTreeModel( ... ); const KConfigGroup group = KGlobal.config()->group( "Favorite Collections" ); FavoriteCollectionsModel *model = new FavoriteCollectionsModel( sourceModel, group, this ); EntityListView *view = new EntityListView( this ); view->setModel( model );
- Since:
- 4.4
Methods | |
__init__ (self, QAbstractItemModel model, KConfigGroup group, QObject parent=0) | |
addCollection (self, Akonadi.Collection collection) | |
[Akonadi.Collection] | collections (self) |
QVariant | data (self, QModelIndex index, int role=Qt.DisplayRole) |
QString | favoriteLabel (self, Akonadi.Collection col) |
QVariant | headerData (self, int section, Qt::Orientation orientation, int role=Qt.DisplayRole) |
removeCollection (self, Akonadi.Collection collection) | |
setCollections (self, [Akonadi.Collection] collections) | |
setFavoriteLabel (self, Akonadi.Collection collection, QString label) |
Method Documentation
__init__ | ( | self, | ||
QAbstractItemModel | model, | |||
KConfigGroup | group, | |||
QObject | parent=0 | |||
) |
Creates a new favorite collections model.
- Parameters:
-
model The source model where the favorite collections come from. group The config group that shall be used to save the selection of favorite collections. parent The parent object.
addCollection | ( | self, | ||
Akonadi.Collection | collection | |||
) |
Adds a collection to the list of favorite collections.
[Akonadi.Collection] collections | ( | self ) |
Returns the list of favorite collections.
QVariant data | ( | self, | ||
QModelIndex | index, | |||
int | role=Qt.DisplayRole | |||
) |
QString favoriteLabel | ( | self, | ||
Akonadi.Collection | col | |||
) |
Return associate label for collection
QVariant headerData | ( | self, | ||
int | section, | |||
Qt::Orientation | orientation, | |||
int | role=Qt.DisplayRole | |||
) |
removeCollection | ( | self, | ||
Akonadi.Collection | collection | |||
) |
Removes a collection from the list of favorite collections.
setCollections | ( | self, | ||
[Akonadi.Collection] | collections | |||
) |
Sets the collections as favorite collections.
setFavoriteLabel | ( | self, | ||
Akonadi.Collection | collection, | |||
QString | label | |||
) |
Sets a custom label that will be used when showing the favorite collection.