KPeople::PersonPluginManager Class

class KPeople::PersonPluginManager

This class allows applications to manage DataSource plugins. More...

Header: #include <KPeople/PersonPluginManager>
CMake: find_package(KF6 REQUIRED COMPONENTS People)
target_link_libraries(mytarget PRIVATE KF6::People)
Since: 5.51

Static Public Members

(since 5.62) bool addContact(const QVariantMap &properties)
void addDataSource(const QString &sourceId, KPeople::BasePersonsDataSource *source)
KPeople::BasePersonsDataSource *dataSource(const QString &sourceId)
QList<KPeople::BasePersonsDataSource *> dataSourcePlugins()
(since 5.62) bool deleteContact(const QString &uri)
void setAutoloadDataSourcePlugins(bool autoloadDataSourcePlugins)
void setDataSourcePlugins(const QHash<QString, KPeople::BasePersonsDataSource *> &dataSources)

Detailed Description

It can be useful if an application wants to use custom DataSource, without exposing it to other KPeople-based applications (i.e. without installing a system-wide plugin)

Another use-case is that it allows to pass custom arguments to DataSources (i.e. an ItemModel which will be used as a source of data)

Member Function Documentation

[static, since 5.62] bool PersonPluginManager::addContact(const QVariantMap &properties)

Creates a contact with the specified properties Returns if it could be done successfully

This function was introduced in 5.62.

[static] void PersonPluginManager::addDataSource(const QString &sourceId, KPeople::BasePersonsDataSource *source)

Adds custom data source. If DataSource with such sourceId was already loaded, we override it

Takes ownership of the source

[static] KPeople::BasePersonsDataSource *PersonPluginManager::dataSource(const QString &sourceId)

[static] QList<KPeople::BasePersonsDataSource *> PersonPluginManager::dataSourcePlugins()

See also setDataSourcePlugins().

[static, since 5.62] bool PersonPluginManager::deleteContact(const QString &uri)

Deletes a contact with the specified uri Returns true if the contact was deleted

This function was introduced in 5.62.

[static] void PersonPluginManager::setAutoloadDataSourcePlugins(bool autoloadDataSourcePlugins)

Use this if you explicitly don't want KPeople to autoload all the available data source plugins.

The default behavior is to autoload them

[static] void PersonPluginManager::setDataSourcePlugins(const QHash<QString, KPeople::BasePersonsDataSource *> &dataSources)

Instead of loading datasources from plugins, set sources manually This is for unit tests only

See also dataSourcePlugins().