Blob Blame History Raw
--- branches/KDE/4.3/kdelibs/plasma/private/service_p.h	2009/08/02 18:26:50	1005966
+++ branches/KDE/4.3/kdelibs/plasma/private/service_p.h	2009/08/02 18:27:44	1005967
@@ -73,6 +73,7 @@
     ServicePrivate(Service *service)
         : q(service),
           config(0),
+          dummyConfig(0),
           tempFile(0)
     {
     }
@@ -80,6 +81,7 @@
     ~ServicePrivate()
     {
         delete config;
+        delete dummyConfig;
         delete tempFile;
     }
 
@@ -98,10 +100,25 @@
         associatedGraphicsWidgets.remove(static_cast<QGraphicsWidget*>(obj));
     }
 
+    KConfigGroup dummyGroup()
+    {
+        if (!dummyConfig) {
+            if (!tempFile) {
+                tempFile = new KTemporaryFile;
+                tempFile->open();
+            }
+
+            dummyConfig = new KConfig(tempFile->fileName());
+        }
+
+        return KConfigGroup(dummyConfig, "DummyGroup");
+    }
+
     Service *q;
     QString destination;
     QString name;
     ConfigLoader *config;
+    KConfig *dummyConfig;
     KTemporaryFile *tempFile;
     QMultiHash<QWidget *, QString> associatedWidgets;
     QMultiHash<QGraphicsWidget *, QString> associatedGraphicsWidgets;
--- branches/KDE/4.3/kdelibs/plasma/service.cpp	2009/08/02 18:26:50	1005966
+++ branches/KDE/4.3/kdelibs/plasma/service.cpp	2009/08/02 18:27:44	1005967
@@ -116,7 +116,7 @@
 {
     if (!d->config) {
         kDebug() << "No valid operations scheme has been registered";
-        return KConfigGroup();
+        return d->dummyGroup();
     }
 
     d->config->writeConfig();
@@ -212,6 +212,9 @@
     delete d->tempFile;
     d->tempFile = 0;
 
+    delete d->dummyConfig;
+    d->dummyConfig = 0;
+
     registerOperationsScheme();
 }
 
@@ -258,6 +261,9 @@
     delete d->config;
     delete d->tempFile;
 
+    delete d->dummyConfig;
+    d->dummyConfig = 0;
+
     //FIXME: make KSharedConfig and KConfigSkeleton not braindamaged in 4.2 and then get rid of the
     //       temp file object here
     d->tempFile = new KTemporaryFile;