[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: Opinion on config dialog for QML plasmoids
From:       "Aaron J. Seigo" <aseigo () kde ! org>
Date:       2011-08-17 11:17:41
Message-ID: 2766238.qLPx0ve6uW () freedom
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


On Wednesday, August 17, 2011 12:00:13 Marco Martin wrote:
> On Monday 04 July 2011, Viranch Mehta wrote:
> me merged in master is the system kcms missing.an easy way would be adding 
in the applet desktop file what kcms it needs,

that could be the easy way to do it, but i wouldn't be against adding them to 
the .desktop file. see attached untested patch.

how configuration from applets happens really needs to be re-examined in 
libplasma2. what we have now is great for a QWidget world and a monolithic 
kdelibs. in the modularized world of the future(tm) and with things being in 
QML, the current approach is not the bets and perhaps not every really 
workable.

something that i need to look into and whch we will probably need to make some 
hard decisions about.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks

["kcms_in_scripted_applets.diff" (kcms_in_scripted_applets.diff)]

diff --git a/plasma/CMakeLists.txt b/plasma/CMakeLists.txt
index ef411df..a5dd75b 100644
--- a/plasma/CMakeLists.txt
+++ b/plasma/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/plasma/applet.cpp b/plasma/applet.cpp
index b78153e..bfc3420 100644
--- a/plasma/applet.cpp
+++ b/plasma/applet.cpp
@@ -53,7 +53,10 @@
 #include <kactioncollection.h>
 #include <kauthorized.h>
 #include <kcolorscheme.h>
+#include <kcmoduleinfo.h>
+#include <kcmoduleproxy.h>
 #include <kdialog.h>
+#include <kdesktopfile.h>
 #include <kicon.h>
 #include <kiconloader.h>
 #include <kkeysequencewidget.h>
@@ -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;
             }
         }
 


["signature.asc" (application/pgp-signature)]

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic