diff --git a/CMakeLists.txt b/CMakeLists.txt index c379754a3..efb4bbb29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION) set(PLASMA_NO_KIO TRUE) set(PLASMA_NO_PACKAGEKIT TRUE) set(PLASMA_NO_PACKAGE_EXTRADATA TRUE) - + set(PLASMA_NO_KUTILS TRUE) endif(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION) if(NOT Q_WS_X11) @@ -60,6 +60,11 @@ if(NOT PLASMA_NO_PACKAGEKIT) set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} ${QT_QTDBUS_LIBRARY}) endif(NOT PLASMA_NO_PACKAGEKIT) +if (NOT PLASMA_NO_KUTILS) + include_directories(${CMAKE_SOURCE_DIR}/kutils) + set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} ${KDE4_KUTILS_LIBS}) +endif(NOT PLASMA_NO_KUTILS) + if(QCA2_FOUND) include_directories(${QCA2_INCLUDE_DIR}) set(ENABLE_REMOTE_WIDGETS TRUE) @@ -274,7 +279,6 @@ target_link_libraries(plasmaqgv plasma ${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIB ${QT_QTSCRIPT_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} ${KDE4_KDEUI_LIBS} kdeclarative ${PLASMA_EXTRA_LIBS} kcoreaddons) - if(QCA2_FOUND) target_link_libraries(plasma ${QCA2_LIBRARIES}) endif(QCA2_FOUND) diff --git a/applet.cpp b/applet.cpp index 6192e1c87..7cf056d86 100644 --- a/applet.cpp +++ b/applet.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -65,6 +66,13 @@ #include #include +#ifndef PLASMA_NO_KUTILS +#include +#include +#else +#include +#endif + #ifndef PLASMA_NO_SOLID #include #endif @@ -1843,22 +1851,62 @@ void Applet::showConfigurationInterface() } d->publishUI.publishCheckbox = 0; - if (d->package && d->configLoader) { + if (d->package) { KConfigDialog *dialog = 0; - QString uiFile = d->package->filePath("mainconfigui"); - if (!uiFile.isEmpty()) { + 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()) { + 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; + QFile f(uiFile); QUiLoader loader; QWidget *w = loader.load(&f); if (w) { - dialog = new AppletConfigDialog(0, d->configDialogId(), d->configLoader); - dialog->setWindowTitle(d->configWindowTitle()); - dialog->setAttribute(Qt::WA_DeleteOnClose, true); dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name())); + hasPages = true; + } + + 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()); + hasPages = true; + } 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) { d->addGlobalShortcutsPage(dialog); d->addPublishPage(dialog); dialog->show(); + } else { + delete dialog; + dialog = 0; } } diff --git a/config-plasma.h.cmake b/config-plasma.h.cmake index 5edfe18a3..ebce7422b 100644 --- a/config-plasma.h.cmake +++ b/config-plasma.h.cmake @@ -5,4 +5,5 @@ #cmakedefine PLASMA_NO_KNEWSTUFF #cmakedefine PLASMA_NO_SOLID #cmakedefine PLASMA_NO_KIO +#cmakedefine PLASMA_NO_KUTILS