diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:44:01 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:44:01 +0000 |
commit | 479f5f799523bffbcc83dff581a2299c047c6fff (patch) | |
tree | 186aae707ed02aac6c7cab2fb14e97f72aca5e36 /kjsembed/jsbuiltin_imp.cpp | |
parent | f1dbff6145c98324ff82e34448b7483727e8ace4 (diff) | |
download | tdebindings-479f5f799523bffbcc83dff581a2299c047c6fff.tar.gz tdebindings-479f5f799523bffbcc83dff581a2299c047c6fff.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1157645 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kjsembed/jsbuiltin_imp.cpp')
-rw-r--r-- | kjsembed/jsbuiltin_imp.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/kjsembed/jsbuiltin_imp.cpp b/kjsembed/jsbuiltin_imp.cpp index c916a986..8a54cabf 100644 --- a/kjsembed/jsbuiltin_imp.cpp +++ b/kjsembed/jsbuiltin_imp.cpp @@ -20,9 +20,9 @@ // #define HAVE_KSPY 1 #include <stdio.h> -#include <qobject.h> -#include <qfile.h> -#include <qtextstream.h> +#include <tqobject.h> +#include <tqfile.h> +#include <tqtextstream.h> #ifndef QT_ONLY @@ -35,8 +35,8 @@ #else -#include <qinputdialog.h> -#include <qmessagebox.h> +#include <tqinputdialog.h> +#include <tqmessagebox.h> #endif // QT_ONLY @@ -61,7 +61,7 @@ namespace KJSEmbed { namespace Bindings { -JSBuiltInImp::JSBuiltInImp( JSBuiltIn *builtin, int mid, const QString &p ) +JSBuiltInImp::JSBuiltInImp( JSBuiltIn *builtin, int mid, const TQString &p ) : JSProxyImp(builtin->part()->globalExec()), part(builtin->part()), id(mid), param(p) { setName( KJS::Identifier( KJS::UString(param) ) ); @@ -71,8 +71,8 @@ JSBuiltInImp::~JSBuiltInImp() {} KJS::Value JSBuiltInImp::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) { - QString arg0 = (args.size() > 0) ? args[0].toString(exec).qstring() : QString::null; - QString arg1 = (args.size() > 1) ? args[1].toString(exec).qstring() : QString::null; + TQString arg0 = (args.size() > 0) ? args[0].toString(exec).qstring() : TQString::null; + TQString arg1 = (args.size() > 1) ? args[1].toString(exec).qstring() : TQString::null; if ( id == MethodLoadScript ) { @@ -85,7 +85,7 @@ KJS::Value JSBuiltInImp::call( KJS::ExecState *exec, KJS::Object &self, const KJ return KJS::Boolean( ok ); } else { - QString msg = i18n( "Method requires 1 or 2 arguments, received %1." ).arg( args.size() ); + TQString msg = i18n( "Method requires 1 or 2 arguments, received %1." ).arg( args.size() ); return throwError(exec, msg); } } @@ -109,45 +109,45 @@ KJS::Value JSBuiltInImp::call( KJS::ExecState *exec, KJS::Object &self, const KJ } else if ( id == MethodReadLine ) { - QString line = conin()->readLine(); + TQString line = conin()->readLine(); if ( !line.isNull() ) return KJS::String( line ); } else if ( id == MethodOpenFile ) { // #warning "This is leaked!!!!!" -// QFile *f=new QFile( arg0 ); +// TQFile *f=new TQFile( arg0 ); // int mode = 0; -// if ( arg1 == QString("ro") ) +// if ( arg1 == TQString("ro") ) // mode = IO_ReadOnly; -// else if ( arg1 == QString("wo") ) +// else if ( arg1 == TQString("wo") ) // mode = IO_WriteOnly; // if ( !f->open( mode ) ) // return KJS::Boolean(false); -// Bindings::TextStream *ts = new Bindings::TextStream( part, "file", new QTextStream(f) ); +// Bindings::TextStream *ts = new Bindings::TextStream( part, "file", new TQTextStream(f) ); // return KJS::Object( ts ); return KJS::Null(); } else if ( id == MethodReadFile ) { - QFile f( arg0 ); + TQFile f( arg0 ); if ( !f.open( IO_ReadOnly ) ) { - QString msg = i18n( "Could not open file '%1'." ).arg(arg0); + TQString msg = i18n( "Could not open file '%1'." ).arg(arg0); return throwError(exec, msg); } - QString s = f.readAll(); + TQString s = f.readAll(); return KJS::String( s ); } else if ( id == MethodWriteFile ) { - QFile f( arg0 ); + TQFile f( arg0 ); if ( !f.open( IO_WriteOnly ) ) return KJS::Boolean( false ); - QTextStream ts( &f ); + TQTextStream ts( &f ); ts << arg1; return KJS::Boolean( true ); @@ -171,16 +171,16 @@ KJS::Value JSBuiltInImp::call( KJS::ExecState *exec, KJS::Object &self, const KJ } else if ( id == MethodSaxLoadFile ) { if ( args.size() != 2 ) { - QString msg = i18n( "Method requires 2 arguments, received %1." ).arg( args.size() ); + TQString msg = i18n( "Method requires 2 arguments, received %1." ).arg( args.size() ); return throwError(exec, msg); } BuiltIns::SaxHandler sax( exec ); sax.setHandler( args[0].toObject(exec) ); - QFile f( arg1 ); - QXmlInputSource src( &f ); - QXmlSimpleReader reader; + TQFile f( arg1 ); + TQXmlInputSource src( &f ); + TQXmlSimpleReader reader; reader.setContentHandler( &sax ); bool ok = reader.parse( src ); @@ -193,11 +193,11 @@ KJS::Value JSBuiltInImp::call( KJS::ExecState *exec, KJS::Object &self, const KJ else if ( id == MethodDumpCompletion ) { KJS::Object obj = obj.isValid() ? args[0].toObject(exec) : KJS::Object(); if ( !obj.isValid() ) { - QString msg = i18n( "Method requires an object." ); + TQString msg = i18n( "Method requires an object." ); return throwError(exec, msg,KJS::TypeError); } - QVariant v = dumpCompletion( exec, obj ); + TQVariant v = dumpCompletion( exec, obj ); return convertToValue( exec, v ); // FIXME: This will crash if the type is wrong } else if ( id == MethodAlert ) { @@ -205,7 +205,7 @@ KJS::Value JSBuiltInImp::call( KJS::ExecState *exec, KJS::Object &self, const KJ #ifndef QT_ONLY KMessageBox::information( 0L, arg0 ); #else // QT_ONLY - QMessageBox::information( 0L, i18n("Information"), arg0 ); + TQMessageBox::information( 0L, i18n("Information"), arg0 ); #endif // QT_ONLY return KJS::Undefined(); @@ -216,24 +216,24 @@ KJS::Value JSBuiltInImp::call( KJS::ExecState *exec, KJS::Object &self, const KJ #ifndef QT_ONLY answer = KMessageBox::questionYesNo( 0L, arg0 ); #else // QT_ONLY - answer = QMessageBox::question(0L, i18n("Question"), arg0 ); + answer = TQMessageBox::question(0L, i18n("Question"), arg0 ); #endif // QT_ONLY return KJS::Number( answer ); } else if ( id == MethodPrompt ) { - QString text; + TQString text; #ifndef QT_ONLY text = KInputDialog::getText( arg0, arg0, arg1 ); #else // QT_ONLY - text = QInputDialog::getText( arg0, arg0, QLineEdit::Normal, arg1 ); + text = QInputDialog::getText( arg0, arg0, TQLineEdit::Normal, arg1 ); #endif // QT_ONLY return KJS::String( text ); } else if ( id == MethodI18n ) { - QString retString(i18n(arg0.latin1())); + TQString retString(i18n(arg0.latin1())); return KJS::String( retString ); } else if ( id == MethodImport ) { @@ -242,11 +242,11 @@ KJS::Value JSBuiltInImp::call( KJS::ExecState *exec, KJS::Object &self, const KJ // Scan $KDEDIRS/share/apps/$APPNAME/ // Scan $KDEDIRS/share/apps/kjsembed/ KGlobal::dirs()->addResourceType("kjsembed", KStandardDirs::kde_default("data") +"/kjsembed/"); - QString fname = KGlobal::dirs ()->findResource ("kjsembed", QString(arg0)); + TQString fname = KGlobal::dirs ()->findResource ("kjsembed", TQString(arg0)); kdDebug(80001) << "Loading: " << fname << endl; - //QString code = part->loadFile(fname); + //TQString code = part->loadFile(fname); return KJS::Boolean( part->runFile(fname, part->globalObject())); #else // QT_ONLY @@ -269,7 +269,7 @@ KJS::Value JSBuiltInImp::call( KJS::ExecState *exec, KJS::Object &self, const KJ kdWarning() << "JSBuiltInImp has no method " << id << endl; } - QString msg = i18n( "JSBuiltInImp has no method with id '%1'." ).arg( id ); + TQString msg = i18n( "JSBuiltInImp has no method with id '%1'." ).arg( id ); return throwError(exec, msg,KJS::ReferenceError); } |