From 6c19c0b3c4d139b22319e517fd731406f2c6cfe1 Mon Sep 17 00:00:00 2001 From: Viranch Mehta Date: Mon, 31 Oct 2011 22:24:39 +0530 Subject: [PATCH 1/5] Aaron's patch for loading system KCMs in scripted plasmoids config dialog by specifying them in the plasmoid's .desktop file --- CMakeLists.txt | 2 +- applet.cpp | 34 +++++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef411df75..a5dd75b83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -261,7 +261,7 @@ kde4_add_library(plasma ${LIBRARY_TYPE} ${plasma_LIB_SRCS}) #add kdeclarative after the 4.7 release target_link_libraries(plasma ${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY} ${QT_QTSCRIPT_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTSQL_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} - ${KDE4_KDEUI_LIBS} kdnssd threadweaver ${PLASMA_EXTRA_LIBS}) + ${KDE4_KDEUI_LIBS} ${KDE4_KUTILS_LIBS} kdnssd threadweaver ${PLASMA_EXTRA_LIBS}) if(QCA2_FOUND) target_link_libraries(plasma ${QCA2_LIBRARIES}) diff --git a/applet.cpp b/applet.cpp index b78153e95..bfc34201a 100644 --- a/applet.cpp +++ b/applet.cpp @@ -53,7 +53,10 @@ #include #include #include +#include +#include #include +#include #include #include #include @@ -1885,19 +1888,40 @@ void Applet::showConfigurationInterface() if (d->package && d->configLoader) { 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.destkop"); + const QStringList kcmPlugins = df.desktopGroup().readEntry("X-Plasma-ConfigPlugins", QStringList()); + if (!uiFile.isEmpty() || !kcmPlugins.isEmpty()) { + dialog = new AppletConfigDialog(0, d->configDialogId(), d->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) { + KCModuleProxy *module = new KCModuleProxy(kcm); + if (module->realModule()) { + dialog->addPage(module, module->moduleInfo().moduleName(), module->moduleInfo().icon()); + hasPages = true; + } else { + delete module; + } + } + + if (hasPages) { d->addGlobalShortcutsPage(dialog); d->addPublishPage(dialog); dialog->show(); + } else { + delete dialog; + dialog = 0; } } From ec2df8a0532885ce7f217654d9db875da0de98d3 Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Mon, 31 Oct 2011 21:44:37 +0100 Subject: [PATCH 2/5] Compile GIT_SILENT --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5dd75b83..9aef9e3b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${KDE4_KDEUI_INCLUDES} ${CMAKE_SOURCE_DIR}/experimental/libkdeclarative ${CMAKE_BINARY_DIR}/experimental/libkdeclarative - ${CMAKE_SOURCE_DIR}/threadweaver/ + ${CMAKE_SOURCE_DIR}/kutils + ${CMAKE_SOURCE_DIR}/threadweaver ${CMAKE_SOURCE_DIR}/plasma/extenders ${CMAKE_SOURCE_DIR}/plasma/remote ${CMAKE_SOURCE_DIR}/plasma/private/qtjolie-branch/qtjolie From 02eeddf931784c0def9576c8db66175f6c65b6ba Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 1 Nov 2011 20:33:13 +0100 Subject: [PATCH 3/5] correct type dekstop->desktop please test before committing ;) CCMAIL:viranch.mehta@gmail.com --- applet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applet.cpp b/applet.cpp index bfc34201a..24e31723e 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1889,7 +1889,7 @@ void Applet::showConfigurationInterface() KConfigDialog *dialog = 0; const QString uiFile = d->package->filePath("mainconfigui"); - KDesktopFile df(d->package->path() + "/metadata.destkop"); + 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); From ebbf1bbc3245da934a49d2bdf00a7d0c0321c485 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Wed, 2 Nov 2011 17:22:36 +0100 Subject: [PATCH 4/5] profile controled use of libkutils --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9aef9e3b1..3effae145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,7 @@ if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION) set(PLASMA_NO_KNEWSTUFF TRUE) set(PLASMA_NO_SOLID TRUE) set(PLASMA_NO_KIO TRUE) + set(PLASMA_NO_KUTILS TRUE) endif(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION) include_directories(${CMAKE_CURRENT_SOURCE_DIR} From 9a4825380f40d00ef70cf69ae8a7f9317841d8e3 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Wed, 2 Nov 2011 17:24:25 +0100 Subject: [PATCH 5/5] improve loading of system kcms * don't use libkutils on reduced footprint profile builds * load the kcms even if there isn't a configLoader for the package --- applet.cpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) 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) {