[rkward-cvs] SF.net SVN: rkward:[3567] trunk/rkward/rkward/rbackend
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue May 17 12:08:09 UTC 2011
Revision: 3567
http://rkward.svn.sourceforge.net/rkward/?rev=3567&view=rev
Author: tfry
Date: 2011-05-17 12:08:09 +0000 (Tue, 17 May 2011)
Log Message:
-----------
Fix CSS link on Windows
Modified Paths:
--------------
trunk/rkward/rkward/rbackend/rinterface.cpp
trunk/rkward/rkward/rbackend/rkrbackend.cpp
trunk/rkward/rkward/rbackend/rkrbackend.h
Modified: trunk/rkward/rkward/rbackend/rinterface.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.cpp 2011-05-17 10:17:48 UTC (rev 3566)
+++ trunk/rkward/rkward/rbackend/rinterface.cpp 2011-05-17 12:08:09 UTC (rev 3567)
@@ -479,7 +479,7 @@
RK_ASSERT (calllist.count () == 2);
RKOutputWindowManager::self ()->setCurrentOutputPath (calllist.value (1));
} else if (call == "getCSSlink") {
- return (QStringList (QString ("<link rel=\"StyleSheet\" type=\"text/css\" href=\"file://" + RKCommonFunctions::getRKWardDataDir () + "pages/rkward_output.css" "\"/>\n")));
+ return (QStringList (QString ("<link rel=\"StyleSheet\" type=\"text/css\" href=\"" + KUrl::fromLocalFile (RKCommonFunctions::getRKWardDataDir () + "pages/rkward_output.css").toString () + "\"/>\n")));
} else if (call == "wdChange") {
// in case of separate processes, apply new working directory in frontend, too.
QDir::setCurrent (calllist.value (1));
Modified: trunk/rkward/rkward/rbackend/rkrbackend.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackend.cpp 2011-05-17 10:17:48 UTC (rev 3566)
+++ trunk/rkward/rkward/rbackend/rkrbackend.cpp 2011-05-17 12:08:09 UTC (rev 3567)
@@ -1183,13 +1183,29 @@
}
}
+void RKRBackend::catToOutputFile (const QString &out) {
+ RK_TRACE (RBACKEND);
+
+ if (output_file.isEmpty ()) {
+ RK_ASSERT (false);
+ return;
+ }
+ QFile f (output_file);
+ if (!f.open (QIODevice::WriteOnly | QIODevice::Append)) {
+ RK_ASSERT (false);
+ return;
+ }
+ f.write (current_locale_codec->fromUnicode (out));
+ f.close ();
+}
+
void RKRBackend::printCommand (const QString &command) {
RK_TRACE (RBACKEND);
QStringList params ("highlightRCode");
params.append (command);
QString highlighted = handlePlainGenericRequest (params, true).value (0);
- runDirectCommand (".rk.cat.output (" + RKRSharedFunctionality::quote (highlighted) + ")");
+ catToOutputFile (highlighted);
}
void RKRBackend::startOutputCapture () {
@@ -1207,8 +1223,8 @@
QString out = handlePlainGenericRequest (params, true).value (0);
if (out.isEmpty ()) return;
- if (with_header) runDirectCommand (".rk.cat.output (\"<h2>Messages, warnings, or errors:</h2>\\n\")");
- runDirectCommand (".rk.cat.output (" + RKRSharedFunctionality::quote (out) + ")");
+ if (with_header) out.prepend ("<h2>Messages, warnings, or errors:</h2>\n");
+ catToOutputFile (out);
}
void RKRBackend::run () {
@@ -1333,6 +1349,9 @@
dummy.append (RKRBackendProtocolBackend::backendDebugFile ());
dummy.append (R_MAJOR "." R_MINOR " " R_STATUS " (" R_YEAR "-" R_MONTH "-" R_DAY " r" R_SVN_REVISION ")");
request.params["call"] = dummy;
+ } else if (parameters.value (0) == "set.output.file") {
+ output_file = parameters.value (1);
+ request.params["call"] = parameters;
} else {
request.params["call"] = parameters;
}
Modified: trunk/rkward/rkward/rbackend/rkrbackend.h
===================================================================
--- trunk/rkward/rkward/rbackend/rkrbackend.h 2011-05-17 10:17:48 UTC (rev 3566)
+++ trunk/rkward/rkward/rbackend/rkrbackend.h 2011-05-17 12:08:09 UTC (rev 3567)
@@ -177,6 +177,7 @@
void startOutputCapture ();
void printAndClearCapturedMessages (bool with_header);
void printCommand (const QString &command);
+ void catToOutputFile (const QString &out);
QMutex all_current_commands_mutex;
QList<RCommandProxy*> current_commands_to_cancel;
@@ -193,7 +194,7 @@
void connectCallbacks ();
int r_version;
-private:
+ QString output_file;
/** A copy of the names of the toplevel environments (as returned by "search ()"). */
QStringList toplevel_env_names;
/** A copy of the names of the toplevel symbols in the .GlobalEnv. */
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