Akonadi::EntityRightsFilterModel Class

class Akonadi::EntityRightsFilterModel

A proxy model that filters entities by access rights. More...

Header: #include <Akonadi/EntityRightsFilterModel>
CMake: find_package(KPim6 REQUIRED COMPONENTS AkonadiCore)
target_link_libraries(mytarget PRIVATE KPim6::AkonadiCore)

Public Functions

EntityRightsFilterModel(QObject *parent = nullptr)
virtual ~EntityRightsFilterModel() override
Akonadi::Collection::Rights accessRights() const
void setAccessRights(Akonadi::Collection::Rights rights)

Reimplemented Public Functions

virtual Qt::ItemFlags flags(const QModelIndex &index) const override
virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const override

Detailed Description

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 );

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

Author: Tobias Koenig <tokoe@kde.org>

Member Function Documentation

[explicit] EntityRightsFilterModel::EntityRightsFilterModel(QObject *parent = nullptr)

Creates a new entity rights filter model.

parent The parent object.

[override virtual noexcept] EntityRightsFilterModel::~EntityRightsFilterModel()

Destroys the entity rights filter model.

Akonadi::Collection::Rights EntityRightsFilterModel::accessRights() const

Returns the access rights that are used for filtering.

See also setAccessRights().

[override virtual] Qt::ItemFlags EntityRightsFilterModel::flags(const QModelIndex &index) const

[override virtual] QModelIndexList EntityRightsFilterModel::match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith | Qt::MatchWrap)) const

void EntityRightsFilterModel::setAccessRights(Akonadi::Collection::Rights rights)

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

See also accessRights().