KCalendarCore
6#include "calendarpluginloader.h"
8#include <QCoreApplication>
10#include <QPluginLoader>
16 std::unique_ptr<KCalendarCore::CalendarPlugin> plugin;
19PluginLoader::PluginLoader()
23 for (
const auto &data : staticPluginData) {
24 if (data.metaData().value(QLatin1String(
"IID")).
toString() == QLatin1String(
"org.kde.kcalendarcore.CalendarPlugin")) {
25 plugin.reset(qobject_cast<KCalendarCore::CalendarPlugin *>(data.instance()));
36 for (
const auto &searchPath : std::as_const(searchPaths)) {
37 const QString pluginPath = searchPath + QLatin1String(
"/kf6/org.kde.kcalendarcore.calendars");
38 for (QDirIterator it(pluginPath,
QDir::Files); it.hasNext() && !plugin;) {
40 QPluginLoader loader(it.fileInfo().absoluteFilePath());
42 plugin.reset(qobject_cast<KCalendarCore::CalendarPlugin *>(loader.instance()));
44 qDebug() << loader.errorString();
50Q_GLOBAL_STATIC(PluginLoader, s_pluginLoader)
52bool CalendarPluginLoader::hasPlugin()
54 return (
bool)s_pluginLoader->plugin;
57KCalendarCore::CalendarPlugin *CalendarPluginLoader::plugin()
59 return s_pluginLoader->plugin.get();
62#include "moc_calendarpluginloader.cpp"
char * toString(const EngineQuery &query)
Namespace for all KCalendarCore types.
QString applicationDirPath()
QStringList libraryPaths()
QList< QStaticPlugin > staticPlugins()
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:53:53 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.