Commit 5e7e87ca authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[kcminit] Additionally look in kcms/ folder for KCM plugins

All the new QML KCMs have their library in kcms/ subfolder
Also improve error reporting a bit by reporting whether the library was not found or its symbol is missing.

Differential Revision: https://phabricator.kde.org/D24557
parent af1e75da
......@@ -79,17 +79,27 @@ bool KCMInit::runModule(const QString &libName, KService::Ptr service)
else
kcminit = KCMINIT_PREFIX + libName;
QString path = KPluginLoader::findPlugin(libName);
if (path.isEmpty()) {
path = KPluginLoader::findPlugin(QStringLiteral("kcms/") + libName);
}
if (path.isEmpty()) {
qWarning() << "Module" << libName << "was not found";
return false;
}
// get the kcminit_ function
QFunctionPointer init = QLibrary::resolve(KPluginLoader::findPlugin(libName), kcminit.toUtf8().constData());
if (init) {
// initialize the module
qDebug() << "Initializing " << libName << ": " << kcminit;
init();
return true;
} else {
qWarning() << "Module" << libName << "was not found or does not actually have a kcminit function";
QFunctionPointer init = QLibrary::resolve(path, kcminit.toUtf8().constData());
if (!init) {
qWarning() << "Module" << libName << "does not actually have a kcminit function";
return false;
}
return false;
// initialize the module
qDebug() << "Initializing " << libName << ": " << kcminit;
init();
return true;
}
void KCMInit::runModules( int phase )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment