[rkward-cvs] SF.net SVN: rkward:[2522] trunk/rkward/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Jun 9 20:47:36 UTC 2009


Revision: 2522
          http://rkward.svn.sourceforge.net/rkward/?rev=2522&view=rev
Author:   tfry
Date:     2009-06-09 20:47:35 +0000 (Tue, 09 Jun 2009)

Log Message:
-----------
Workaround for KFileDialog-hang on windows

Modified Paths:
--------------
    trunk/rkward/rkward/main.cpp
    trunk/rkward/rkward/rkward.cpp

Modified: trunk/rkward/rkward/main.cpp
===================================================================
--- trunk/rkward/rkward/main.cpp	2009-06-09 20:46:54 UTC (rev 2521)
+++ trunk/rkward/rkward/main.cpp	2009-06-09 20:47:35 UTC (rev 2522)
@@ -2,7 +2,7 @@
                           main.cpp  -  description
                              -------------------
     begin                : Tue Oct 29 20:06:08 CET 2002
-    copyright            : (C) 2002, 2005, 2006, 2007, 2008 by Thomas Friedrichsmeier 
+    copyright            : (C) 2002, 2005, 2006, 2007, 2008, 2009 by Thomas Friedrichsmeier 
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -99,10 +99,13 @@
 
 	// before initializing the commandline args, remove the ".bin" from "rkward.bin".
 	// This is so it prints "Usage rkward..." instead of "Usage rkward.bin...", etc.
-	// it seems safest to keep a copy, since the shell still owns argv[0]
-	char *argv_zero_copy = argv[0];
-	argv[0] = qstrdup (QString (argv_zero_copy).remove (".bin").toLocal8Bit ());
-	KCmdLineArgs::init( argc, argv, &aboutData );
+	// it seems safest to keep a copy, since the shell still owns argv
+	char *argv_copy[argc];
+	argv_copy[0] = qstrdup (QString (argv[0]).remove (".bin").replace (".exe", ".bat").toLocal8Bit ());
+	for (int i = 1; i < argc; ++i) {
+		argv_copy[i] = argv[i];
+	}
+	KCmdLineArgs::init (argc, argv_copy, &aboutData);
 	KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
 
 	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
@@ -128,7 +131,5 @@
 
 	// do it!
 	int status = app.exec ();
-	// restore old argv[0] so the shell is happy
-	argv[0] = argv_zero_copy;
 	return status;
 }

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2009-06-09 20:46:54 UTC (rev 2521)
+++ trunk/rkward/rkward/rkward.cpp	2009-06-09 20:47:35 UTC (rev 2522)
@@ -508,7 +508,7 @@
 
 	if (ok) RKWorkplace::mainWorkplace ()->editNewDataFrame (name);
 }
-
+#include <krecentdirs.h>
 void RKWardMainWindow::fileOpenNoSave (const KUrl &url) {
 	RK_TRACE (APP);
 
@@ -517,7 +517,13 @@
 	slotSetStatusBarText(i18n("Opening workspace..."));
 	KUrl lurl = url;
 	if (lurl.isEmpty ()) {
+#ifdef Q_WS_WIN
+	// getOpenUrl(KUrl("kfiledialog:///<rfiles>"), ...) causes a hang on windows (KDElibs 4.2.3).
+#	warning Track this bug down and/or report it
+		lurl = KFileDialog::getOpenUrl (KUrl (), i18n("*|All files"), this, i18n("Open File..."));
+#else
 		lurl = KFileDialog::getOpenUrl (KUrl ("kfiledialog:///<rfiles>"), i18n("*|All files"), this, i18n("Open File..."));
+#endif
 	}
 	if (!lurl.isEmpty ()) {
 		openWorkspace (lurl);
@@ -656,9 +662,14 @@
 	RK_TRACE (APP);
 	KUrl::List urls;
 	KUrl::List::const_iterator it;
-	
+
+#ifdef Q_WS_WIN
+	// getOpenUrls(KUrl("kfiledialog:///<rfiles>"), ...) causes a hang on windows (KDElibs 4.2.3).
+#	warning Track this bug down and/or report it
+	urls = KFileDialog::getOpenUrls (KUrl (), "*.R *.r *.S *.s *.q|R Script Files (*.R *.r *.S *.s *.q)\n*.*|All Files (*.*)", this, i18n ("Open command file(s)"));
+#else
 	urls = KFileDialog::getOpenUrls (KUrl ("kfiledialog:///<rfiles>"), "*.R *.r *.S *.s *.q|R Script Files (*.R *.r *.S *.s *.q)\n*.*|All Files (*.*)", this, i18n ("Open command file(s)"));
-
+#endif
 	for (it = urls.begin() ; it != urls.end() ; ++it) {
 		slotOpenCommandEditor (*it);
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list