summaryrefslogtreecommitdiffstats
path: root/kexi/formeditor/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/formeditor/scripting')
-rw-r--r--kexi/formeditor/scripting/formscript.cpp26
-rw-r--r--kexi/formeditor/scripting/formscript.h15
-rw-r--r--kexi/formeditor/scripting/scriptIO.cpp72
-rw-r--r--kexi/formeditor/scripting/scriptIO.h22
-rw-r--r--kexi/formeditor/scripting/scriptmanager.cpp8
-rw-r--r--kexi/formeditor/scripting/scriptmanager.h11
6 files changed, 78 insertions, 76 deletions
diff --git a/kexi/formeditor/scripting/formscript.cpp b/kexi/formeditor/scripting/formscript.cpp
index b598066e..1123e093 100644
--- a/kexi/formeditor/scripting/formscript.cpp
+++ b/kexi/formeditor/scripting/formscript.cpp
@@ -32,7 +32,7 @@
using namespace KFormDesigner;
FormScript::FormScript(Form *form, ScriptManager *manager, const char *name)
- : QObject(manager, name), m_manager(manager), m_form(form)
+ : TQObject(manager, name), m_manager(manager), m_form(form)
{
m_script = manager->krossManager()->getScriptContainer(form->widget()->name());
}
@@ -41,37 +41,37 @@ FormScript::~FormScript()
{
}
-QString
-FormScript::getCode(const QString &)
+TQString
+FormScript::getCode(const TQString &)
{
/// \todo Allow to select only one function
return m_script->getCode();
}
void
-FormScript::setCode(const QString &code)
+FormScript::setCode(const TQString &code)
{
m_script->setCode(code);
}
void
-FormScript::appendCode(const QString &code)
+FormScript::appendCode(const TQString &code)
{
- QString s = m_script->getCode();
+ TQString s = m_script->getCode();
s.append("\n");
s.append(code);
m_script->setCode(s);
}
bool
-FormScript::execute(const QString &functionName)
+FormScript::execute(const TQString &functionName)
{
/// \todo support return value and arguments
try {
m_script->callFunction(functionName);
}
catch(Kross::Api::Exception& e) {
- kdDebug() << QString("EXCEPTION type='%1' description='%2'").arg(e.type()).arg(e.description()) << endl;
+ kdDebug() << TQString("EXCEPTION type='%1' description='%2'").tqarg(e.type()).tqarg(e.description()) << endl;
return false;
}
return true;
@@ -82,16 +82,16 @@ FormScript::connectEvents()
{
if(!m_form || !m_form->objectTree())
return;
- // first call addQObject for each widget in the Form
+ // first call addTQObject for each widget in the Form
ObjectTreeDict *dict = m_form->objectTree()->dict();
ObjectTreeDictIterator it(*dict);
for(; it.current(); ++it)
- m_script->addQObject(it.current()->widget());
- m_script->addQObject(m_form->widget());
+ m_script->addTQObject(it.current()->widget());
+ m_script->addTQObject(m_form->widget());
// Then we connect all signals
- QValueListConstIterator<Event*> endIt = m_list.constEnd();
- for(QValueListConstIterator<Event*> it = m_list.constBegin(); it != endIt; ++it) {
+ TQValueListConstIterator<Event*> endIt = m_list.constEnd();
+ for(TQValueListConstIterator<Event*> it = m_list.constBegin(); it != endIt; ++it) {
if( (*it)->type() == Event::Slot) {
connect((*it)->sender(), (*it)->signal(), (*it)->receiver(), (*it)->slot());
}
diff --git a/kexi/formeditor/scripting/formscript.h b/kexi/formeditor/scripting/formscript.h
index e3d63d74..4247ca85 100644
--- a/kexi/formeditor/scripting/formscript.h
+++ b/kexi/formeditor/scripting/formscript.h
@@ -22,8 +22,8 @@
#include "kexievents.h"
-#include <qobject.h>
-#include <qstring.h>
+#include <tqobject.h>
+#include <tqstring.h>
#include <ksharedptr.h>
class ScriptManager;
@@ -41,9 +41,10 @@ namespace Kross {
using namespace KFormDesigner;
//! A class that stores the code and events related to a single form
-class FormScript : public QObject
+class FormScript : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
FormScript(Form *form, ScriptManager *manager, const char *name=0);
@@ -53,16 +54,16 @@ class FormScript : public QObject
Kross::Api::ScriptContainer* scriptContainer() { return m_script; }
/*! \return The code of funtionName. If parameter is empty, it returns the full code of this form.*/
- QString getCode(const QString &functionName=QString::null);
+ TQString getCode(const TQString &functionName=TQString());
/*! Replaces the actual form code with the string \a code.
Called eg by (future) script editor. */
- void setCode(const QString &code);
+ void setCode(const TQString &code);
/*! Adds the string \a code at the end of current code. Used to add a function in the script. */
- void appendCode(const QString &code);
+ void appendCode(const TQString &code);
/*! Executes the \a functionName.
\todo how do we give parameters? */
- bool execute(const QString &functionName);
+ bool execute(const TQString &functionName);
/*! Really connects all events in the list.
Also calls Kross;;Api::Manager::addObject for each widget in the form to allow the user to
use these widgets in the script. */
diff --git a/kexi/formeditor/scripting/scriptIO.cpp b/kexi/formeditor/scripting/scriptIO.cpp
index 8620a8ae..ee0b1f59 100644
--- a/kexi/formeditor/scripting/scriptIO.cpp
+++ b/kexi/formeditor/scripting/scriptIO.cpp
@@ -27,30 +27,30 @@
#include "main/scriptcontainer.h"
bool
-ScriptIO::saveFormEvents(QDomNode &parentNode, FormScript *formScript)
+ScriptIO::saveFormEvents(TQDomNode &tqparentNode, FormScript *formScript)
{
- QDomDocument domDoc = parentNode.ownerDocument();
+ TQDomDocument domDoc = tqparentNode.ownerDocument();
// Save the form's code
if(!formScript->getCode().isEmpty()) {
- QDomElement script = domDoc.createElement("script");
+ TQDomElement script = domDoc.createElement("script");
script.setAttribute("language", formScript->scriptContainer()->getInterpreterName());
- parentNode.appendChild(script);
- QDomText scriptCode = domDoc.createTextNode(formScript->getCode());
+ tqparentNode.appendChild(script);
+ TQDomText scriptCode = domDoc.createTextNode(formScript->getCode());
script.appendChild(scriptCode);
}
// Save all form events
if(!formScript->eventList()->isEmpty())
- saveEventList(formScript->eventList(), parentNode);
+ saveEventList(formScript->eventList(), tqparentNode);
return true;
}
bool
-ScriptIO::loadFormEvents(QDomNode &parentNode, Form *form, ScriptManager *manager)
+ScriptIO::loadFormEvents(TQDomNode &tqparentNode, Form *form, ScriptManager *manager)
{
- QDomElement script = parentNode.namedItem("script").toElement();
- QDomElement events = parentNode.namedItem("events").toElement();
+ TQDomElement script = tqparentNode.namedItem("script").toElement();
+ TQDomElement events = tqparentNode.namedItem("events").toElement();
// Load script code
FormScript *formScript = new FormScript(form, manager);
@@ -61,14 +61,14 @@ ScriptIO::loadFormEvents(QDomNode &parentNode, Form *form, ScriptManager *manage
// Load all events in the EventList
if(!events.isNull()) {
- for(QDomNode n = events.firstChild(); !n.isNull(); n = n.nextSibling())
+ for(TQDomNode n = events.firstChild(); !n.isNull(); n = n.nextSibling())
loadEvent(n, formScript->eventList(), form);
}
return true;
}
bool
-ScriptIO::saveAllEventsForWidget(QObject *widget, FormScript *formScript, QDomNode &node)
+ScriptIO::saveAllEventsForWidget(TQObject *widget, FormScript *formScript, TQDomNode &node)
{
EventList *l = formScript->eventList()->allEventsForObject(widget);
saveEventList(l, node);
@@ -76,54 +76,54 @@ ScriptIO::saveAllEventsForWidget(QObject *widget, FormScript *formScript, QDomNo
}
void
-ScriptIO::saveEvent(Event *event, QDomNode &parentNode)
+ScriptIO::saveEvent(Event *event, TQDomNode &tqparentNode)
{
if(!event)
return;
- QDomDocument domDoc = parentNode.ownerDocument();
- QDomElement eventNode = domDoc.createElement("event");
+ TQDomDocument domDoc = tqparentNode.ownerDocument();
+ TQDomElement eventNode = domDoc.createElement("event");
eventNode.setAttribute("type", event->type());
- parentNode.appendChild(eventNode);
+ tqparentNode.appendChild(eventNode);
switch(event->type()) {
case Event::Slot: {
- QDomElement sender = domDoc.createElement("sender");
+ TQDomElement sender = domDoc.createElement("sender");
eventNode.appendChild(sender);
- QDomText senderText = domDoc.createTextNode(event->sender() ? event->sender()->name() : "");
+ TQDomText senderText = domDoc.createTextNode(event->sender() ? event->sender()->name() : "");
sender.appendChild(senderText);
- QDomElement signal = domDoc.createElement("signal");
+ TQDomElement signal = domDoc.createElement("signal");
eventNode.appendChild(signal);
- QDomText signalText = domDoc.createTextNode(event->signal());
+ TQDomText signalText = domDoc.createTextNode(event->signal());
signal.appendChild(signalText);
- QDomElement receiver = domDoc.createElement("receiver");
+ TQDomElement receiver = domDoc.createElement("receiver");
eventNode.appendChild(receiver);
- QDomText receiverText = domDoc.createTextNode(event->receiver() ? event->receiver()->name() : "");
+ TQDomText receiverText = domDoc.createTextNode(event->receiver() ? event->receiver()->name() : "");
receiver.appendChild(receiverText);
- QDomElement slot = domDoc.createElement("slot");
+ TQDomElement slot = domDoc.createElement("slot");
eventNode.appendChild(slot);
- QDomText slotText = domDoc.createTextNode(event->slot());
+ TQDomText slotText = domDoc.createTextNode(event->slot());
slot.appendChild(slotText);
break;
}
case Event::UserFunction: {
- QDomElement sender = domDoc.createElement("sender");
+ TQDomElement sender = domDoc.createElement("sender");
eventNode.appendChild(sender);
- QDomText senderText = domDoc.createTextNode(event->sender() ? event->sender()->name() : "");
+ TQDomText senderText = domDoc.createTextNode(event->sender() ? event->sender()->name() : "");
sender.appendChild(senderText);
- QDomElement signal = domDoc.createElement("signal");
+ TQDomElement signal = domDoc.createElement("signal");
eventNode.appendChild(signal);
- QDomText signalText = domDoc.createTextNode(event->signal());
+ TQDomText signalText = domDoc.createTextNode(event->signal());
signal.appendChild(signalText);
- QDomElement function = domDoc.createElement("function");
+ TQDomElement function = domDoc.createElement("function");
eventNode.appendChild(function);
- QDomText functionText = domDoc.createTextNode(event->slot());
+ TQDomText functionText = domDoc.createTextNode(event->slot());
function.appendChild(functionText);
break;
}
@@ -138,22 +138,22 @@ ScriptIO::saveEvent(Event *event, QDomNode &parentNode)
}
void
-ScriptIO::saveEventList(EventList *list, QDomNode &parentNode)
+ScriptIO::saveEventList(EventList *list, TQDomNode &tqparentNode)
{
if(!list || list->isEmpty())
return;
- QDomDocument domDoc = parentNode.ownerDocument();
- QDomElement events = domDoc.createElement("events");
- parentNode.appendChild(events);
+ TQDomDocument domDoc = tqparentNode.ownerDocument();
+ TQDomElement events = domDoc.createElement("events");
+ tqparentNode.appendChild(events);
- QValueListConstIterator<Event*> endIt = list->constEnd();
- for(QValueListConstIterator<Event*> it = list->constBegin(); it != endIt; ++it)
+ TQValueListConstIterator<Event*> endIt = list->constEnd();
+ for(TQValueListConstIterator<Event*> it = list->constBegin(); it != endIt; ++it)
saveEvent((*it), events);
}
void
-ScriptIO::loadEvent(QDomNode &node, EventList *list, Form *form)
+ScriptIO::loadEvent(TQDomNode &node, EventList *list, Form *form)
{
int type = node.toElement().attribute("type").toInt();
Event *event = new Event();
diff --git a/kexi/formeditor/scripting/scriptIO.h b/kexi/formeditor/scripting/scriptIO.h
index 9fed06a6..319de0fd 100644
--- a/kexi/formeditor/scripting/scriptIO.h
+++ b/kexi/formeditor/scripting/scriptIO.h
@@ -20,10 +20,10 @@
#ifndef SCRIPTIO_H
#define SCRIPTIO_H
-#include <qdom.h>
+#include <tqdom.h>
-class QString;
-class QObject;
+class TQString;
+class TQObject;
class Event;
class EventList;
class ScriptManager;
@@ -41,19 +41,19 @@ class ScriptIO
public:
/*! Save the evnts of a form.
Creates an \<events\> tag, and then one \<event\> tag for each event.
- Each event contains \<sender\> and \<receiver\> tags, with attributes depending on event type. */
- static bool saveFormEvents(QDomNode &parentNode, FormScript *script);
- /*! Reads the \<events\> tag (\a parentNode), then creates and fills a FormScript object linked to this \a form.
+ Each event tqcontains \<sender\> and \<receiver\> tags, with attributes depending on event type. */
+ static bool saveFormEvents(TQDomNode &tqparentNode, FormScript *script);
+ /*! Reads the \<events\> tag (\a tqparentNode), then creates and fills a FormScript object linked to this \a form.
The new FormScript object is then added to ScriptManager list.*/
- static bool loadFormEvents(QDomNode &parentNode, Form *form, ScriptManager *manager);
+ static bool loadFormEvents(TQDomNode &tqparentNode, Form *form, ScriptManager *manager);
/*! Save only the events related to widget \a name in the FormScript \a fscript.
Used eg when copying/pasting widgets to keep also events related to it.*/
- static bool saveAllEventsForWidget(QObject *widget, FormScript *fscript, QDomNode &node);
+ static bool saveAllEventsForWidget(TQObject *widget, FormScript *fscript, TQDomNode &node);
- static void saveEvent(Event *event, QDomNode &parentNode);
- static void saveEventList(EventList *list, QDomNode &parentNode);
- static void loadEvent(QDomNode &node, EventList *list, Form *form);
+ static void saveEvent(Event *event, TQDomNode &tqparentNode);
+ static void saveEventList(EventList *list, TQDomNode &tqparentNode);
+ static void loadEvent(TQDomNode &node, EventList *list, Form *form);
protected:
ScriptIO() {;}
diff --git a/kexi/formeditor/scripting/scriptmanager.cpp b/kexi/formeditor/scripting/scriptmanager.cpp
index c572c685..cfc5df04 100644
--- a/kexi/formeditor/scripting/scriptmanager.cpp
+++ b/kexi/formeditor/scripting/scriptmanager.cpp
@@ -27,8 +27,8 @@
using KFormDesigner::Form;
-ScriptManager::ScriptManager(QObject *parent, const char *name)
- : QObject(parent, name)
+ScriptManager::ScriptManager(TQObject *tqparent, const char *name)
+ : TQObject(tqparent, name)
{
m_manager = Kross::Api::Manager::scriptManager();
m_dict.setAutoDelete(true);
@@ -56,8 +56,8 @@ void
ScriptManager::setFormManager(FormManager *manager)
{
m_formManager = manager;
- connect(m_formManager, SIGNAL(aboutToDeleteForm(KFormDesigner::Form*)), this, SLOT(slotFormDeleted(KFormDesigner::Form*)));
- connect(m_formManager, SIGNAL(formCreated(KFormDesigner::Form*)), this, SLOT(newFormScript(KFormDesigner::Form*)));
+ connect(m_formManager, TQT_SIGNAL(aboutToDeleteForm(KFormDesigner::Form*)), this, TQT_SLOT(slotFormDeleted(KFormDesigner::Form*)));
+ connect(m_formManager, TQT_SIGNAL(formCreated(KFormDesigner::Form*)), this, TQT_SLOT(newFormScript(KFormDesigner::Form*)));
}
void
diff --git a/kexi/formeditor/scripting/scriptmanager.h b/kexi/formeditor/scripting/scriptmanager.h
index 258ce2cc..bc97ec3c 100644
--- a/kexi/formeditor/scripting/scriptmanager.h
+++ b/kexi/formeditor/scripting/scriptmanager.h
@@ -20,8 +20,8 @@
#ifndef SCRIPTMANAGER_H
#define SCRIPTMANAGER_H
-#include <qobject.h>
-#include <qptrdict.h>
+#include <tqobject.h>
+#include <tqptrdict.h>
class FormScript;
@@ -38,12 +38,13 @@ namespace KFormDesigner {
using namespace KFormDesigner;
-class ScriptManager : public QObject
+class ScriptManager : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
- ScriptManager(QObject *parent=0, const char *name=0);
+ ScriptManager(TQObject *tqparent=0, const char *name=0);
~ScriptManager();
/*! \return The FormScript object associated to this Form. */
@@ -62,7 +63,7 @@ class ScriptManager : public QObject
private:
Kross::Api::Manager *m_manager;
KFormDesigner::FormManager *m_formManager;
- QPtrDict<FormScript> m_dict;
+ TQPtrDict<FormScript> m_dict;
};
#endif