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

List:       kde-commits
Subject:    branches/KDE/4.5/kdelibs/plasma
From:       Chani Armitage <chanika () gmail ! com>
Date:       2010-11-27 18:39:24
Message-ID: 20101127183924.161DAAC8A2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1201419 by chani:

partial backport of r1180338

exportLayout function needed for
CCBUG: 248386

sorry I didn't get this in sooner.
CCMAIL: mueller@kde.org


 M  +33 -0     corona.cpp  
 M  +10 -0     corona.h  


--- branches/KDE/4.5/kdelibs/plasma/corona.cpp #1201418:1201419
@@ -336,6 +336,39 @@
     d->saveLayout(c);
 }
 
+void Corona::exportLayout(KConfigGroup &config, QList<Containment*> containments)
+{
+    foreach (const QString &group, config.groupList()) {
+        KConfigGroup cg(&config, group);
+        cg.deleteGroup();
+    }
+
+    //temporarily unlock so that removal works
+    ImmutabilityType oldImm = immutability();
+    d->immutability = Mutable;
+
+    KConfigGroup dest(&config, "Containments");
+    KConfigGroup dummy;
+    foreach (Plasma::Containment *c, containments) {
+        c->save(dummy);
+        c->config().reparent(&dest);
+
+        //ensure the containment is unlocked
+        //this is done directly because we have to bypass any SystemImmutable checks
+        c->Applet::d->immutability = Mutable;
+        foreach (Applet *a, c->applets()) {
+            a->d->immutability = Mutable;
+        }
+
+        c->destroy(false);
+    }
+
+    //restore immutability
+    d->immutability = oldImm;
+
+    config.sync();
+}
+
 void Corona::requestConfigSync()
 {
     // TODO: should we check into our immutability before doing this?
--- branches/KDE/4.5/kdelibs/plasma/corona.h #1201418:1201419
@@ -262,6 +262,16 @@
      */
     QList<Plasma::Containment *> importLayout(const KConfigBase &config);
 
+    /**
+     * Exports a set of containments to a config file.
+     *
+     * @param config the config group to save to
+     * @param containments the list of containments to save
+     * @since 4.5.4
+     */
+    void exportLayout(KConfigGroup &config, QList<Containment*> containments);
+
+
 public Q_SLOTS:
     /**
      * Initializes the layout from a config file. This will first clear any existing
[prev in list] [next in list] [prev in thread] [next in thread] 

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