summaryrefslogtreecommitdiffstats
path: root/kdesktop/kxdglauncher.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-24 01:59:23 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-24 01:59:23 +0000
commit6ade341229a0ce755b3e606d974b37c7d1609c8a (patch)
tree07389116d19da9923d611a79f85d2c200f23e511 /kdesktop/kxdglauncher.cpp
parentd1839212f86747491106bd28e4401d9f96c723dd (diff)
downloadtdebase-6ade341229a0ce755b3e606d974b37c7d1609c8a.tar.gz
tdebase-6ade341229a0ce755b3e606d974b37c7d1609c8a.zip
* Allow XDG launcher to directly rewrite the XDG configuration file instead of going through a third party application
* Fix desktop icon builtin detection * Desktop icon removal is now more intuitive git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1178835 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdesktop/kxdglauncher.cpp')
-rw-r--r--kdesktop/kxdglauncher.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/kdesktop/kxdglauncher.cpp b/kdesktop/kxdglauncher.cpp
index fba2c3fbf..ff173c842 100644
--- a/kdesktop/kxdglauncher.cpp
+++ b/kdesktop/kxdglauncher.cpp
@@ -30,6 +30,7 @@
#include <kglobalsettings.h>
#include <kinputdialog.h>
#include <kmessagebox.h>
+#include <kconfig.h>
#include <stdlib.h>
@@ -130,9 +131,14 @@ int main( int argc, char **argv)
directoryOk = TRUE;
}
if (directoryOk == true) {
- char systemcommand[8192];
- sprintf(systemcommand, "xdg-user-dirs-update --set DOCUMENTS \"%s\"", newDirectory.ascii());
- system(systemcommand);
+ TQString xdgModifiedDirectory = newDirectory;
+ xdgModifiedDirectory = xdgModifiedDirectory.replace(TQDir::homeDirPath(), "$HOME");
+ while (xdgModifiedDirectory.endsWith("/")) {
+ xdgModifiedDirectory.truncate(xdgModifiedDirectory.length()-1);
+ }
+ KConfig config(TQDir::homeDirPath() + "/.config/user-dirs.dirs", false, false);
+ config.writeEntry("XDG_DOCUMENTS_DIR", TQString("\"") + xdgModifiedDirectory + TQString("\""), true);
+ config.sync();
if (args->isSet( "getpath" ) == true) {
printf("%s\n\r", getDocumentPath().ascii());
return 0;