From 608d620c37af696840bed60ffa9d7d5098a8b3d4 Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 23 Sep 2010 00:35:03 +0000 Subject: Fix broken Documents shortcut in KMenu git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1178412 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdesktop/kxdglauncher.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'kdesktop/kxdglauncher.cpp') diff --git a/kdesktop/kxdglauncher.cpp b/kdesktop/kxdglauncher.cpp index b22a2a5d7..da650aeee 100644 --- a/kdesktop/kxdglauncher.cpp +++ b/kdesktop/kxdglauncher.cpp @@ -83,6 +83,7 @@ TQString getDocumentPath() static KCmdLineOptions options[] = { { "xdgname ", I18N_NOOP("XDG variable name to open"), 0 }, + { "getpath", I18N_NOOP("Do not launch Konqueror; instead print path to directory if it exists)"), 0 }, KCmdLineLastOption }; @@ -100,16 +101,21 @@ int main( int argc, char **argv) if (desiredFolder == "DOCUMENTS") { TQDir myqdir; if (myqdir.exists(getDocumentPath(), TRUE) == true) { - KRun * run = new KRun( KURL(getDocumentPath()), 0, false, false ); - TQObject::connect( run, TQT_SIGNAL( finished() ), &app, TQT_SLOT( quit() )); - TQObject::connect( run, TQT_SIGNAL( error() ), &app, TQT_SLOT( quit() )); - app.exec(); - return 0; + if (args->isSet( "getpath" ) == true) { + printf("%s\n\r", getDocumentPath().ascii()); + return 0; + } + else { + KRun * run = new KRun( KURL(getDocumentPath()), 0, false, false ); + TQObject::connect( run, TQT_SIGNAL( finished() ), &app, TQT_SLOT( quit() )); + TQObject::connect( run, TQT_SIGNAL( error() ), &app, TQT_SLOT( quit() )); + app.exec(); + return 0; + } } else { TQString newDirectory = KInputDialog::text("Create Documents directory", "Please confirm your Documents directory location
Upon confimation a new directory will be created", getDocumentPath()); if (newDirectory == TQString::null) { - printf("User cancelled directory creation\n\r"); return 1; } else { @@ -118,10 +124,16 @@ int main( int argc, char **argv) char systemcommand[8192]; sprintf(systemcommand, "xdg-user-dirs-update --set DOCUMENTS \"%s\"", newDirectory.ascii()); system(systemcommand); - KRun * run = new KRun( getDocumentPath(), 0, false, false ); - TQObject::connect( run, TQT_SIGNAL( finished() ), &app, TQT_SLOT( quit() )); - TQObject::connect( run, TQT_SIGNAL( error() ), &app, TQT_SLOT( quit() )); - app.exec(); + if (args->isSet( "getpath" ) == true) { + printf("%s\n\r", getDocumentPath().ascii()); + return 0; + } + else { + KRun * run = new KRun( getDocumentPath(), 0, false, false ); + TQObject::connect( run, TQT_SIGNAL( finished() ), &app, TQT_SLOT( quit() )); + TQObject::connect( run, TQT_SIGNAL( error() ), &app, TQT_SLOT( quit() )); + app.exec(); + } return 0; } else { @@ -145,4 +157,4 @@ int main( int argc, char **argv) printf("Please specify the desired XDG variable name with --xdgname\n\r"); return 1; } -} \ No newline at end of file +} -- cgit v1.2.1