Akonadi.EntityMimeTypeFilterModel

KDE 4.5 PyKDE API Reference

- KDE's Python API

# EntityMimeTypeFilterModel Class Reference

`from PyKDE4.akonadi import *`

Inherits: QSortFilterProxyModel → QAbstractProxyModel → QAbstractItemModel → QObject
Namespace: Akonadi

## Detailed Description

A proxy model that filters entities by mime type.

This class can be used on top of an EntityTreeModel to exclude entities by mimetype or to include only certain mimetypes.

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

       Akonadi.EntityMimeTypeFilterModel *proxy = new Akonadi.EntityMimeTypeFilterModel();
       proxy->addMimeTypeInclusionFilter( "message/rfc822" );
       proxy->setSourceModel( model );

       Akonadi.EntityTreeView *view = new Akonadi.EntityTreeView( this );
       view->setModel( proxy );

- If a mimetype is in both the exclusion list and the inclusion list, it is excluded.
- If the mimeTypeInclusionFilter is empty, all mimetypes are
accepted (except if they are in the exclusion filter of course).

Author:
  Bruno Virlet <bruno.virlet@gmail.com>

Author:
  Stephen Kelly <steveire@gmail.com>

Since:
  4.4

## Methods
| __init__ (self, QObject parent=0)
| addMimeTypeExclusionFilter (self, QString mimeType)
| addMimeTypeExclusionFilters (self, QStringList mimeTypes)
| addMimeTypeInclusionFilter (self, QString mimeType)
| addMimeTypeInclusionFilters (self, QStringList mimeTypes)
bool | canFetchMore (self, QModelIndex parent)
| clearFilters (self)
int | columnCount (self, QModelIndex parent=QModelIndex())
bool | filterAcceptsRow (self, int sourceRow, QModelIndex sourceParent)
bool | hasChildren (self, QModelIndex parent=QModelIndex())
QVariant | headerData (self, int section, Qt::Orientation orientation, int role=Qt.DisplayRole)
[QModelIndex] | match (self, QModelIndex start, int role, QVariant value, int hits=1, Qt::MatchFlags flags=Qt.MatchFlags(Qt.MatchStartsWith|Qt.MatchWrap))
QStringList | mimeTypeExclusionFilters (self)
QStringList | mimeTypeInclusionFilters (self)
| setHeaderGroup (self, Akonadi.EntityTreeModel.HeaderGroup headerGroup)

## Method Documentation

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

Creates a new entity mime type filter model.

Parameters:

  | parent | The parent object.

addMimeTypeExclusionFilter | ( | self, |
|  | QString | mimeType
| ) |  |  |

Add mime type to be excluded by the filter.

Parameters:

  | mimeType | A mime type to be excluded.

addMimeTypeExclusionFilters | ( | self, |
|  | QStringList | mimeTypes
| ) |  |  |

Add mimetypes to filter out

Parameters:

  | mimeTypes | A list to exclude from the model.

addMimeTypeInclusionFilter | ( | self, |
|  | QString | mimeType
| ) |  |  |

Add mime type to be shown by the filter.

Parameters:

  | mimeType | A mime type to be shown.

addMimeTypeInclusionFilters | ( | self, |
|  | QStringList | mimeTypes
| ) |  |  |

Add mime types to be shown by the filter.

Parameters:

  | mimeTypes | A list of mime types to be included.

bool canFetchMore | ( | self, |
|  | QModelIndex | parent
| ) |  |  |

clearFilters | ( |  | self ) |

Clear all mime type filters.

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

bool filterAcceptsRow | ( | self, |
|  | int | sourceRow,
|  | QModelIndex | sourceParent
| ) |  |  |

bool hasChildren | ( | self, |
|  | QModelIndex | parent=QModelIndex()
| ) |  |  |

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

[QModelIndex] match | ( | self, |
|  | QModelIndex | start,
|  | int | role,
|  | QVariant | value,
|  | int | hits=1,
|  | Qt::MatchFlags | flags=Qt.MatchFlags(Qt.MatchStartsWith|Qt.MatchWrap)
| ) |  |  |

QStringList mimeTypeExclusionFilters | ( |  | self ) |

Returns the list of mime type exclusion filters.

QStringList mimeTypeInclusionFilters | ( |  | self ) |

Returns the list of mime type inclusion filters.

setHeaderGroup | ( | self, |
|  | Akonadi.EntityTreeModel.HeaderGroup | headerGroup
| ) |  |  |

Sets the header set of the filter model.

\sa EntityTreeModel.HeaderGroup