summaryrefslogtreecommitdiffstats
path: root/kate/kjswrapper
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-18 17:00:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-18 17:00:31 +0000
commit395a904bff7b4d6ead445c342f7ac0c5fbf29121 (patch)
tree9829cadb79d2cc7c29a940627fadb28b11e54150 /kate/kjswrapper
parent399f47c376fdf4d19192732a701ea9578d11619d (diff)
downloadtdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.tar.gz
tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.zip
TQt4 port kdeaddons
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1237404 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kate/kjswrapper')
-rw-r--r--kate/kjswrapper/bindings.cpp28
-rw-r--r--kate/kjswrapper/bindings.h9
-rw-r--r--kate/kjswrapper/plugin_katekjswrapper.cpp36
-rw-r--r--kate/kjswrapper/plugin_katekjswrapper.h7
-rw-r--r--kate/kjswrapper/samples/katekjstest1.js36
5 files changed, 60 insertions, 56 deletions
diff --git a/kate/kjswrapper/bindings.cpp b/kate/kjswrapper/bindings.cpp
index 1bb56eb..aeddbbc 100644
--- a/kate/kjswrapper/bindings.cpp
+++ b/kate/kjswrapper/bindings.cpp
@@ -17,7 +17,7 @@
using namespace Kate::JS;
-Bindings::Bindings(TQObject *parent): KJSEmbed::Bindings::JSBindingPlugin(parent,"KateAppBindings",TQStringList()) {
+Bindings::Bindings(TQObject *tqparent): KJSEmbed::Bindings::JSBindingPlugin(tqparent,"KateAppBindings",TQStringList()) {
}
Bindings::~Bindings() {
@@ -74,11 +74,11 @@ void DocumentManager::addBindings(KJS::ExecState *exec, KJSEmbed::JSObjectProxy
object.put(exec, "closeAllDocument", KJS::Object(new DocumentManager( exec, CloseAllDocuments, proxy,dict )));
}
-DocumentManager::DocumentManager( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *parent, RefCountedObjectDict *dict ):KJSEmbed::JSProxyImp(exec) {
+DocumentManager::DocumentManager( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *tqparent, RefCountedObjectDict *dict ):KJSEmbed::JSProxyImp(exec) {
m_dict=dict;
m_dict->incRef();
m_id=id;
- m_proxy=parent;
+ m_proxy=tqparent;
}
DocumentManager::~DocumentManager() {
@@ -143,7 +143,7 @@ KJS::Value DocumentManager::call( KJS::ExecState *exec, KJS::Object &self, const
if (args.size()==1) {
KURL url = TQString( args[0].toString(exec).qstring() );
if (exec->hadException()) break;
- (void)dm->openURL(url,TQString::null,&docID);
+ (void)dm->openURL(url,TQString(),&docID);
return KJS::Number(docID);
} else if (args.size()==2) {
KURL url = TQString( args[0].toString(exec).qstring() );
@@ -178,7 +178,7 @@ KJS::Value DocumentManager::call( KJS::ExecState *exec, KJS::Object &self, const
kdDebug()<<"calling illegal method of DocumentManager"<<endl;
return KJS::Null();
}
- TQString msg = i18n("Method %1 called with wrong signature").arg(mdesc);
+ TQString msg = i18n("Method %1 called with wrong signature").tqarg(mdesc);
KJS::Object err = KJS::Error::create( exec, KJS::GeneralError, msg.utf8() );
exec->setException( err );
return KJS::Undefined();
@@ -231,7 +231,7 @@ KJS::Value Kate::JS::Management::call( KJS::ExecState *exec, KJS::Object &self,
}
void Kate::JS::Application::addBindings(KJS::ExecState *exec, KJSEmbed::JSObjectProxy *proxy,KJS::Object &object){
- PluginKateKJSWrapper *wrap=static_cast<PluginKateKJSWrapper*>(proxy->part()->parent());
+ PluginKateKJSWrapper *wrap=static_cast<PluginKateKJSWrapper*>(proxy->part()->tqparent());
KJS::Object ToolView(new Application( exec, ToolView, proxy ,wrap));
ToolView.put(exec,KJS::Identifier("Left"),KJS::Number(KDockWidget::DockLeft) ,KJS::ReadOnly | KJS::DontDelete);
ToolView.put(exec,KJS::Identifier("Top"),KJS::Number(KDockWidget::DockTop) ,KJS::ReadOnly | KJS::DontDelete);
@@ -262,10 +262,10 @@ void Kate::JS::Application::addBindings(KJS::ExecState *exec, KJSEmbed::JSObject
}
-Kate::JS::Application::Application( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *parent,PluginKateKJSWrapper *plugin):KJSEmbed::JSProxyImp(exec) {
+Kate::JS::Application::Application( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *tqparent,PluginKateKJSWrapper *plugin):KJSEmbed::JSProxyImp(exec) {
kdDebug()<<"Kate::JS::Application::Application"<<endl;
m_id=id;
- m_proxy=parent;
+ m_proxy=tqparent;
m_plugin=plugin;
}
@@ -310,7 +310,7 @@ KJS::Value Kate::JS::Application::call( KJS::ExecState *exec, KJS::Object &self,
}
- TQString msg = i18n("Method %1 called with wrong signature").arg(mdesc);
+ TQString msg = i18n("Method %1 called with wrong signature").tqarg(mdesc);
KJS::Object err = KJS::Error::create( exec, KJS::GeneralError, msg.utf8() );
exec->setException( err );
return KJS::Undefined();
@@ -390,7 +390,7 @@ void Kate::JS::RefCountedObjectDict::decRef() {
}
KJS::Object Kate::JS::RefCountedObjectDict::jsObject(KJS::ExecState *exec, TQObject *obj, KJSEmbed::JSObjectProxy *proxy) {
- ObjectEntry *oe=find(obj);
+ ObjectEntry *oe=tqfind(obj);
if (oe==0) {
oe=new ObjectEntry;
oe->obj=proxy->part()->factory()->createProxy(exec,obj,proxy);
@@ -417,7 +417,7 @@ void Kate::JS::MainWindow::addBindings(KJS::ExecState *exec, KJSEmbed::JSObjectP
if (!mw) return;
kdDebug()<<"Kate::JS::MainWindow::addBindings - 3"<<endl;
- PluginKateKJSWrapper *wrap=static_cast<PluginKateKJSWrapper*>(proxy->part()->parent());
+ PluginKateKJSWrapper *wrap=static_cast<PluginKateKJSWrapper*>(proxy->part()->tqparent());
if (!wrap) return;
kdDebug()<<"Kate::JS::MainWindow::addBindings - 4"<<endl;
@@ -427,10 +427,10 @@ void Kate::JS::MainWindow::addBindings(KJS::ExecState *exec, KJSEmbed::JSObjectP
-Kate::JS::MainWindow::MainWindow( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *parent,PluginKateKJSWrapper *plugin):KJSEmbed::JSProxyImp(exec) {
+Kate::JS::MainWindow::MainWindow( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *tqparent,PluginKateKJSWrapper *plugin):KJSEmbed::JSProxyImp(exec) {
kdDebug()<<"Kate::JS::MainWindow::MainWindow"<<endl;
m_id=id;
- m_proxy=parent;
+ m_proxy=tqparent;
m_plugin=plugin;
}
@@ -458,7 +458,7 @@ KJS::Value Kate::JS::MainWindow::call( KJS::ExecState *exec, KJS::Object &self,
default:
return KJS::Undefined();
}
- TQString msg = i18n("Method %1 called with wrong signature").arg(mdesc);
+ TQString msg = i18n("Method %1 called with wrong signature").tqarg(mdesc);
KJS::Object err = KJS::Error::create( exec, KJS::GeneralError, msg.utf8() );
exec->setException( err );
return KJS::Undefined();
diff --git a/kate/kjswrapper/bindings.h b/kate/kjswrapper/bindings.h
index f33418f..4fc8449 100644
--- a/kate/kjswrapper/bindings.h
+++ b/kate/kjswrapper/bindings.h
@@ -19,6 +19,7 @@ namespace Kate {
class RefCountedObjectDict: public TQObject, public TQPtrDict<ObjectEntry> {
Q_OBJECT
+ TQ_OBJECT
public:
RefCountedObjectDict(int size);
void incRef();
@@ -33,7 +34,7 @@ namespace Kate {
class Bindings: public KJSEmbed::Bindings::JSBindingPlugin {
public:
- Bindings(TQObject *parent);
+ Bindings(TQObject *tqparent);
virtual ~Bindings();
KJS::Object createBinding(KJSEmbed::KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const;
void addBindings(KJS::ExecState *exec, KJS::Object &target) const;
@@ -56,7 +57,7 @@ namespace Kate {
virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
static void addBindings(KJS::ExecState *exec, KJSEmbed::JSObjectProxy *proxy,KJS::Object &target);
private:
- DocumentManager( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *parent, RefCountedObjectDict *dict );
+ DocumentManager( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *tqparent, RefCountedObjectDict *dict );
virtual ~DocumentManager();
private:
RefCountedObjectDict *m_dict;
@@ -97,7 +98,7 @@ namespace Kate {
virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
static void addBindings(KJS::ExecState *exec, KJSEmbed::JSObjectProxy *proxy,KJS::Object &target);
private:
- Application( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *parent, PluginKateKJSWrapper *plugin );
+ Application( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *tqparent, PluginKateKJSWrapper *plugin );
~Application();
private:
int m_id;
@@ -135,7 +136,7 @@ namespace Kate {
virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
static void addBindings(KJS::ExecState *exec, KJSEmbed::JSObjectProxy *proxy,KJS::Object &target);
private:
- MainWindow( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *parent, PluginKateKJSWrapper *plugin );
+ MainWindow( KJS::ExecState *exec, int id, KJSEmbed::JSObjectProxy *tqparent, PluginKateKJSWrapper *plugin );
~MainWindow();
private:
int m_id;
diff --git a/kate/kjswrapper/plugin_katekjswrapper.cpp b/kate/kjswrapper/plugin_katekjswrapper.cpp
index 8fc4ae5..4ebac34 100644
--- a/kate/kjswrapper/plugin_katekjswrapper.cpp
+++ b/kate/kjswrapper/plugin_katekjswrapper.cpp
@@ -53,8 +53,8 @@ void PluginKateKJSWrapperView::removeFromWindow() {
win->guiFactory()->removeClient (this);
}
-PluginKateKJSWrapper::PluginKateKJSWrapper( TQObject* parent, const char* name, const TQStringList& list)
- : Kate::Plugin ( (Kate::Application *)parent, name ) {
+PluginKateKJSWrapper::PluginKateKJSWrapper( TQObject* tqparent, const char* name, const TQStringList& list)
+ : Kate::Plugin ( (Kate::Application *)tqparent, name ) {
m_views.setAutoDelete(true);
m_scriptname=list[0];
m_kateAppBindings=new Kate::JS::Bindings(this);
@@ -65,15 +65,15 @@ PluginKateKJSWrapper::PluginKateKJSWrapper( TQObject* parent, const char* name,
KJSEmbed::JSFactory *factory=m_part->factory();
/* factories for kate app classes */
- factory->addQObjectPlugin("Kate::Application",m_kateAppBindings);
- factory->addQObjectPlugin("Kate::DocumentManager",m_kateAppBindings);
- factory->addQObjectPlugin("Kate::MainWindow",m_kateAppBindings);
- factory->addQObjectPlugin("Kate::PluginManager",m_kateAppBindings);
- factory->addQObjectPlugin("Kate::InitPluginManager",m_kateAppBindings);
- factory->addQObjectPlugin("Kate::ProjectManager",m_kateAppBindings);
- factory->addQObjectPlugin("Kate::Project",m_kateAppBindings);
- factory->addQObjectPlugin("Kate::ViewManager",m_kateAppBindings);
- factory->addQObjectPlugin("Kate::View",m_kateAppBindings);
+ factory->addTQObjectPlugin("Kate::Application",m_kateAppBindings);
+ factory->addTQObjectPlugin("Kate::DocumentManager",m_kateAppBindings);
+ factory->addTQObjectPlugin("Kate::MainWindow",m_kateAppBindings);
+ factory->addTQObjectPlugin("Kate::PluginManager",m_kateAppBindings);
+ factory->addTQObjectPlugin("Kate::InitPluginManager",m_kateAppBindings);
+ factory->addTQObjectPlugin("Kate::ProjectManager",m_kateAppBindings);
+ factory->addTQObjectPlugin("Kate::Project",m_kateAppBindings);
+ factory->addTQObjectPlugin("Kate::ViewManager",m_kateAppBindings);
+ factory->addTQObjectPlugin("Kate::View",m_kateAppBindings);
/* toplevel objects*/
KJS::Object appobj=m_part->addObject(Kate::application(),"KATE");
js->globalObject().put( js->globalExec(), "addConfigPage", KJS::Object(new Kate::JS::Management(js->globalExec(),Kate::JS::Management::AddConfigPage,this )));
@@ -86,7 +86,7 @@ PluginKateKJSWrapper::PluginKateKJSWrapper( TQObject* parent, const char* name,
w->show();
//w->show();*/
kdDebug()<<"m_scriptname="<<m_scriptname<<endl;
- m_part->runFile(locate("appdata",TQString("plugins/%1/%2.js").arg(m_scriptname).arg(m_scriptname)));
+ m_part->runFile(locate("appdata",TQString("plugins/%1/%2.js").tqarg(m_scriptname).tqarg(m_scriptname)));
//"/home/jowenn/development/kde/cvs/kdeaddons/kate/kjswrapper/samples/test1.js");
}
@@ -343,7 +343,7 @@ void PluginKateKJSWrapper::addView(Kate::MainWindow *win)
if (exec->hadException()) kdDebug()<<"void PluginKateKJSWrapper::addView(Kate::MainWindow *win): exec had an exception - 2"<<endl;
view->setInstance (new KInstance("kate"));
- view->setXMLFile(TQString("plugins/%1/%2.rc").arg(m_scriptname).arg(m_scriptname));
+ view->setXMLFile(TQString("plugins/%1/%2.rc").tqarg(m_scriptname).tqarg(m_scriptname));
win->guiFactory()->addClient (view);
}
@@ -370,18 +370,18 @@ void PluginKateKJSWrapper::applyConfig( KateKJSWrapperConfigPage *p )
#endif
}
-KateKJSWrapperConfigPage::KateKJSWrapperConfigPage(KJS::Object pageConstructor,PluginKateKJSWrapper* parent,
- TQWidget *parentWidget)
- : Kate::PluginConfigPage( parentWidget ),m_plugin(parent)
+KateKJSWrapperConfigPage::KateKJSWrapperConfigPage(KJS::Object pageConstructor,PluginKateKJSWrapper* tqparent,
+ TQWidget *tqparentWidget)
+ : Kate::PluginConfigPage( tqparentWidget ),m_plugin(tqparent)
{
TQVBoxLayout *l=new TQVBoxLayout(this);
l->setAutoAdd(true);
l->activate();
- KJS::Interpreter *js = parent->m_part->interpreter();
+ KJS::Interpreter *js = tqparent->m_part->interpreter();
KJS::ExecState *exec = js->globalExec();
exec->clearException();
KJS::List param;
- param.append(parent->m_part->factory()->createProxy(exec,this,0));
+ param.append(tqparent->m_part->factory()->createProxy(exec,this,0));
m_pageObject=pageConstructor.construct(exec,param);
}
diff --git a/kate/kjswrapper/plugin_katekjswrapper.h b/kate/kjswrapper/plugin_katekjswrapper.h
index 9256b4c..ee6a311 100644
--- a/kate/kjswrapper/plugin_katekjswrapper.h
+++ b/kate/kjswrapper/plugin_katekjswrapper.h
@@ -73,9 +73,10 @@ class PluginKateKJSWrapper : public Kate::Plugin,
Kate::PluginConfigInterfaceExtension
{
Q_OBJECT
+ TQ_OBJECT
public:
- PluginKateKJSWrapper( TQObject* parent = 0, const char* name = 0, const TQStringList& = TQStringList() );
+ PluginKateKJSWrapper( TQObject* tqparent = 0, const char* name = 0, const TQStringList& = TQStringList() );
virtual ~PluginKateKJSWrapper();
void addView (Kate::MainWindow *win);
@@ -117,10 +118,11 @@ class PluginKateKJSWrapper : public Kate::Plugin,
class KateKJSWrapperConfigPage : public Kate::PluginConfigPage
{
Q_OBJECT
+ TQ_OBJECT
friend class PluginKateKJSWrapper;
public:
- KateKJSWrapperConfigPage(KJS::Object pageConstructor,PluginKateKJSWrapper* parent = 0L, TQWidget *parentWidget = 0L);
+ KateKJSWrapperConfigPage(KJS::Object pageConstructor,PluginKateKJSWrapper* tqparent = 0L, TQWidget *tqparentWidget = 0L);
~KateKJSWrapperConfigPage() {};
/** Reimplemented from Kate::PluginConfigPage
@@ -166,6 +168,7 @@ namespace Kate {
namespace JS {
class ToolView: public TQVBox {
Q_OBJECT
+ TQ_OBJECT
public:
ToolView(KJS::Object constr, KJS::ExecState *exec, KJSEmbed::JSFactory *factory, KJS::List parameters, const char * name);
virtual ~ToolView();
diff --git a/kate/kjswrapper/samples/katekjstest1.js b/kate/kjswrapper/samples/katekjstest1.js
index 7e4e041..a8b061b 100644
--- a/kate/kjswrapper/samples/katekjstest1.js
+++ b/kate/kjswrapper/samples/katekjstest1.js
@@ -1,7 +1,7 @@
/****************************************************************
First configuration page
****************************************************************/
-function Page1 (parentWidget) {
+function Page1 (tqparentWidget) {
this.defaults=function() {
alert("Defaults has been called");
}
@@ -11,7 +11,7 @@ function Page1 (parentWidget) {
this.reset=function() {
alert("Reset defaults has been called");
}
- box=new QVBox(parentWidget);
+ box=new QVBox(tqparentWidget);
this.button1=new QPushButton(box);
this.button1.text="P1 Button 1";
this.button1.show();
@@ -27,8 +27,8 @@ Page1.fullName="Test1/Page1";
Second configuration page
****************************************************************/
-function Page2 (parentWidget) {
- box=new QVBox(parentWidget);
+function Page2 (tqparentWidget) {
+ box=new QVBox(tqparentWidget);
this.button1=new QPushButton(box);
this.button1.text="P2 Button 1";
this.button1.show();
@@ -44,8 +44,8 @@ Page2.fullName="Test1/Page2";
Third configuration page
****************************************************************/
-function Page3 (parentWidget) {
- box=new QVBox(parentWidget);
+function Page3 (tqparentWidget) {
+ box=new QVBox(tqparentWidget);
this.button1=new QPushButton(box);
this.button1.text="P3 Button 1";
this.button1.show();
@@ -62,11 +62,11 @@ Page3.fullName="Test1/Page3";
First toolview
****************************************************************/
-function MyToolView1 (mainwindow,parentwidget) {
- parentwidget.caption="This is my first JS Toolview";
- parentwidget.icon=StdIcons.BarIcon("yes");
+function MyToolView1 (mainwindow,tqparentwidget) {
+ tqparentwidget.caption="This is my first JS Toolview";
+ tqparentwidget.icon=StdIcons.BarIcon("yes");
- this.lv = new KListView( parentwidget );
+ this.lv = new KListView( tqparentwidget );
this.lv.addColumn('Pix');
this.lv.addColumn('One');
@@ -99,11 +99,11 @@ MyToolView1.name="myfirstjstoolview"
Second toolview
****************************************************************/
-function MyToolView2 (mainwindow,parentwidget) {
- parentwidget.caption="This is my second JS Toolview";
- parentwidget.icon=StdIcons.BarIcon("no");
+function MyToolView2 (mainwindow,tqparentwidget) {
+ tqparentwidget.caption="This is my second JS Toolview";
+ tqparentwidget.icon=StdIcons.BarIcon("no");
- this.lb=new QListBox(parentwidget);
+ this.lb=new QListBox(tqparentwidget);
this.mainwindow=mainwindow;
this.cleanup=function() {
alert("Cleanup MyToolView2");
@@ -121,11 +121,11 @@ MyToolView2.name="mysecondjstoolview"
function newWindowCallBack(mainwindow) {
alert("New Window has been created");
/*
- anotherToolView = function (mainwindow,parentwidget) {
- parentwidget.caption="This is my third JS Toolview";
- parentwidget.icon=StdIcons.BarIcon("kate");
+ anotherToolView = function (mainwindow,tqparentwidget) {
+ tqparentwidget.caption="This is my third JS Toolview";
+ tqparentwidget.icon=StdIcons.BarIcon("kate");
- this.lb=new QListBox(parentwidget);
+ this.lb=new QListBox(tqparentwidget);
this.mainwindow=mainwindow;
this.cleanup=function() {
alert("Cleanup MyToolView3");