webkit plasmoids

Petri Damstén petri.damsten at gmail.com
Sat Sep 20 16:51:31 CEST 2008


On Friday 19 September 2008 16:16:16 Aaron J. Seigo wrote:
> > (or perhaps some other solution)?
>
> let me look at kconfigskeleton today...

Would this be too big hack until kconfigskeleton supports groups? What I 
looked kconfigskeleton it has to be changed quite a bit to support 
kconfiggroup.

Index: applet.cpp                                                                                                      
===================================================================                                                    
--- applet.cpp  (revision 862877)
+++ applet.cpp  (working copy)
@@ -41,6 +41,7 @@
 #include <QTextDocument>
 #include <QTimer>
 #include <QUiLoader>
+#include <QBuffer>

 #include <KAction>
 #include <KIcon>
@@ -1680,9 +1681,28 @@
     if (!xmlPath.isEmpty()) {
         QFile file(xmlPath);
         // FIXME: KConfigSkeleton doesn't play well with KConfigGroup =/
-        KConfigGroup config = q->config();
-        configXml = new ConfigXml(&config, &file);
-        QObject::connect(configXml, SIGNAL(configChanged()), q, 
SLOT(configChanged()));
+        if (file.open(QIODevice::ReadOnly)) {
+            QString group;
+            if (isContainment) {
+                group = "Containments";
+            } else {
+                if (q->containment()) {
+                    group = "Containments" + '\x1d' + QString::number(q-
>containment()->id()) + '\x1d';
+                }
+                group += "Applets";
+            }
+            group += '\x1d' + QString::number(appletId) + '\x1d' + 
"Configuration";
+
+            QString xml = file.readAll();
+            xml.replace(QRegExp("<\\s*group([^>]*)name\\s*=\\s*\"[^\"]*\""),
+                        QString("<group \\1 name=\"%1\"").arg(group));
+            QByteArray ba = xml.toUtf8();
+            QBuffer buffer(&ba);
+            KConfigGroup config = q->config();
+            configXml = new ConfigXml(&config, &buffer);
+            QObject::connect(configXml, SIGNAL(configChanged()), q, 
SLOT(configChanged()));
+        }
     }

     if (!package->filePath("mainconfigui").isEmpty()) {


> > Is there a preferred file extension for plasmoid plasma packages?
>
> .loveandhugs.
>
> no, wait, that's another project. uhm...
>
> .plasmoid? =)

Yep, sounds good :-)

Petri


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080920/561683f0/attachment.sig 


More information about the Plasma-devel mailing list