/* SPDX-FileCopyrightText: 2015 Aleix Pol i Gonzalez SPDX-License-Identifier: LGPL-2.1-or-later */ #include "actions.h" #include "backends/abstractpersonaction.h" #include "kpeople_debug.h" #include #include #include #include namespace KPeople { static QList actionsPlugins() { QList actionPlugins; const QList personPluginList = KPluginMetaData::findPlugins(QStringLiteral("kpeople/actions")); for (const KPluginMetaData &data : personPluginList) { auto pluginResult = KPluginFactory::instantiatePlugin(data); if (pluginResult) { qCDebug(KPEOPLE_LOG) << "found plugin" << data.fileName(); AbstractPersonAction *plugin = pluginResult.plugin; actionPlugins << plugin; } else { qCDebug(KPEOPLE_LOG) << "could not load plugin" << data.fileName() << pluginResult.errorText; } } return actionPlugins; } QList actionsForPerson(const QString &contactUri, QObject *parent) { PersonData person(contactUri); QList actions; const auto lst = actionsPlugins(); for (KPeople::AbstractPersonAction *plugin : lst) { actions << plugin->actionsForPerson(person, parent); } return actions; } } #include "moc_actions.cpp"