Changeset View
Changeset View
Standalone View
Standalone View
src/personpluginmanager.cpp
Show All 16 Lines | |||||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #include "personpluginmanager.h" | 19 | #include "personpluginmanager.h" | ||
20 | #include "backends/basepersonsdatasource.h" | 20 | #include "backends/basepersonsdatasource.h" | ||
21 | 21 | | |||
22 | #include <KPluginMetaData> | 22 | #include <KPluginMetaData> | ||
23 | #include <KPluginLoader> | 23 | #include <KPluginLoader> | ||
24 | #include <KPluginFactory> | 24 | #include <KPluginFactory> | ||
25 | #include <KServiceTypeTrader> | | |||
26 | #include <KService> | | |||
27 | 25 | | |||
28 | #include <QMutex> | 26 | #include <QMutex> | ||
29 | #include <QMutexLocker> | 27 | #include <QMutexLocker> | ||
30 | #include "kpeople_debug.h" | 28 | #include "kpeople_debug.h" | ||
31 | 29 | | |||
32 | 30 | | |||
33 | using namespace KPeople; | 31 | using namespace KPeople; | ||
34 | 32 | | |||
Show All 39 Lines | 71 | } else { | |||
74 | dataSource->deleteLater(); | 72 | dataSource->deleteLater(); | ||
75 | qCDebug(KPEOPLE_LOG) << "Plugin" << pluginId << "was already loaded manually, ignoring..."; | 73 | qCDebug(KPEOPLE_LOG) << "Plugin" << pluginId << "was already loaded manually, ignoring..."; | ||
76 | } | 74 | } | ||
77 | } else { | 75 | } else { | ||
78 | qCWarning(KPEOPLE_LOG) << "Failed to create data source " << service.name() << service.fileName(); | 76 | qCWarning(KPEOPLE_LOG) << "Failed to create data source " << service.name() << service.fileName(); | ||
79 | } | 77 | } | ||
80 | } | 78 | } | ||
81 | 79 | | |||
82 | //TODO: Remove as soon as KTp sources are released with the new plugin system | | |||
83 | const KService::List servicesList = KServiceTypeTrader::self()->query(QStringLiteral("KPeople/DataSource")); | | |||
84 | for (const KService::Ptr &service : servicesList) { | | |||
85 | BasePersonsDataSource *dataSource = service->createInstance<BasePersonsDataSource>(nullptr); | | |||
86 | | ||||
87 | | ||||
88 | if (dataSource) { | | |||
89 | dataSourcePlugins[dataSource->sourcePluginId()] = dataSource; | | |||
90 | } else { | | |||
91 | qCWarning(KPEOPLE_LOG) << "Failed to create data source " << service->name() << service->entryPath(); | | |||
92 | } | | |||
93 | } | | |||
94 | | ||||
95 | m_loadedDataSourcePlugins = true; | 80 | m_loadedDataSourcePlugins = true; | ||
96 | } | 81 | } | ||
97 | 82 | | |||
98 | void PersonPluginManager::setAutoloadDataSourcePlugins(bool autoloadDataSourcePlugins) | 83 | void PersonPluginManager::setAutoloadDataSourcePlugins(bool autoloadDataSourcePlugins) | ||
99 | { | 84 | { | ||
100 | s_instance->m_autoloadDataSourcePlugins = autoloadDataSourcePlugins; | 85 | s_instance->m_autoloadDataSourcePlugins = autoloadDataSourcePlugins; | ||
101 | } | 86 | } | ||
102 | 87 | | |||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |