[rkward-cvs] SF.net SVN: rkward:[2525] trunk/rkward/rkward/dialogs/rkloadlibsdialog.cpp

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Jun 10 19:42:17 UTC 2009


Revision: 2525
          http://rkward.svn.sourceforge.net/rkward/?rev=2525&view=rev
Author:   tfry
Date:     2009-06-10 19:42:17 +0000 (Wed, 10 Jun 2009)

Log Message:
-----------
Package installation works on windows (as long as permissions are sufficient)

Modified Paths:
--------------
    trunk/rkward/rkward/dialogs/rkloadlibsdialog.cpp

Modified: trunk/rkward/rkward/dialogs/rkloadlibsdialog.cpp
===================================================================
--- trunk/rkward/rkward/dialogs/rkloadlibsdialog.cpp	2009-06-10 19:41:28 UTC (rev 2524)
+++ trunk/rkward/rkward/dialogs/rkloadlibsdialog.cpp	2009-06-10 19:42:17 UTC (rev 2525)
@@ -2,7 +2,7 @@
                           rkloadlibsdialog  -  description
                              -------------------
     begin                : Mon Sep 6 2004
-    copyright            : (C) 2004, 2006, 2007, 2008 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2006, 2007, 2008, 2009 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -184,16 +184,27 @@
 		QTextStream stream (&file);
 		stream << "options (repos=" + repos_string + ")\n" + command_string;
 		if (as_root) {
+#ifdef Q_WS_WIN
+			RK_ASSERT (false);
+#else
 			KUser user;
 			stream << QString ("system (\"chown ") + user.loginName() + ' ' + QDir (RKSettingsModuleGeneral::filesPath ()).filePath ("package_archive") + "/*\")\n";
+#endif
 		}
 		stream << "q ()\n";
 		file.close();
+	} else {
+		RK_ASSERT (false);
 	}
 
 	QString R_binary (getenv ("R_binary"));
 	QString call;
 	QStringList params;
+#ifdef Q_WS_WIN
+	RK_ASSERT (!as_root);
+	call = R_binary;
+	params << "--no-save" << "--file=" + file.fileName ();
+#else
 	if (as_root) {
 		call = KStandardDirs::findExe ("kdesu");
 		params << "-t";
@@ -202,6 +213,7 @@
 		params << "-c";
 	}
 	params << R_binary + " CMD R --no-save < " + file.fileName ();
+#endif
 
 	installation_process = new QProcess ();
 	installation_process->setProcessChannelMode (QProcess::SeparateChannels);
@@ -812,11 +824,23 @@
 
 	QFileInfo fi = QFileInfo (libraryLocation ());
 	if (!fi.isWritable ()) {
-		int res = KMessageBox::questionYesNo (this, i18n ("The directory you are trying to install to (%1) is not writable with your current user permissions. If you are the adminitstrator of this machine, you can try to install the packages as root (you'll be prompted for the root password). Otherwise you'll have to chose a different library location to install to (if none are writable, you will probably want to use the \"Configure Repositories\"-button to set up a writable directory to install packages to).", libraryLocation ()), i18n ("Selected library location not writable"), KGuiItem (i18n ("Become root")), KGuiItem (i18n ("&Cancel")));
-		if (res == KMessageBox::Yes) {
+		QString mcaption = i18n ("Selected library location not writable");
+		QString message = i18n ("The directory you are trying to install to (%1) is not writable with your current user permissions. "
+			"You can chose a different library location to install to (if none are wirtable, you will probably want to use the "
+			"\"Configure Repositories\"-button to set up a writable directory to install package to).\n", libraryLocation ());
+#ifdef Q_WS_WIN
+		message.append (i18n ("If have access to an administrator account on this machine, you can use that to install the package(s), or "
+			"you could change the permissions of '%1'. Sorry, automatic switching to Administrator is not yet supported in RKWard on Windows", libraryLocation ()));
+		int res = KMessageBox::warningContinueCancel (this, message, mcaption, KGuiItem (i18n ("Attempt installation, anyway")));
+		if (res == KMessageBox::Continue) return true;
+#else
+		message.append (i18n ("If you are the adminitstrator of this machine, you can try to install the packages as root (you'll be prompted for the root password)."));
+		int res = KMessageBox::warningContinueCancel (this, message, mcaption, KGuiItem (i18n ("Become root")));
+		if (res == KMessageBox::Continue) {
 			*as_root = true;
 			return true;
 		}
+#endif
 		return false;
 	}
 


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