[Bug 923360] [kde-workspace/KDE/4.9] kcontrol/autostart: make sure to use the same file name when replicating a desktop file

Harald Sitter sitter.harald at gmail.com
Mon Dec 10 09:41:46 UTC 2012


Git commit 23f6ef95ecb13881c2fb72c621fe4695577ca06d by Harald Sitter.
Committed on 10/12/2012 at 10:41.
Pushed by sitter into branch 'KDE/4.9'.

make sure to use the same file name when replicating a desktop file

when replicating an existing desktop file also use the exactly same
entry name to enable users to override a global autostart (e.g. from
a distro)

previously the translated name was used.

(user visible names etc. remain working as expected, so are desktop files
replicated before this change)

https://bugs.launchpad.net/ubuntu/+source/kde-workspace/+bug/923360
CCMAIL: 923360 at bugs.launchpad.net

M  +13   -3    kcontrol/autostart/autostart.cpp

http://commits.kde.org/kde-
workspace/23f6ef95ecb13881c2fb72c621fe4695577ca06d

diff --git a/kcontrol/autostart/autostart.cpp b/kcontrol/autostart/autostart.cpp
index cba2b31..4c883c6 100644
--- a/kcontrol/autostart/autostart.cpp
+++ b/kcontrol/autostart/autostart.cpp
@@ -259,9 +259,17 @@ void Autostart::slotAddProgram()
         return; // Don't crash if KOpenWith wasn't able to create service.
     }
 
+    // It is important to ensure that we make an exact copy of an existing
+    // desktop file (if selected) to enable users to override global autostarts.
+    // Also see
+    // https://bugs.launchpad.net/ubuntu/+source/kde-workspace/+bug/923360
+    QString desktopPath;
     KUrl desktopTemplate;
     if ( service->desktopEntryName().isEmpty() ) {
-        desktopTemplate = KUrl( m_paths[4] + service->name() + ".desktop" );
+        // Build custom desktop file (e.g. when the user entered an executable
+        // name in the OpenWithDialog).
+        desktopPath = m_paths[4] + service->name() + ".desktop";
+        desktopTemplate = KUrl( desktopPath );
         KConfig kc(desktopTemplate.path(), KConfig::SimpleConfig);
         KConfigGroup kcg = kc.group("Desktop Entry");
         kcg.writeEntry("Exec",service->exec());
@@ -279,13 +287,15 @@ void Autostart::slotAddProgram()
     }
     else
     {
+        // Use existing desktop file and use same file name to enable overrides.
+        desktopPath = m_paths[4] + service->desktopEntryName() + ".desktop";
         desktopTemplate = KUrl( KStandardDirs::locate("apps", service->entryPath()) );
 
-        KPropertiesDialog dlg( desktopTemplate, KUrl(m_paths[4]), service->name() + ".desktop", this );
+        KPropertiesDialog dlg( desktopTemplate, KUrl(m_paths[4]), service->desktopEntryName() + ".desktop", this );
         if ( dlg.exec() != QDialog::Accepted )
             return;
     }
-    DesktopStartItem * item = new DesktopStartItem( m_paths[4] + service->name() + ".desktop", m_programItem,this );
+    DesktopStartItem * item = new DesktopStartItem( desktopPath, m_programItem,this );
     addItem( item, service->name(), m_pathName[0],  service->exec() , false);
 }

-- 
You received this bug notification because you are a member of Kubuntu
Bugs, which is subscribed to kde-workspace in Ubuntu.
https://bugs.launchpad.net/bugs/923360

Title:
  systemsettings/start_and_shutdown shouldn't generate localized
  .desktop file names

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/kde-workspace/+bug/923360/+subscriptions




More information about the kubuntu-bugs mailing list