[rkward-cvs] SF.net SVN: rkward:[2950] trunk/rkward/rkward/scriptbackends
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Jul 15 18:44:35 UTC 2010
Revision: 2950
http://rkward.svn.sourceforge.net/rkward/?rev=2950&view=rev
Author: tfry
Date: 2010-07-15 18:44:35 +0000 (Thu, 15 Jul 2010)
Log Message:
-----------
Compilation fix for KDE < 4.3
Modified Paths:
--------------
trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp
trunk/rkward/rkward/scriptbackends/rkcomponentscripting.h
Modified: trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp 2010-07-15 18:29:07 UTC (rev 2949)
+++ trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp 2010-07-15 18:44:35 UTC (rev 2950)
@@ -18,6 +18,7 @@
#include "rkcomponentscripting.h"
#include <klocale.h>
+#include <kdeversion.h>
#include "../plugin/rkcomponent.h"
#include "../core/robjectlist.h"
@@ -50,6 +51,9 @@
}
QDir files_path (RKCommonFunctions::getRKWardDataDir () + "phpfiles/");
_command.prepend ("_rkward.include('" + files_path.absoluteFilePath ("rkcomponentscripting.js") + "');\n");
+#if not KDE_IS_VERSION(4,3,0)
+ _command.prepend ("_rk_eval = function (x) { eval (x); }\n");
+#endif
script->setCode (_command.toUtf8 ());
script->trigger ();
@@ -79,14 +83,24 @@
QFile file (_filename);
if (!file.open (QIODevice::ReadOnly | QIODevice::Text)) {
- script->evaluate (i18n ("error ('The file \"%1\" (needed by \"%2\") could not be found. Please check your installation.');\n", _filename, _scriptfile).toUtf8 ());
+ evaluate (i18n ("error ('The file \"%1\" (needed by \"%2\") could not be found. Please check your installation.');\n", _filename, _scriptfile).toUtf8 ());
return;
}
- script->evaluate (file.readAll());
+ evaluate (file.readAll());
handleScriptError (_filename);
}
+void RKComponentScriptingProxy::evaluate (const QByteArray &code) {
+ RK_TRACE (PHP);
+
+#if KDE_IS_VERSION(4,3,0)
+ script->evaluate (code);
+#else
+ script->callFunction ("_rk_eval", QVariantList() << QString (code));
+#endif
+}
+
void RKComponentScriptingProxy::addScriptableWidget (const QString& name, QWidget *widget) {
RK_TRACE (PHP);
@@ -125,7 +139,7 @@
RK_TRACE (PHP);
QString command = component_commands.value (changed);
- script->evaluate (command.toUtf8());
+ evaluate (command.toUtf8());
}
QString RKComponentScriptingProxy::getValue (const QString &id) const {
Modified: trunk/rkward/rkward/scriptbackends/rkcomponentscripting.h
===================================================================
--- trunk/rkward/rkward/scriptbackends/rkcomponentscripting.h 2010-07-15 18:29:07 UTC (rev 2949)
+++ trunk/rkward/rkward/scriptbackends/rkcomponentscripting.h 2010-07-15 18:44:35 UTC (rev 2950)
@@ -59,6 +59,8 @@
RKComponent* component;
Kross::Action* script;
QString _scriptfile;
+/** helper function for compatibility with KDE < 4.3 */
+ void evaluate (const QByteArray &code);
void handleChange (RKComponentBase* changed);
QHash<RKComponentBase*, QString> component_commands;
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