Akonadi.EntityRightsFilterModel

KDE 4.9 PyKDE API Reference

- KDE's Python API

# EntityRightsFilterModel Class Reference

`from PyKDE4.akonadi import *`

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

## Detailed Description

A proxy model that filters entities by access rights.

This class can be used on top of an EntityTreeModel to exclude entities by access type or to include only certain entities with special access rights.

     using namespace Akonadi;

     EntityTreeModel *model = new EntityTreeModel( this );

     EntityRightsFilterModel *filter = new EntityRightsFilterModel();
     filter->setAccessRights( Collection.CanCreateItem | Collection.CanCreateCollection );
     filter->setSourceModel( model );

     EntityTreeView *view = new EntityTreeView( this );
     view->setModel( filter );

- For collections the access rights are checked against the collections own rights.
- For items the access rights are checked against the item's parent collection rights.

Author:
  Tobias Koenig <tokoe@kde.org>

Since:
  4.6

## Methods
| __init__ (self, QObject parent=0)
bool | acceptRow (self, int sourceRow, QModelIndex sourceParent)
Akonadi.Collection.Rights | accessRights (self)
Qt::ItemFlags | flags (self, QModelIndex index)
[QModelIndex] | match (self, QModelIndex start, int role, QVariant value, int hits=1, Qt::MatchFlags flags=Qt.MatchFlags(Qt.MatchStartsWith|Qt.MatchWrap))
| setAccessRights (self, Akonadi.Collection.Rights rights)

## Method Documentation

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

Creates a new entity rights filter model.

Parameters:

  | parent | The parent object.

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

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

Returns the access rights that are used for filtering.

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

@reimplemented

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

@reimplemented

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

Sets the access rights the entities shall be filtered against. If no rights are set explicitly, Collection.AllRights is assumed.