Akonadi::AgentFilterProxyModel Class

class Akonadi::AgentFilterProxyModel

A proxy model for filtering AgentType or AgentInstance. More...

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

Public Functions

AgentFilterProxyModel(QObject *parent = nullptr)
virtual ~AgentFilterProxyModel() override
void addCapabilityFilter(const QString &capability)
void addMimeTypeFilter(const QString &mimeType)
void clearFilters()
void excludeCapabilities(const QString &capability)
void setIncludeSystemAccounts(bool includeSystemAccounts)

Detailed Description

This filter proxy model works on top of a AgentTypeModel or AgentInstanceModel and can be used to show only AgentType or AgentInstance objects which provide a given mime type or capability.

 // Show only running agent instances that provide contacts
 Akonadi::AgentInstanceModel *model = new Akonadi::AgentInstanceModel( this );

 Akonadi::AgentFilterProxyModel *proxy = new Akonadi::AgentFilterProxyModel( this );
 proxy->addMimeTypeFilter( "text/directory" );

 proxy->setSourceModel( model );

 QListView *view = new QListView( this );
 view->setModel( proxy );

Author: Volker Krause <vkrause@kde.org>

Member Function Documentation

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

Create a new agent filter proxy model. By default no filtering is done. parent parent object

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

Destroys the agent filter proxy model.

void AgentFilterProxyModel::addCapabilityFilter(const QString &capability)

Accept agents with the given capability.

void AgentFilterProxyModel::addMimeTypeFilter(const QString &mimeType)

Accept agents supporting mimeType.

void AgentFilterProxyModel::clearFilters()

Clear the filters ( mimeTypes & capabilities ).

void AgentFilterProxyModel::excludeCapabilities(const QString &capability)

Excludes agents with the given capability. capability undesired agent capability

void AgentFilterProxyModel::setIncludeSystemAccounts(bool includeSystemAccounts)

Set whether or not agents created from a system online account are included.

Default: true