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

List:       kde-commits
Subject:    kdebase/kcontrol/filetypes
From:       Waldo Bastian <bastian () kde ! org>
Date:       2003-06-02 10:41:12
[Download RAW message or body]

CVS commit by waba: 

XDG menu changes


  M +26 -29    typeslistitem.cpp   1.32


--- kdebase/kcontrol/filetypes/typeslistitem.cpp  #1.31:1.32
@@ -284,22 +284,21 @@ void TypesListItem::sync()
           // The mimetype is listed explicitly in the .desktop files, so
           // just remove it and we're done
-          QString serviceLoc;
-
+          KConfig *desktop;
           if ( !isApplication )
-            serviceLoc = locateLocal("services", pService->desktopEntryPath());
+          {
+            desktop = new KConfig(pService->desktopEntryPath(), false, false, "services");
+          }
           else
-            serviceLoc = locateLocal("apps", pService->desktopEntryPath());
-
-          KDesktopFile desktop(serviceLoc);
+          {
+            QString path = KDesktopFile::locateLocal(pService->desktopEntryPath());
+            KConfig orig(pService->desktopEntryPath(), true, false, "apps");
+            desktop = orig.copyTo(path);
+          }
 
           serviceTypeList.remove(name());
-          desktop.writeEntry("MimeType", serviceTypeList, ';');
-
-          desktop.writeEntry("Type", pService->type());
-          desktop.writeEntry("Icon", pService->icon());
-          desktop.writeEntry("Name", pService->name());
-          desktop.writeEntry("Comment", pService->comment());
-          desktop.writeEntry("Exec", pService->exec());
+          desktop->writeEntry("MimeType", serviceTypeList, ';');
 
+          desktop->sync();
+          delete desktop;
         }
         else {
@@ -347,19 +346,15 @@ void TypesListItem::saveServices( KConfi
     profile.writeEntry("Preference", i);
 
-    QString serviceLoc;
-
+    KConfig *desktop;
     if ( pService->type() == QString("Service") )
-      serviceLoc = locateLocal("services", pService->desktopEntryPath());
+    {
+        desktop = new KConfig(pService->desktopEntryPath(), false, false, "services");
+    }
     else
-      serviceLoc = locateLocal("apps", pService->desktopEntryPath());
-
-    KDesktopFile desktop( serviceLoc );
-
-    desktop.writeEntry("Type", pService->type());
-    desktop.writeEntry("Icon", pService->icon());
-    desktop.writeEntry("Name", pService->name());
-    desktop.writeEntry("Comment", pService->comment());
-    desktop.writeEntry("Exec", pService->exec());
-
+    {
+        QString path = KDesktopFile::locateLocal(pService->desktopEntryPath());
+        KConfig orig(pService->desktopEntryPath(), true, false, "apps");
+        desktop = orig.copyTo(path);
+    }
     // merge new mimetype
     QStringList serviceTypeList = pService->serviceTypes();
@@ -368,6 +363,8 @@ void TypesListItem::saveServices( KConfi
       serviceTypeList.append(name());
 
-    desktop.writeEntry("MimeType", serviceTypeList, ';');
-    desktop.writeEntry("ServiceTypes", "");
+    desktop->writeEntry("MimeType", serviceTypeList, ';');
+    desktop->writeEntry("ServiceTypes", "");
+    desktop->sync();
+    delete desktop;
   }
 }


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

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