diff --git a/applet.cpp b/applet.cpp index 24e31723e..edafe2f6e 100644 --- a/applet.cpp +++ b/applet.cpp @@ -53,8 +53,6 @@ #include #include #include -#include -#include #include #include #include @@ -68,6 +66,11 @@ #include #include +#ifndef PLASMA_NO_KUTILS +#include +#include +#endif + #ifndef PLASMA_NO_SOLID #include #endif @@ -1885,14 +1888,16 @@ void Applet::showConfigurationInterface() } d->publishUI.publishCheckbox = 0; - if (d->package && d->configLoader) { + if (d->package) { KConfigDialog *dialog = 0; const QString uiFile = d->package->filePath("mainconfigui"); KDesktopFile df(d->package->path() + "/metadata.desktop"); const QStringList kcmPlugins = df.desktopGroup().readEntry("X-Plasma-ConfigPlugins", QStringList()); if (!uiFile.isEmpty() || !kcmPlugins.isEmpty()) { - dialog = new AppletConfigDialog(0, d->configDialogId(), d->configLoader); + KConfigSkeleton *configLoader = d->configLoader ? d->configLoader : new KConfigSkeleton(0); + dialog = new AppletConfigDialog(0, d->configDialogId(), configLoader); + dialog->setWindowTitle(d->configWindowTitle()); dialog->setAttribute(Qt::WA_DeleteOnClose, true); bool hasPages = false; @@ -1906,6 +1911,7 @@ void Applet::showConfigurationInterface() } foreach (const QString &kcm, kcmPlugins) { +#ifndef PLASMA_NO_KUTILS KCModuleProxy *module = new KCModuleProxy(kcm); if (module->realModule()) { dialog->addPage(module, module->moduleInfo().moduleName(), module->moduleInfo().icon()); @@ -1913,6 +1919,22 @@ void Applet::showConfigurationInterface() } else { delete module; } +#else + KService::Ptr service = KService::serviceByStorageId(kcm); + if (service) { + QString error; + KCModule *module = service->createInstance(dialog, QVariantList(), &error); + if (module) { + connect(module, SIGNAL(changed(bool)), dialog, SLOT(settingsModified(bool))); + dialog->addPage(module, service->name(), service->icon()); + hasPages = true; + } else { +#ifndef NDEBUG + kDebug() << "failed to load kcm" << kcm << "for" << name(); +#endif + } + } +#endif } if (hasPages) {