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

List:       kde-commits
Subject:    KDE/kdebase/workspace/kcontrol/keys
From:       Michael Jansen <kde () michael-jansen ! biz>
Date:       2009-02-28 20:35:22
Message-ID: 1235853322.341654.19243.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 933402 by mjansen:

Make importing and exporting of schemes work.

 M  +20 -5     kglobalshortcutseditor.cpp  


--- trunk/KDE/kdebase/workspace/kcontrol/keys/kglobalshortcutseditor.cpp #933401:933402
@@ -273,7 +273,7 @@
                            url.url()));
         return;
     }
-    KConfig config(url.path());
+    KConfig config(url.path(), KConfig::SimpleConfig);
     importConfiguration(&config);
 }
 
@@ -349,22 +349,37 @@
 
 void KGlobalShortcutsEditor::importConfiguration(KConfigBase *config)
 {
-    // We only import shortcuts for currently registered components.
+    kDebug() << config->groupList();
+
+    // In a first step clean out the current configurations. We do this
+    // because we want to minimize the chance of conflicts.
     Q_FOREACH (const componentData &cd, d->components) {
         KConfigGroup group(config, cd.uniqueName);
-        cd.editor->importConfiguration(&group);
+        kDebug() << cd.uniqueName << group.name();
+        if (group.exists()) {
+            kDebug() << "Removing" << cd.uniqueName;
+            cd.editor->clearConfiguration();
+        }
     }
+
+    // Now import the new configurations.
+    Q_FOREACH (const componentData &cd, d->components) {
+        KConfigGroup group(config, cd.uniqueName);
+        kDebug();
+        if (group.exists()) {
+            kDebug() << "Importing" << cd.uniqueName;
+            cd.editor->importConfiguration(&group);
+        }
+    }
 }
 
 void KGlobalShortcutsEditor::exportConfiguration(QStringList components, KConfig *config) const
     {
     Q_FOREACH (const QString &componentFriendly, components)
         {
-        kDebug() << componentFriendly;
         QHash<QString, componentData>::Iterator iter = d->components.find(componentFriendly);
         if (iter == d->components.end())
             {
-            kDebug() << "The component" << componentFriendly << "is unknown";
             Q_ASSERT(iter == d->components.end());
             continue;
             }
[prev in list] [next in list] [prev in thread] [next in thread] 

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