KPeople

personpluginmanager.h
1/*
2 SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org>
3 SPDX-FileCopyrightText: 2018 Igor Poboiko <igor.poboiko@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#ifndef PERSON_PLUGIN_MANAGER_H
9#define PERSON_PLUGIN_MANAGER_H
10
11#include <kpeople/kpeople_export.h>
12
13#include <QHash>
14#include <QVariant>
15
16namespace KPeople
17{
18class AbstractPersonAction;
19class BasePersonsDataSource;
20
21/**
22 This class allows applications to manage DataSource plugins
23
24 It can be useful if an application wants to use custom DataSource,
25 without exposing it to other KPeople-based applications
26 (i.e. without installing a system-wide plugin)
27
28 Another use-case is that it allows to pass custom arguments to DataSources
29 (i.e. an ItemModel which will be used as a source of data)
30
31 @since 5.51
32 */
33class KPEOPLE_EXPORT PersonPluginManager
34{
35public:
36 /**
37 * Use this if you explicitly don't want KPeople to autoload all the
38 * available data source plugins.
39 *
40 * The default behavior is to autoload them
41 */
42 static void setAutoloadDataSourcePlugins(bool autoloadDataSourcePlugins);
43 static QList<BasePersonsDataSource *> dataSourcePlugins();
44 /**
45 * Adds custom data source. If DataSource with such @p sourceId was already loaded, we override it
46 *
47 * Takes ownership of the @p source
48 */
49 static void addDataSource(const QString &sourceId, BasePersonsDataSource *source);
50 static BasePersonsDataSource *dataSource(const QString &sourceId);
51
52 /**
53 * Instead of loading datasources from plugins, set sources manually
54 * This is for unit tests only
55 */
56 static void setDataSourcePlugins(const QHash<QString, BasePersonsDataSource *> &dataSources);
57
58 /**
59 * Creates a contact with the specified @p properties
60 * @returns if it could be done successfully
61 *
62 * @since 5.62
63 */
64 static bool addContact(const QVariantMap &properties);
65
66 /**
67 * Deletes a contact with the specified &p uri
68 * @returns if it could be done successfully
69 *
70 * @since 5.62
71 */
72 static bool deleteContact(const QString &uri);
73};
74}
75
76#endif // PERSON_PLUGIN_MANAGER_H
This class allows applications to manage DataSource plugins.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.