KDE 4.9 PyKDE API Reference

- KDE's Python API

# CollectionModel Class Reference

`from PyKDE4.akonadi import *`

Inherits: QAbstractItemModel → QObject
Subclasses: Akonadi.CollectionStatisticsModel
Namespace: Akonadi

## Detailed Description

A model for collections.

This class provides the interface of QAbstractItemModel for the collection tree of the Akonadi storage.

       Akonadi.CollectionModel *model = new Akonadi.CollectionModel( this );

       QTreeView *view = new QTreeView( this );
       view->setModel( model );

If you want to list only collections of a special mime type, use CollectionFilterProxyModel on top of this model.

Author:
  Volker Krause <vkrause@kde.org>

Deprecated:
  Use Akonadi.EntityTreeModel instead

## Enumerations

Roles | { OldCollectionIdRole, OldCollectionRole, CollectionIdRole, CollectionRole, UserRole }

## Methods

| __init__ (self, QObject parent=0)
Akonadi.Collection | collectionForId (self, long id)
int | columnCount (self, QModelIndex parent=QModelIndex())
QVariant | data (self, QModelIndex index, int role=Qt.DisplayRole)
bool | dropMimeData (self, QMimeData data, Qt::DropAction action, int row, int column, QModelIndex parent)
| fetchCollectionStatistics (self, bool enable)
Qt::ItemFlags | flags (self, QModelIndex index)
QVariant | headerData (self, int section, Qt::Orientation orientation, int role=Qt.DisplayRole)
| includeUnsubscribed (self, bool include=1)
QModelIndex | index (self, int row, int column, QModelIndex parent=QModelIndex())
QMimeData | mimeData (self, [QModelIndex] indexes)
QStringList | mimeTypes (self)
QModelIndex | parent (self, QModelIndex index)
int | rowCount (self, QModelIndex parent=QModelIndex())
bool | setData (self, QModelIndex index, QVariant value, int role=Qt.EditRole)
bool | setHeaderData (self, int section, Qt::Orientation orientation, QVariant value, int role=Qt.EditRole)
Qt::DropActions | supportedDropActions (self)

## Method Documentation

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

Creates a new collection model.

Parameters:

  | parent | The parent object.

Akonadi.Collection collectionForId | ( | self, |
|  | long | id
| ) |  |  |

Returns the collection for a given collection id.

int columnCount | ( | self, |
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

QVariant data | ( | self, |
|  | QModelIndex | index,
|  | int | role=Qt.DisplayRole
| ) |  |  |

bool dropMimeData | ( | self, |
|  | QMimeData | data,
|  | Qt::DropAction | action,
|  | int | row,
|  | int | column,
|  | QModelIndex | parent
| ) |  |  |

fetchCollectionStatistics | ( | self, |
|  | bool | enable
| ) |  |  |

Sets whether collection statistics information shall be provided by the model.

See also:
  CollectionStatistics.

Qt::ItemFlags flags | ( | self, |
|  | QModelIndex | index
| ) |  |  |

QVariant headerData | ( | self, |
|  | int | section,
|  | Qt::Orientation | orientation,
|  | int | role=Qt.DisplayRole
| ) |  |  |

includeUnsubscribed | ( | self, |
|  | bool | include=1
| ) |  |  |

Sets whether unsubscribed collections shall be listed in the model.

QModelIndex index | ( | self, |
|  | int | row,
|  | int | column,
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

QMimeData mimeData | ( | self, |
|  | [QModelIndex] | indexes
| ) |  |  |

QStringList mimeTypes | ( |  | self ) |

QModelIndex parent | ( | self, |
|  | QModelIndex | index
| ) |  |  |

int rowCount | ( | self, |
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

bool setData | ( | self, |
|  | QModelIndex | index,
|  | QVariant | value,
|  | int | role=Qt.EditRole
| ) |  |  |

bool setHeaderData | ( | self, |
|  | int | section,
|  | Qt::Orientation | orientation,
|  | QVariant | value,
|  | int | role=Qt.EditRole
| ) |  |  |

Qt::DropActions supportedDropActions | ( |  | self ) |

## Enumeration Documentation

Roles

Describes the roles for collections.

Enumerator:

  IdRole = Qt::UserRole+1 |
  ItemRole |
  MimeTypeRole |
  UserRole = Qt::UserRole+42 |