From 0a80cfd57d271dd44221467efb426675fa470356 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 28 Jun 2011 18:31:12 +0000 Subject: TQt4 port kvirc This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/modules/system/libkvisystem.cpp | 86 ++++++++++++++++++------------------- src/modules/system/plugin.cpp | 42 +++++++++--------- src/modules/system/plugin.h | 22 +++++----- 3 files changed, 75 insertions(+), 75 deletions(-) (limited to 'src/modules/system') diff --git a/src/modules/system/libkvisystem.cpp b/src/modules/system/libkvisystem.cpp index 54ada405..d81524af 100644 --- a/src/modules/system/libkvisystem.cpp +++ b/src/modules/system/libkvisystem.cpp @@ -35,7 +35,7 @@ #include "kvi_osinfo.h" #include "kvi_qcstring.h" -#include +#include #ifndef COMPILE_ON_WINDOWS #include @@ -197,20 +197,20 @@ static bool system_kvs_fnc_osnodename(KviKvsModuleFunctionCall *c) static bool system_kvs_fnc_getenv(KviKvsModuleFunctionCall *c) { - QString szVariable; + TQString szVariable; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("variable",KVS_PT_NONEMPTYSTRING,0,szVariable) KVSM_PARAMETERS_END(c) - KviQCString szVar = szVariable.local8Bit(); + KviTQCString szVar = szVariable.local8Bit(); #ifdef COMPILE_ON_WINDOWS - QString env = getenv(szVar.data()); - QString def = __tr2qs("No environment variable found, please don't use the %% in the request"); - c->returnValue()->setString(env.isEmpty() ? QString::fromLocal8Bit(env) : QString::fromLocal8Bit(def)); + TQString env = getenv(szVar.data()); + TQString def = __tr2qs("No environment variable found, please don't use the %% in the request"); + c->returnValue()->setString(env.isEmpty() ? TQString::fromLocal8Bit(env) : TQString::fromLocal8Bit(def)); #else char * b = kvi_getenv(szVar.data()); - c->returnValue()->setString(b ? QString::fromLocal8Bit(b) : QString::null); + c->returnValue()->setString(b ? TQString::fromLocal8Bit(b) : TQString()); #endif return true; } @@ -240,7 +240,7 @@ static bool system_kvs_fnc_getenv(KviKvsModuleFunctionCall *c) static bool system_kvs_fnc_clipboard(KviKvsModuleFunctionCall *c) { - c->returnValue()->setString(g_pApp->clipboard()->text(QClipboard::Clipboard)); + c->returnValue()->setString(g_pApp->tqclipboard()->text(TQClipboard::Clipboard)); return true; } @@ -270,12 +270,12 @@ static bool system_kvs_fnc_clipboard(KviKvsModuleFunctionCall *c) static bool system_kvs_cmd_setClipboard(KviKvsModuleCommandCall * c) { - QString szValue; + TQString szValue; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("data",KVS_PT_STRING,KVS_PF_OPTIONAL,szValue) KVSM_PARAMETERS_END(c) - g_pApp->clipboard()->setText(szValue,QClipboard::Clipboard); + g_pApp->tqclipboard()->setText(szValue,TQClipboard::Clipboard); return true; } @@ -303,11 +303,11 @@ static bool system_kvs_cmd_setClipboard(KviKvsModuleCommandCall * c) static bool system_kvs_cmd_setSelection(KviKvsModuleCommandCall * c) { - QString szValue; + TQString szValue; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("data",KVS_PT_STRING,KVS_PF_OPTIONAL,szValue) KVSM_PARAMETERS_END(c) - g_pApp->clipboard()->setText(szValue,QClipboard::Selection); + g_pApp->tqclipboard()->setText(szValue,TQClipboard::Selection); return true; } @@ -337,7 +337,7 @@ static bool system_kvs_cmd_setSelection(KviKvsModuleCommandCall * c) static bool system_kvs_fnc_selection(KviKvsModuleFunctionCall *c) { - c->returnValue()->setString(g_pApp->clipboard()->text(QClipboard::Selection)); + c->returnValue()->setString(g_pApp->tqclipboard()->text(TQClipboard::Selection)); return true; } @@ -364,7 +364,7 @@ static bool system_kvs_fnc_selection(KviKvsModuleFunctionCall *c) static bool system_kvs_fnc_checkModule(KviKvsModuleFunctionCall *c) { - QString szModuleName; + TQString szModuleName; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("module_name",KVS_PT_STRING,0,szModuleName) @@ -420,11 +420,11 @@ static bool system_kvs_fnc_hostname(KviKvsModuleFunctionCall *c) identifier of the object called, is the function to be executed on the remote object and ,,... is the list of parameters to be passed. The name must contain the - trailing parenthesis and parameter specification (see examples). + trailing tqparenthesis and parameter specification (see examples). The parameters MUST be in the form "type=value" where "type" is the C++ type of the parameter and value is the string rappresentation of the parameter data. Currently - KVIrc supports only QString,KviQCString,bool,int and uint data types.[br] + KVIrc supports only TQString,KviTQCString,bool,int and uint data types.[br] The returned value is the string rappresentation of the returned data if the return type is known, otherwise it is the name of the data type returned. [br] @@ -439,7 +439,7 @@ static bool system_kvs_fnc_hostname(KviKvsModuleFunctionCall *c) # we can also ignore the return value in several ways %dummy = $system.dcop("kicker","kicker","showKMenu()") $system.dcop("kdesktop","KScreensaverIface","save()") - $system.dcop("kicker","Panel","addBrowserButton(QString)","QString=/") + $system.dcop("kicker","Panel","addBrowserButton(TQString)","TQString=/") # runtime test if a call would work (i.e. , kicker is running at all, parameters are right etc...) if($system.dcop("?kicker","kicker","showKMenu()"))echo "Can't make dcop calls to kicker!" [/example] @@ -449,8 +449,8 @@ static bool system_kvs_fnc_dcop(KviKvsModuleFunctionCall *c) { bool bTestMode = false; - KviQCString szApp,szObj,szFun; - QStringList parms; + KviTQCString szApp,szObj,szFun; + TQStringList parms; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("application",KVS_PT_NONEMPTYCSTRING,0,szApp) @@ -470,10 +470,10 @@ static bool system_kvs_fnc_dcop(KviKvsModuleFunctionCall *c) #ifdef COMPILE_KDE_SUPPORT - QByteArray ba; - QDataStream ds(ba, IO_WriteOnly); + TQByteArray ba; + TQDataStream ds(ba, IO_WriteOnly); - for ( QStringList::Iterator it = parms.begin(); it != parms.end(); ++it ) + for ( TQStringList::Iterator it = parms.begin(); it != parms.end(); ++it ) { KviStr tmp = *it; @@ -496,19 +496,19 @@ static bool system_kvs_fnc_dcop(KviKvsModuleFunctionCall *c) return false; } ds << iii; - } else if(kvi_strEqualCI("QString",szType.ptr())) + } else if(kvi_strEqualCI(TQSTRING_OBJECT_NAME_STRING,szType.ptr())) { - QString ddd = tmp.ptr(); + TQString ddd = tmp.ptr(); ds << ddd; - } else if(kvi_strEqualCI("KviQCString",szType.ptr())) + } else if(kvi_strEqualCI("KviTQCString",szType.ptr())) { - KviQCString qcs = tmp.ptr(); + KviTQCString qcs = tmp.ptr(); ds << qcs; } else if(kvi_strEqualCI("bool",szType.ptr())) { bool bbb = kvi_strEqualCI(tmp.ptr(),"true"); ds << bbb; - } else if(kvi_strEqualCI("unsigned int",szType.ptr()) || kvi_strEqualCI("uint",szType.ptr()) || kvi_strEqualCI("Q_UINT32",szType.ptr())) + } else if(kvi_strEqualCI("unsigned int",szType.ptr()) || kvi_strEqualCI("uint",szType.ptr()) || kvi_strEqualCI("TQ_UINT32",szType.ptr())) { unsigned int uii = tmp.toUInt(&bOk); if(!bOk) @@ -523,8 +523,8 @@ static bool system_kvs_fnc_dcop(KviKvsModuleFunctionCall *c) } } - QByteArray rba; - KviQCString szRetType; + TQByteArray rba; + KviTQCString szRetType; bool bRet = g_pApp->dcopClient()->call(szApp,szObj,szFun,ba,szRetType,rba); @@ -537,23 +537,23 @@ static bool system_kvs_fnc_dcop(KviKvsModuleFunctionCall *c) if(bTestMode) c->returnValue()->setInteger(1); else { - QDataStream ret(rba, IO_ReadOnly); + TQDataStream ret(rba, IO_ReadOnly); if(szRetType == "bool") { bool bqw; ret >> bqw; c->returnValue()->setInteger(bqw ? 1 : 0); - } else if(szRetType == "QString") + } else if(szRetType == TQSTRING_OBJECT_NAME_STRING) { - QString szz; + TQString szz; ret >> szz; c->returnValue()->setString(szz); - } else if(szRetType == "QCString") + } else if(szRetType == "TQCString") { - KviQCString sss; + KviTQCString sss; ret >> sss; c->returnValue()->setString(sss.data()); - } else if((szRetType == "uint") || (szRetType == "unsigned int") || (szRetType == "Q_UINT32")) + } else if((szRetType == "uint") || (szRetType == "unsigned int") || (szRetType == "TQ_UINT32")) { unsigned int ui3; ret >> ui3; @@ -572,18 +572,18 @@ static bool system_kvs_fnc_dcop(KviKvsModuleFunctionCall *c) int idx = 0; for(QCStringList::Iterator iter = csl.begin();iter != csl.end();++iter) { - arry->set(idx,new KviKvsVariant(QString(*iter))); + arry->set(idx,new KviKvsVariant(TQString(*iter))); idx++; } c->returnValue()->setArray(arry); #endif - } else if(szRetType == "QStringList") + } else if(szRetType == TQSTRINGLIST_OBJECT_NAME_STRING) { - QStringList csl; + TQStringList csl; ret >> csl; KviKvsArray * arry = new KviKvsArray(); int idx = 0; - for(QStringList::Iterator iter = csl.begin();iter != csl.end();++iter) + for(TQStringList::Iterator iter = csl.begin();iter != csl.end();++iter) { arry->set(idx,new KviKvsVariant(*iter)); idx++; @@ -626,21 +626,21 @@ static bool system_kvs_fnc_dcop(KviKvsModuleFunctionCall *c) static bool system_kvs_cmd_setenv(KviKvsModuleCommandCall * c) { - QString szVariable,szValue; + TQString szVariable,szValue; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("variable",KVS_PT_NONEMPTYSTRING,0,szVariable) KVSM_PARAMETER("value",KVS_PT_STRING,KVS_PF_OPTIONAL,szValue) KVSM_PARAMETERS_END(c) - KviQCString szVar = szVariable.local8Bit(); - KviQCString szVal = szValue.local8Bit(); + KviTQCString szVar = szVariable.local8Bit(); + KviTQCString szVal = szValue.local8Bit(); if(szVal.isEmpty())kvi_unsetenv(szVar.data()); else { /*#ifdef COMPILE_ON_WINDOWS - QString Var,Val,VarAndVal; + TQString Var,Val,VarAndVal; Val = szVar.data(); Var = szVal.data(); VarAndVal = Var+"="+Val; diff --git a/src/modules/system/plugin.cpp b/src/modules/system/plugin.cpp index b14b18c0..5891c39c 100644 --- a/src/modules/system/plugin.cpp +++ b/src/modules/system/plugin.cpp @@ -32,8 +32,8 @@ #include "kvi_app.h" #include "kvi_fileutils.h" -#include -#include +#include +#include /* @doc: easyplugins @type: @@ -103,7 +103,7 @@ [/example] */ -KviPlugin::KviPlugin(kvi_library_t pLib, const QString& name) +KviPlugin::KviPlugin(kvi_library_t pLib, const TQString& name) { m_Plugin = pLib; m_szName = name; @@ -113,7 +113,7 @@ KviPlugin::~KviPlugin() { } -KviPlugin* KviPlugin::load(const QString& szFileName) +KviPlugin* KviPlugin::load(const TQString& szFileName) { kvi_library_t pLibrary = kvi_library_open(szFileName.local8Bit()); if (!pLibrary) @@ -183,7 +183,7 @@ bool KviPlugin::canunload() return true; } -int KviPlugin::call(const QString& pszFunctionName, int argc, char * argv[], char ** pBuffer) +int KviPlugin::call(const TQString& pszFunctionName, int argc, char * argv[], char ** pBuffer) { int r; plugin_function function_call; @@ -199,12 +199,12 @@ int KviPlugin::call(const QString& pszFunctionName, int argc, char * argv[], cha return r; } -QString KviPlugin::name() +TQString KviPlugin::name() { return m_szName; } -void KviPlugin::setName(const QString& Name) +void KviPlugin::setName(const TQString& Name) { m_szName = Name; } @@ -212,7 +212,7 @@ void KviPlugin::setName(const QString& Name) KviPluginManager::KviPluginManager() { - m_pPluginDict = new KviPointerHashTable(5,false); + m_pPluginDict = new KviPointerHashTable(5,false); m_pPluginDict->setAutoDelete(false); m_bCanUnload = true; @@ -226,8 +226,8 @@ KviPluginManager::~KviPluginManager() bool KviPluginManager::pluginCall(KviKvsModuleFunctionCall *c) { // /echo $system.call("traffic.dll",about) - QString szPluginPath; //contains full path and plugin name like "c:/plugin.dll" - QString szFunctionName; + TQString szPluginPath; //contains full path and plugin name like "c:/plugin.dll" + TQString szFunctionName; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("plugin_path",KVS_PT_NONEMPTYSTRING,0,szPluginPath) @@ -262,7 +262,7 @@ bool KviPluginManager::pluginCall(KviKvsModuleFunctionCall *c) if (iArgc > 0) { int i = 2; - QString tmp; + TQString tmp; int iSize = 0; //Calculate buffer size @@ -313,7 +313,7 @@ bool KviPluginManager::pluginCall(KviKvsModuleFunctionCall *c) } if (r > 0) { - c->returnValue()->setString(QString::fromLocal8Bit(returnBuffer)); + c->returnValue()->setString(TQString::fromLocal8Bit(returnBuffer)); } @@ -339,7 +339,7 @@ bool KviPluginManager::checkUnload() Always called when system module should be unloaded Checking here if all small "modules" can be unloaded */ - KviPointerHashTableIterator it(*m_pPluginDict); + KviPointerHashTableIterator it(*m_pPluginDict); m_bCanUnload = true; @@ -360,7 +360,7 @@ bool KviPluginManager::checkUnload() void KviPluginManager::unloadAll() { - KviPointerHashTableIterator it(*m_pPluginDict); + KviPointerHashTableIterator it(*m_pPluginDict); while(it.current()) { @@ -369,9 +369,9 @@ void KviPluginManager::unloadAll() } } -bool KviPluginManager::findPlugin(QString& szPath) +bool KviPluginManager::findPlugin(TQString& szPath) { - QString szFileName(KviFileUtils::extractFileName(szPath)); + TQString szFileName(KviFileUtils::extractFileName(szPath)); // szFileName.detach(); if(KviFileUtils::isAbsolutePath(szPath) && KviFileUtils::fileExists(szPath)) { @@ -395,16 +395,16 @@ bool KviPluginManager::findPlugin(QString& szPath) return true; } -bool KviPluginManager::isPluginLoaded(const QString& pSingleName) +bool KviPluginManager::isPluginLoaded(const TQString& pSingleName) { - KviPlugin * p = m_pPluginDict->find(pSingleName); + KviPlugin * p = m_pPluginDict->tqfind(pSingleName); if (!p) return false; else return true; } -bool KviPluginManager::loadPlugin(const QString& szPluginPath) +bool KviPluginManager::loadPlugin(const TQString& szPluginPath) { if(isPluginLoaded(szPluginPath)) { @@ -420,8 +420,8 @@ bool KviPluginManager::loadPlugin(const QString& szPluginPath) return false; } -KviPlugin * KviPluginManager::getPlugin(const QString& szPluginPath) +KviPlugin * KviPluginManager::getPlugin(const TQString& szPluginPath) { - KviPlugin * p = m_pPluginDict->find(szPluginPath); + KviPlugin * p = m_pPluginDict->tqfind(szPluginPath); return p; } \ No newline at end of file diff --git a/src/modules/system/plugin.h b/src/modules/system/plugin.h index 64b1723a..c5aa5014 100644 --- a/src/modules/system/plugin.h +++ b/src/modules/system/plugin.h @@ -37,22 +37,22 @@ class KviPlugin { protected: // You have to create plugin instance by calling KviPlugin::load() - KviPlugin(kvi_library_t pLib, const QString& name); + KviPlugin(kvi_library_t pLib, const TQString& name); public: ~KviPlugin(); private: // shared // internal kvi_library_t m_Plugin; - QString m_szName; + TQString m_szName; public: - static KviPlugin* load(const QString& szFileName); + static KviPlugin* load(const TQString& szFileName); bool pfree(char * pBuffer); bool unload(); bool canunload(); - int call(const QString& szFunctionName, int argc, char * argv[], char ** pBuffer); - QString name(); - void setName(const QString& szName); + int call(const TQString& szFunctionName, int argc, char * argv[], char ** pBuffer); + TQString name(); + void setName(const TQString& szName); protected: }; @@ -65,16 +65,16 @@ class KviPluginManager // shared bool m_bCanUnload; // internal - KviPointerHashTable * m_pPluginDict; + KviPointerHashTable * m_pPluginDict; public: bool pluginCall(KviKvsModuleFunctionCall *c); bool checkUnload(); void unloadAll(); protected: - bool findPlugin(QString& szName); - bool isPluginLoaded(const QString& szFileNameOrPathToLoad); - bool loadPlugin(const QString& szPluginPath); - KviPlugin * getPlugin(const QString& szPluginPath); + bool findPlugin(TQString& szName); + bool isPluginLoaded(const TQString& szFileNameOrPathToLoad); + bool loadPlugin(const TQString& szPluginPath); + KviPlugin * getPlugin(const TQString& szPluginPath); }; #endif //_PLUGIN_H_ \ No newline at end of file -- cgit v1.2.1