From ffe8a83e053396df448e9413828527613ca3bd46 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:46:43 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1157647 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kate/part/katejscript.cpp | 146 +++++++++++++++++++++++----------------------- 1 file changed, 73 insertions(+), 73 deletions(-) (limited to 'kate/part/katejscript.cpp') diff --git a/kate/part/katejscript.cpp b/kate/part/katejscript.cpp index 024f36500..75f5fc513 100644 --- a/kate/part/katejscript.cpp +++ b/kate/part/katejscript.cpp @@ -43,11 +43,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace KJS { @@ -58,7 +58,7 @@ namespace KJS { // Copyright (C) 2001-2003 David Faure (faure@kde.org) // Copyright (C) 2003 Apple Computer, Inc. -UString::UString(const QString &d) +UString::UString(const TQString &d) { unsigned int len = d.length(); UChar *dat = new UChar[len]; @@ -66,14 +66,14 @@ UString::UString(const QString &d) rep = UString::Rep::create(dat, len); } -QString UString::qstring() const +TQString UString::qstring() const { - return QString((QChar*) data(), size()); + return TQString((TQChar*) data(), size()); } -QConstString UString::qconststring() const +TQConstString UString::qconststring() const { - return QConstString((QChar*) data(), size()); + return TQConstString((TQChar*) data(), size()); } //BEGIN global methods @@ -267,7 +267,7 @@ KJS::ObjectImp *KateJScript::wrapView (KJS::ExecState *exec, KateView *view) return new KateJSView(exec, view); } -bool KateJScript::execute (KateView *view, const QString &script, QString &errorMsg) +bool KateJScript::execute (KateView *view, const TQString &script, TQString &errorMsg) { // no view, no fun if (!view) @@ -653,13 +653,13 @@ void KateJScriptManager::collectScripts (bool force) } // Let's get a list of all the .js files - QStringList list = KGlobal::dirs()->findAllResources("data","katepart/scripts/*.js",false,true); + TQStringList list = KGlobal::dirs()->findAllResources("data","katepart/scripts/*.js",false,true); // Let's iterate through the list and build the Mode List - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) { // Each file has a group called: - QString Group="Cache "+ *it; + TQString Group="Cache "+ *it; // Let's go to this group config.setGroup(Group); @@ -667,7 +667,7 @@ void KateJScriptManager::collectScripts (bool force) // stat the file struct stat sbuf; memset (&sbuf, 0, sizeof(sbuf)); - stat(QFile::encodeName(*it), &sbuf); + stat(TQFile::encodeName(*it), &sbuf); // If the group exist and we're not forced to read the .js file, let's build myModeList for katepartjscriptrc if (!force && config.hasGroup(Group) && (sbuf.st_mtime == config.readNumEntry("lastModified"))) @@ -677,11 +677,11 @@ void KateJScriptManager::collectScripts (bool force) { kdDebug (13050) << "add script: " << *it << endl; - QString desktopFile = (*it).left((*it).length()-2).append ("desktop"); + TQString desktopFile = (*it).left((*it).length()-2).append ("desktop"); kdDebug (13050) << "add script (desktop file): " << desktopFile << endl; - QFileInfo dfi (desktopFile); + TQFileInfo dfi (desktopFile); if (dfi.exists()) { @@ -689,10 +689,10 @@ void KateJScriptManager::collectScripts (bool force) df.setDesktopGroup (); // get cmdname, fallback to baseName, if it is empty, therefor not use the kconfig fallback - QString cmdname = df.readEntry ("X-Kate-Command"); + TQString cmdname = df.readEntry ("X-Kate-Command"); if (cmdname.isEmpty()) { - QFileInfo fi (*it); + TQFileInfo fi (*it); cmdname = fi.baseName(); } @@ -711,7 +711,7 @@ void KateJScriptManager::collectScripts (bool force) { kdDebug (13050) << "add script: fallback, no desktop file around!" << endl; - QFileInfo fi (*it); + TQFileInfo fi (*it); if (m_scripts[fi.baseName()]) continue; @@ -731,7 +731,7 @@ void KateJScriptManager::collectScripts (bool force) config.sync(); } -bool KateJScriptManager::exec( Kate::View *view, const QString &_cmd, QString &errorMsg ) +bool KateJScriptManager::exec( Kate::View *view, const TQString &_cmd, TQString &errorMsg ) { // cast it hardcore, we know that it is really a kateview :) KateView *v = (KateView*) view; @@ -743,8 +743,8 @@ bool KateJScriptManager::exec( Kate::View *view, const QString &_cmd, QString &e } //create a list of args - QStringList args( QStringList::split( QRegExp("\\s+"), _cmd ) ); - QString cmd ( args.first() ); + TQStringList args( TQStringList::split( TQRegExp("\\s+"), _cmd ) ); + TQString cmd ( args.first() ); args.remove( args.first() ); kdDebug(13050) << "try to exec: " << cmd << endl; @@ -755,7 +755,7 @@ bool KateJScriptManager::exec( Kate::View *view, const QString &_cmd, QString &e return false; } - QFile file (m_scripts[cmd]->filename); + TQFile file (m_scripts[cmd]->filename); if ( !file.open( IO_ReadOnly ) ) { @@ -763,17 +763,17 @@ bool KateJScriptManager::exec( Kate::View *view, const QString &_cmd, QString &e return false; } - QTextStream stream( &file ); - stream.setEncoding (QTextStream::UnicodeUTF8); + TQTextStream stream( &file ); + stream.setEncoding (TQTextStream::UnicodeUTF8); - QString source = stream.read (); + TQString source = stream.read (); file.close(); return KateFactory::self()->jscript()->execute(v, source, errorMsg); } -bool KateJScriptManager::help( Kate::View *, const QString &cmd, QString &msg ) +bool KateJScriptManager::help( Kate::View *, const TQString &cmd, TQString &msg ) { if (!m_scripts[cmd] || !m_scripts[cmd]->desktopFileExists) return false; @@ -789,11 +789,11 @@ bool KateJScriptManager::help( Kate::View *, const QString &cmd, QString &msg ) return true; } -QStringList KateJScriptManager::cmds() +TQStringList KateJScriptManager::cmds() { - QStringList l; + TQStringList l; - QDictIterator it( m_scripts ); + TQDictIterator it( m_scripts ); for( ; it.current(); ++it ) l << it.current()->name; @@ -844,9 +844,9 @@ KJS::Value KJS::KateJSIndenterProtoFunc::call(KJS::ExecState *exec, KJS::Object //END //BEGIN KateIndentJScriptImpl -KateIndentJScriptImpl::KateIndentJScriptImpl(const QString& internalName, - const QString &filePath, const QString &niceName, - const QString ©right, double version): +KateIndentJScriptImpl::KateIndentJScriptImpl(const TQString& internalName, + const TQString &filePath, const TQString &niceName, + const TQString ©right, double version): KateIndentScriptImplAbstract(internalName,filePath,niceName,copyright,version),m_interpreter(0),m_indenter(0) { } @@ -876,7 +876,7 @@ void KateIndentJScriptImpl::deleteInterpreter() m_interpreter=0; } -bool KateIndentJScriptImpl::setupInterpreter(QString &errorMsg) +bool KateIndentJScriptImpl::setupInterpreter(TQString &errorMsg) { if (!m_interpreter) { @@ -890,7 +890,7 @@ bool KateIndentJScriptImpl::setupInterpreter(QString &errorMsg) m_interpreter->globalObject().put(m_interpreter->globalExec(),"debug", KJS::Object(new KateJSGlobalFunctions(KateJSGlobalFunctions::Debug,1))); m_interpreter->globalObject().put(m_interpreter->globalExec(),"indenter",*m_indenter,KJS::DontDelete | KJS::ReadOnly); - QFile file (filePath()); + TQFile file (filePath()); if ( !file.open( IO_ReadOnly ) ) { @@ -899,10 +899,10 @@ bool KateIndentJScriptImpl::setupInterpreter(QString &errorMsg) return false; } - QTextStream stream( &file ); - stream.setEncoding (QTextStream::UnicodeUTF8); + TQTextStream stream( &file ); + stream.setEncoding (TQTextStream::UnicodeUTF8); - QString source = stream.read (); + TQString source = stream.read (); file.close(); @@ -935,7 +935,7 @@ bool KateIndentJScriptImpl::setupInterpreter(QString &errorMsg) } -inline static bool KateIndentJScriptCall(Kate::View *view, QString &errorMsg, KateJSDocument *docWrapper, KateJSView *viewWrapper, +inline static bool KateIndentJScriptCall(Kate::View *view, TQString &errorMsg, KateJSDocument *docWrapper, KateJSView *viewWrapper, KJS::Interpreter *interpreter, KJS::Object lookupobj,const KJS::Identifier& func,KJS::List params) { // no view, no fun @@ -972,24 +972,24 @@ inline static bool KateIndentJScriptCall(Kate::View *view, QString &errorMsg, Ka return true; } -bool KateIndentJScriptImpl::processChar(Kate::View *view, QChar c, QString &errorMsg ) +bool KateIndentJScriptImpl::processChar(Kate::View *view, TQChar c, TQString &errorMsg ) { kdDebug(13050)<<"KateIndentJScriptImpl::processChar"<findAllResources("data","katepart/scripts/indent/*.js",false,true); + TQStringList list = KGlobal::dirs()->findAllResources("data","katepart/scripts/indent/*.js",false,true); // Let's iterate through the list and build the Mode List - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + for ( TQStringList::Iterator it = list.begin(); it != list.end(); ++it ) { // Each file has a group ed: - QString Group="Cache "+ *it; + TQString Group="Cache "+ *it; // Let's go to this group config.setGroup(Group); @@ -1042,20 +1042,20 @@ void KateIndentJScriptManager::collectScripts (bool force) // stat the file struct stat sbuf; memset (&sbuf, 0, sizeof(sbuf)); - stat(QFile::encodeName(*it), &sbuf); + stat(TQFile::encodeName(*it), &sbuf); // If the group exist and we're not forced to read the .js file, let's build myModeList for katepartjscriptrc bool readnew=false; if (!force && config.hasGroup(Group) && (sbuf.st_mtime == config.readNumEntry("lastModified"))) { config.setGroup(Group); - QString filePath=*it; - QString internalName=config.readEntry("internlName","KATE-ERROR"); + TQString filePath=*it; + TQString internalName=config.readEntry("internlName","KATE-ERROR"); if (internalName=="KATE-ERROR") readnew=true; else { - QString niceName=config.readEntry("niceName",internalName); - QString copyright=config.readEntry("copyright",i18n("(Unknown)")); + TQString niceName=config.readEntry("niceName",internalName); + TQString copyright=config.readEntry("copyright",i18n("(Unknown)")); double version=config.readDoubleNumEntry("version",0.0); KateIndentJScriptImpl *s=new KateIndentJScriptImpl( internalName,filePath,niceName,copyright,version); @@ -1065,15 +1065,15 @@ void KateIndentJScriptManager::collectScripts (bool force) else readnew=true; if (readnew) { - QFileInfo fi (*it); + TQFileInfo fi (*it); if (m_scripts[fi.baseName()]) continue; - QString internalName=fi.baseName(); - QString filePath=*it; - QString niceName=internalName; - QString copyright=i18n("(Unknown)"); + TQString internalName=fi.baseName(); + TQString filePath=*it; + TQString niceName=internalName; + TQString copyright=i18n("(Unknown)"); double version=0.0; parseScriptHeader(filePath,&niceName,©right,&version); /*save the information for retrieval*/ @@ -1093,22 +1093,22 @@ void KateIndentJScriptManager::collectScripts (bool force) config.sync(); } -KateIndentScript KateIndentJScriptManager::script(const QString &scriptname) { +KateIndentScript KateIndentJScriptManager::script(const TQString &scriptname) { KateIndentJScriptImpl *s=m_scripts[scriptname]; kdDebug(13050)<