webkit plasmoids

Petri Damstén petri.damsten at gmail.com
Sat Sep 20 23:56:11 CEST 2008


On Saturday 20 September 2008 17:51:31 Petri Damstén wrote:
> 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.

forget this...

Much better to do it this way:

Index: configxml.cpp
===================================================================
--- configxml.cpp       (revision 863068)
+++ configxml.cpp       (working copy)
@@ -194,6 +194,7 @@
         QList<QSize*> sizes;
         QList<quint64*> ulonglongs;
         QList<KUrl::List*> urllists;
+        QString baseGroup;
         QStringList groups;
         QHash<QString, QString> keysToNames;
 };
@@ -255,14 +256,23 @@
     int numAttrs = attrs.count();
     QString tag = localName.toLower();
     if (tag == "group") {
+        QString group;
         for (int i = 0; i < numAttrs; ++i) {
             QString name = attrs.localName(i).toLower();
             if (name == "name") {
                 //kDebug() << "set group to" << attrs.value(i);
-                d->groups.append(attrs.value(i));
-                m_config->setCurrentGroup(attrs.value(i));
+                group = attrs.value(i);
             }
         }
+        if (group.isEmpty()) {
+            group = d->baseGroup;
+        } else {
+            d->groups.append(group);
+            if (!d->baseGroup.isEmpty()) {
+                group = d->baseGroup + '\x1d' + group;
+            }
+        }
+        m_config->setCurrentGroup(group);
     } else if (tag == "entry") {
         for (int i = 0; i < numAttrs; ++i) {
             QString name = attrs.localName(i).toLower();
@@ -522,6 +532,12 @@
     : KConfigSkeleton(KSharedConfig::openConfig(config->config()->name()), 
parent),
       d(new ConfigXmlPrivate)
 {
+    KConfigGroup group = config->parent();
+    d->baseGroup = config->name();
+    while (group.isValid() && group.name() != "<default>") {
+        d->baseGroup = group.name() + '\x1d' + d->baseGroup;
+        group = group.parent();
+    }
     d->parse(this, xml);
 }

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/20080921/ccef39a9/attachment.sig 


More information about the Plasma-devel mailing list