diff options
author | Timothy Pearson <[email protected]> | 2011-12-06 14:15:01 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-12-06 14:15:01 -0600 |
commit | 1b89319fd93b88313cab40f1e9de24c067b04efb (patch) | |
tree | 80132996de993c3dcab4040864d7729842875b2d /src/toolinfo.cpp | |
parent | d08a0ede1d2cb15bb14b0ff75eacf5c682b1fa0a (diff) | |
download | kvpnc-1b89319fd93b88313cab40f1e9de24c067b04efb.tar.gz kvpnc-1b89319fd93b88313cab40f1e9de24c067b04efb.zip |
Initial TQt conversion
Diffstat (limited to 'src/toolinfo.cpp')
-rw-r--r-- | src/toolinfo.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/src/toolinfo.cpp b/src/toolinfo.cpp index 754467a..f59eed3 100644 --- a/src/toolinfo.cpp +++ b/src/toolinfo.cpp @@ -19,17 +19,17 @@ ***************************************************************************/ #include "toolinfo.h" -#include <qfile.h> +#include <tqfile.h> #include <iostream> #include <cstdlib> #include <klocale.h> #include <kstandarddirs.h> #include <kmessagebox.h> -#include <qtimer.h> -#include <qstringlist.h> -#include <qfileinfo.h> +#include <tqtimer.h> +#include <tqstringlist.h> +#include <tqfileinfo.h> -ToolInfo::ToolInfo( const QString &Name) +ToolInfo::ToolInfo( const TQString &Name) { this->Name = Name; this->programsInPath = programsInPath; @@ -43,7 +43,7 @@ ToolInfo::ToolInfo( const QString &Name) Version=i18n("No info"); - env = new QStringList(); + env = new TQStringList(); *env << "LC_ALL=C" << "LANG=C" << "PATH=/bin:/usr/bin:/usr/sbin:/sbin"; collectRunning=false; @@ -62,7 +62,7 @@ bool ToolInfo::collectToolInfo() addSearchPath("/usr/bin"); addSearchPath("/bin"); - addSearchPath(QString (QString(getenv("HOME"))+"/bin")); + addSearchPath(TQString (TQString(getenv("HOME"))+"/bin")); } bool success = false; @@ -71,8 +71,8 @@ bool ToolInfo::collectToolInfo() if ( TryPath_first.isEmpty() ) TryPath_first=Name; - QStringList::Iterator it; - if (QFile (TryPath_first).exists() && QFileInfo(TryPath_first).isFile() ) + TQStringList::Iterator it; + if (TQFile (TryPath_first).exists() && TQFileInfo(TryPath_first).isFile() ) { // if (GlobalConfig->KvpncDebugLevel > 2) // std::cout << Name.ascii() << "found at: " << TryPath_first.ascii() << ", was first try" << std::endl; @@ -83,20 +83,20 @@ bool ToolInfo::collectToolInfo() { // if (GlobalConfig->KvpncDebugLevel > 2) // { -// std::cout << QString(i18n("Trying first %1 at %2 has been failed, trying other paths").arg(Name).arg(TryPath_first)).ascii() << std::endl; +// std::cout << TQString(i18n("Trying first %1 at %2 has been failed, trying other paths").tqarg(Name).tqarg(TryPath_first)).ascii() << std::endl; // std::cout << "searchpath list: " << SearchPathList.join(" ").ascii() << std::endl; // } // std::cout << "searchpath list: " << SearchPathList.join(" ").ascii() << std::endl; - for (QStringList::Iterator it = SearchPathList.begin();it != SearchPathList.end();it++) + for (TQStringList::Iterator it = SearchPathList.begin();it != SearchPathList.end();it++) { - QString TryPath=QString(*it)+"/"+Name; + TQString TryPath=TQString(*it)+"/"+Name; // if (GlobalConfig->KvpncDebugLevel > 2) -// std::cout << QString (i18n("Trying %1 at: %2").arg(Name).arg(TryPath)).ascii() << std::endl; +// std::cout << TQString (i18n("Trying %1 at: %2").tqarg(Name).tqarg(TryPath)).ascii() << std::endl; - if (!TryPath.isEmpty() && QFile (TryPath).exists() && QFileInfo(TryPath).isFile() ) + if (!TryPath.isEmpty() && TQFile (TryPath).exists() && TQFileInfo(TryPath).isFile() ) { // if (GlobalConfig->KvpncDebugLevel > 2) -// std::cout << QString(i18n("%1 found at: %2").arg(Name).arg(TryPath)).ascii() << std::endl; +// std::cout << TQString(i18n("%1 found at: %2").tqarg(Name).tqarg(TryPath)).ascii() << std::endl; found=true; PathToExec=TryPath; break; @@ -107,11 +107,11 @@ bool ToolInfo::collectToolInfo() if ( found) { - CollectToolInfoProcess = new QProcess(this); + CollectToolInfoProcess = new TQProcess(this); CollectToolInfoProcess->clearArguments(); - connect( CollectToolInfoProcess, SIGNAL( readyReadStdout() ), this, SLOT( readStdOutCollectToolInfo() ) ); - connect( CollectToolInfoProcess, SIGNAL( readyReadStderr() ), this, SLOT( readStdErrCollectToolInfo() ) ); - //connect( CollectToolInfoProcess, SIGNAL( processExited () ), this, SLOT(processFinished() ) ); + connect( CollectToolInfoProcess, TQT_SIGNAL( readyReadStdout() ), this, TQT_SLOT( readStdOutCollectToolInfo() ) ); + connect( CollectToolInfoProcess, TQT_SIGNAL( readyReadStderr() ), this, TQT_SLOT( readStdErrCollectToolInfo() ) ); + //connect( CollectToolInfoProcess, TQT_SIGNAL( processExited () ), this, TQT_SLOT(processFinished() ) ); bool run=true; //FIXME how it could be better? @@ -126,7 +126,7 @@ bool ToolInfo::collectToolInfo() // we need to do some stupid hack... // /usr/sbin/racoon -> /usr/sbin/setkey CollectToolInfoProcess->clearArguments(); - CollectToolInfoProcess->addArgument(QString(PathToExec.left(PathToExec.length()-6)+"setkey")); + CollectToolInfoProcess->addArgument(TQString(PathToExec.left(PathToExec.length()-6)+"setkey")); CollectToolInfoProcess->addArgument("-V"); } else if (Name == "setkey") @@ -197,7 +197,7 @@ bool ToolInfo::collectToolInfo() if ( !PathToExec.isEmpty() && !CollectToolInfoProcess->start(env) ) { - std::cerr << (i18n("Unable to start collectToolInfo process (%1)!").arg(Name)).ascii() << std::endl; + std::cerr << (i18n("Unable to start collectToolInfo process (%1)!").tqarg(Name)).ascii() << std::endl; //delete CollectToolInfoProcess; collectRunning=false; success=false; @@ -215,16 +215,16 @@ bool ToolInfo::collectToolInfo() } } - //KMessageBox::information(0,QString("Name: "+Name+", Path: "+PathToExec+", Version: "+Version),"aaa"); - // disconnect( CollectToolInfoProcess, SIGNAL( readyReadStdout() ), this, SLOT( readStdOutCollectToolInfo() ) ); - // disconnect( CollectToolInfoProcess, SIGNAL( readyReadStderr() ), this, SLOT( readStdErrCollectToolInfo() ) ); + //KMessageBox::information(0,TQString("Name: "+Name+", Path: "+PathToExec+", Version: "+Version),"aaa"); + // disconnect( CollectToolInfoProcess, TQT_SIGNAL( readyReadStdout() ), this, TQT_SLOT( readStdOutCollectToolInfo() ) ); + // disconnect( CollectToolInfoProcess, TQT_SIGNAL( readyReadStderr() ), this, TQT_SLOT( readStdErrCollectToolInfo() ) ); // delete CollectToolInfoProcess; success=true; } } - disconnect( CollectToolInfoProcess, SIGNAL( readyReadStdout() ), this, SLOT( readStdOutCollectToolInfo() ) ); - disconnect( CollectToolInfoProcess, SIGNAL( readyReadStderr() ), this, SLOT( readStdErrCollectToolInfo() ) ); + disconnect( CollectToolInfoProcess, TQT_SIGNAL( readyReadStdout() ), this, TQT_SLOT( readStdOutCollectToolInfo() ) ); + disconnect( CollectToolInfoProcess, TQT_SIGNAL( readyReadStderr() ), this, TQT_SLOT( readStdErrCollectToolInfo() ) ); delete CollectToolInfoProcess; CollectToolInfoProcess=0L; @@ -237,7 +237,7 @@ bool ToolInfo::collectToolInfo() else { // if (GlobalConfig->KvpncDebugLevel > 2) -// std::cout << QString(i18n("%1 not found.").arg(Name)).ascii() << std::endl; +// std::cout << TQString(i18n("%1 not found.").tqarg(Name)).ascii() << std::endl; } return success; } @@ -248,11 +248,11 @@ void ToolInfo::getOpenvpnCapabilities() if (Name=="openvpn" && !PathToExec.isEmpty()) { - CollectOpenvpnCapabilitiesProcess = new QProcess(this); + CollectOpenvpnCapabilitiesProcess = new TQProcess(this); CollectOpenvpnCapabilitiesProcess->clearArguments(); - connect( CollectOpenvpnCapabilitiesProcess, SIGNAL( readyReadStdout() ), this, SLOT( readStdOutCollectOpenvpnCapabilies() ) ); - connect( CollectOpenvpnCapabilitiesProcess, SIGNAL( readyReadStderr() ), this, SLOT( readStdErrCollectOpenvpnCapabilies() ) ); - connect( CollectOpenvpnCapabilitiesProcess, SIGNAL( processExited () ), this, SLOT(processFinished() ) ); + connect( CollectOpenvpnCapabilitiesProcess, TQT_SIGNAL( readyReadStdout() ), this, TQT_SLOT( readStdOutCollectOpenvpnCapabilies() ) ); + connect( CollectOpenvpnCapabilitiesProcess, TQT_SIGNAL( readyReadStderr() ), this, TQT_SLOT( readStdErrCollectOpenvpnCapabilies() ) ); + connect( CollectOpenvpnCapabilitiesProcess, TQT_SIGNAL( processExited () ), this, TQT_SLOT(processFinished() ) ); //FIXME how it could be better? CollectOpenvpnCapabilitiesProcess->addArgument(PathToExec); @@ -263,7 +263,7 @@ void ToolInfo::getOpenvpnCapabilities() if ( !PathToExec.isEmpty() && !CollectOpenvpnCapabilitiesProcess->start(env) ) { - std::cerr << i18n("Unable to start collectToolInfo process (%1)!").arg(Name).ascii() << std::endl; + std::cerr << i18n("Unable to start collectToolInfo process (%1)!").tqarg(Name).ascii() << std::endl; //delete CollectToolInfoProcess; collectOpenvpnCapabilitiesRunning=false; @@ -276,37 +276,37 @@ void ToolInfo::getOpenvpnCapabilities() // wait... } - //KMessageBox::information(0,QString("Name: "+Name+", Path: "+PathToExec+", Version: "+Version),"aaa"); - // disconnect( CollectOpenvpnCapabilitiesProcess, SIGNAL( readyReadStdout() ), this, SLOT( readStdOutCollectOpenvpnCapabilies() ) ); - // disconnect( CollectOpenvpnCapabilitiesProcess, SIGNAL( readyReadStderr() ), this, SLOT( readStdErrCollectOpenvpnCapabilies() ) ); + //KMessageBox::information(0,TQString("Name: "+Name+", Path: "+PathToExec+", Version: "+Version),"aaa"); + // disconnect( CollectOpenvpnCapabilitiesProcess, TQT_SIGNAL( readyReadStdout() ), this, TQT_SLOT( readStdOutCollectOpenvpnCapabilies() ) ); + // disconnect( CollectOpenvpnCapabilitiesProcess, TQT_SIGNAL( readyReadStderr() ), this, TQT_SLOT( readStdErrCollectOpenvpnCapabilies() ) ); // delete CollectOpenvpnCapabilitiesProcess; } - disconnect( CollectOpenvpnCapabilitiesProcess, SIGNAL( readyReadStdout() ), this, SLOT( readStdOutCollectOpenvpnCapabilies() ) ); - disconnect( CollectOpenvpnCapabilitiesProcess, SIGNAL( readyReadStderr() ), this, SLOT( readStdErrCollectOpenvpnCapabilies() ) ); + disconnect( CollectOpenvpnCapabilitiesProcess, TQT_SIGNAL( readyReadStdout() ), this, TQT_SLOT( readStdOutCollectOpenvpnCapabilies() ) ); + disconnect( CollectOpenvpnCapabilitiesProcess, TQT_SIGNAL( readyReadStderr() ), this, TQT_SLOT( readStdErrCollectOpenvpnCapabilies() ) ); //std::cout << "Name: " << Name << ", Path: " << PathToExec << ", Version: " << Version << std::endl; } } -void ToolInfo::addSearchPath(const QString& path ) +void ToolInfo::addSearchPath(const TQString& path ) { // std::cout << "Path added: " << path << std::endl; if (!path.isEmpty()) - SearchPathList.insert(SearchPathList.end(), QString(path)); + SearchPathList.insert(SearchPathList.end(), TQString(path)); else return; } -void ToolInfo::removeSearchPath(const QString& path ) +void ToolInfo::removeSearchPath(const TQString& path ) { // std::cout << "Path removed: " << path << std::endl; if (!path.isEmpty()) - SearchPathList.remove(QString(path)); + SearchPathList.remove(TQString(path)); else return; @@ -321,8 +321,8 @@ void ToolInfo::readStdOutCollectToolInfo () { while (CollectToolInfoProcess->canReadLineStdout()) { - QString msg = QString( CollectToolInfoProcess->readLineStdout() ); - // QString msg = QString( CollectToolInfoProcess->readStdout() ); + TQString msg = TQString( CollectToolInfoProcess->readLineStdout() ); + // TQString msg = TQString( CollectToolInfoProcess->readStdout() ); // std::cout << "Checking for: " << Name.ascii() << std::endl; // std::cout << "stdout collectToolInfo: " << msg.ascii() <<std::endl; @@ -369,7 +369,7 @@ void ToolInfo::readStdOutCollectToolInfo () // we need to do some stupid hack... // /usr/sbin/racoon -> /usr/sbin/setkey - CollectToolInfoProcess->addArgument(QString(PathToExec.left(PathToExec.length()-6)+"setkey")); + CollectToolInfoProcess->addArgument(TQString(PathToExec.left(PathToExec.length()-6)+"setkey")); if ( msg.find( "ipsec-tools", 0, FALSE ) > -1 ) { //std::cout << "stdout collectToolInfo: " << msg << std::endl; @@ -514,7 +514,7 @@ void ToolInfo::readStdOutCollectToolInfo () } else { -// KMessageBox::information(0,QString("Name: "+Name+", Path: "+PathToExec+", Version: "+Version+", err: "+msg),"aaa"); +// KMessageBox::information(0,TQString("Name: "+Name+", Path: "+PathToExec+", Version: "+Version+", err: "+msg),"aaa"); } } collectRunning=false; @@ -524,7 +524,7 @@ void ToolInfo::readStdErrCollectToolInfo() { while (CollectToolInfoProcess->canReadLineStderr()) { - QString msg = QString( CollectToolInfoProcess->readLineStderr() ); + TQString msg = TQString( CollectToolInfoProcess->readLineStderr() ); // if (GlobalConfig->KvpncDebugLevel > 2) // { // std::cout << "Checking for: " << Name.ascii() << std::endl; @@ -549,7 +549,7 @@ void ToolInfo::readStdErrCollectToolInfo() } else if (Name == "ifconfig") { - //KMessageBox::information(0,QString("Name: "+Name+", Path: "+PathToExec+", Version: "+Version),"aaa"); + //KMessageBox::information(0,TQString("Name: "+Name+", Path: "+PathToExec+", Version: "+Version),"aaa"); if ( msg.find( "ifconfig", 0, FALSE ) > -1 ) { //std::cout << "stdout collectToolInfo: " << msg << std::endl; @@ -603,7 +603,7 @@ void ToolInfo::readStdErrCollectToolInfo() } else { -// KMessageBox::information(0,QString("Name: "+Name+", Path: "+PathToExec+", Version: "+Version+", err: "+msg),"aaa"); +// KMessageBox::information(0,TQString("Name: "+Name+", Path: "+PathToExec+", Version: "+Version+", err: "+msg),"aaa"); } } } @@ -612,8 +612,8 @@ void ToolInfo::readStdOutCollectOpenvpnCapabilies() { while (CollectOpenvpnCapabilitiesProcess->canReadLineStdout()) { - QString msg = QString( CollectOpenvpnCapabilitiesProcess->readLineStdout() ); - // QString msg = QString( CollectOpenvpnCapabilitiesProcess->readStdout() ); + TQString msg = TQString( CollectOpenvpnCapabilitiesProcess->readLineStdout() ); + // TQString msg = TQString( CollectOpenvpnCapabilitiesProcess->readStdout() ); // std::cout << "stdout collectOpenvpnCapabilities: " << msg.ascii() <<std::endl; if ( msg.find( "PKCS#11 Options:", 0, FALSE ) > -1 ) Capabilities+=i18n("pkcs11 support")+";"; @@ -626,7 +626,7 @@ void ToolInfo::readStdErrCollectOpenvpnCapabilies() { while (CollectOpenvpnCapabilitiesProcess->canReadLineStderr()) { - QString msg = QString( CollectOpenvpnCapabilitiesProcess->readLineStderr() ); + TQString msg = TQString( CollectOpenvpnCapabilitiesProcess->readLineStderr() ); // std::cout << "stderr collectOpenvpnCapabilities: " << msg.ascii() <<std::endl; } |