diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 18:16:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 18:16:06 +0000 |
commit | 02a6c8f36311eb6225066df35adf8d00f9cd942b (patch) | |
tree | ceb91c373877f7a69209e184c81b53dc6f9402d7 /src/knemod/backends/nettoolsbackend.cpp | |
parent | 09e6e27fe85b2efb28072f1c81f6581fa6837d92 (diff) | |
download | knemo-02a6c8f36311eb6225066df35adf8d00f9cd942b.tar.gz knemo-02a6c8f36311eb6225066df35adf8d00f9cd942b.zip |
TQt4 port knemo
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knemo@1238869 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/knemod/backends/nettoolsbackend.cpp')
-rw-r--r-- | src/knemod/backends/nettoolsbackend.cpp | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/src/knemod/backends/nettoolsbackend.cpp b/src/knemod/backends/nettoolsbackend.cpp index dca42e1..c89d47c 100644 --- a/src/knemod/backends/nettoolsbackend.cpp +++ b/src/knemod/backends/nettoolsbackend.cpp @@ -17,9 +17,9 @@ Boston, MA 02110-1301, USA. */ -#include <qmap.h> -#include <qregexp.h> -#include <qstringlist.h> +#include <tqmap.h> +#include <tqregexp.h> +#include <tqstringlist.h> #include <kdebug.h> #include <kprocess.h> @@ -29,8 +29,8 @@ #include "config.h" -NetToolsBackend::NetToolsBackend( QDict<Interface>& interfaces ) - : QObject(), +NetToolsBackend::NetToolsBackend( TQDict<Interface>& interfaces ) + : TQObject(), BackendBase( interfaces ), mRouteProcess(0L), mIfconfigProcess(0L), @@ -57,7 +57,7 @@ NetToolsBackend::~NetToolsBackend() } } -BackendBase* NetToolsBackend::createInstance( QDict<Interface>& interfaces ) +BackendBase* NetToolsBackend::createInstance( TQDict<Interface>& interfaces ) { return new NetToolsBackend( interfaces ); } @@ -66,15 +66,15 @@ void NetToolsBackend::update() { if ( !mIfconfigProcess ) { - mIfconfigStdout = QString::null; + mIfconfigStdout = TQString(); mIfconfigProcess = new KProcess(); mIfconfigProcess->setEnvironment( "LANG", "C" ); mIfconfigProcess->setEnvironment( "LC_ALL", "C" ); *mIfconfigProcess << PATH_IFCONFIG << "-a"; - connect( mIfconfigProcess, SIGNAL( receivedStdout( KProcess*, char*, int ) ), - this, SLOT( ifconfigProcessStdout( KProcess*, char*, int ) ) ); - connect( mIfconfigProcess, SIGNAL( processExited( KProcess* ) ), - this, SLOT( ifconfigProcessExited( KProcess* ) ) ); + connect( mIfconfigProcess, TQT_SIGNAL( receivedStdout( KProcess*, char*, int ) ), + this, TQT_SLOT( ifconfigProcessStdout( KProcess*, char*, int ) ) ); + connect( mIfconfigProcess, TQT_SIGNAL( processExited( KProcess* ) ), + this, TQT_SLOT( ifconfigProcessExited( KProcess* ) ) ); if ( !mIfconfigProcess->start( KProcess::NotifyOnExit, KProcess::Stdout ) ) { @@ -86,17 +86,17 @@ void NetToolsBackend::update() #ifdef PATH_IWCONFIG if ( !mIwconfigProcess ) { - mIwconfigStdout = QString::null; + mIwconfigStdout = TQString(); mIwconfigProcess = new KProcess(); mIwconfigProcess->setEnvironment( "LANG", "C" ); mIwconfigProcess->setEnvironment( "LC_ALL", "C" ); *mIwconfigProcess << PATH_IWCONFIG; - connect( mIwconfigProcess, SIGNAL( receivedStdout( KProcess*, char*, int ) ), - this, SLOT( iwconfigProcessStdout( KProcess*, char*, int ) ) ); - connect( mIwconfigProcess, SIGNAL( receivedStderr( KProcess*, char*, int ) ), - this, SLOT( iwconfigProcessStdout( KProcess*, char*, int ) ) ); - connect( mIwconfigProcess, SIGNAL( processExited( KProcess* ) ), - this, SLOT( iwconfigProcessExited( KProcess* ) ) ); + connect( mIwconfigProcess, TQT_SIGNAL( receivedStdout( KProcess*, char*, int ) ), + this, TQT_SLOT( iwconfigProcessStdout( KProcess*, char*, int ) ) ); + connect( mIwconfigProcess, TQT_SIGNAL( receivedStderr( KProcess*, char*, int ) ), + this, TQT_SLOT( iwconfigProcessStdout( KProcess*, char*, int ) ) ); + connect( mIwconfigProcess, TQT_SIGNAL( processExited( KProcess* ) ), + this, TQT_SLOT( iwconfigProcessExited( KProcess* ) ) ); if ( !mIwconfigProcess->start( KProcess::NotifyOnExit, KProcess::AllOutput ) ) { @@ -109,17 +109,17 @@ void NetToolsBackend::update() #ifdef PATH_ROUTE if ( !mRouteProcess ) { - mRouteStdout = QString::null; + mRouteStdout = TQString(); mRouteProcess = new KProcess(); mRouteProcess->setEnvironment( "LANG", "C" ); mRouteProcess->setEnvironment( "LC_ALL", "C" ); *mRouteProcess << PATH_ROUTE << "-n"; - connect( mRouteProcess, SIGNAL( receivedStdout( KProcess*, char*, int ) ), - this, SLOT( routeProcessStdout( KProcess*, char*, int ) ) ); - connect( mRouteProcess, SIGNAL( receivedStderr( KProcess*, char*, int ) ), - this, SLOT( routeProcessStdout( KProcess*, char*, int ) ) ); - connect( mRouteProcess, SIGNAL( processExited( KProcess* ) ), - this, SLOT( routeProcessExited( KProcess* ) ) ); + connect( mRouteProcess, TQT_SIGNAL( receivedStdout( KProcess*, char*, int ) ), + this, TQT_SLOT( routeProcessStdout( KProcess*, char*, int ) ) ); + connect( mRouteProcess, TQT_SIGNAL( receivedStderr( KProcess*, char*, int ) ), + this, TQT_SLOT( routeProcessStdout( KProcess*, char*, int ) ) ); + connect( mRouteProcess, TQT_SIGNAL( processExited( KProcess* ) ), + this, TQT_SLOT( routeProcessExited( KProcess* ) ) ); if ( !mRouteProcess->start( KProcess::NotifyOnExit, KProcess::AllOutput ) ) { @@ -142,7 +142,7 @@ void NetToolsBackend::routeProcessExited( KProcess* process ) void NetToolsBackend::routeProcessStdout( KProcess*, char* buffer, int buflen ) { - mRouteStdout += QString::fromLatin1( buffer, buflen ); + mRouteStdout += TQString::tqfromLatin1( buffer, buflen ); } void NetToolsBackend::ifconfigProcessExited( KProcess* process ) @@ -157,7 +157,7 @@ void NetToolsBackend::ifconfigProcessExited( KProcess* process ) void NetToolsBackend::ifconfigProcessStdout( KProcess*, char* buffer, int buflen ) { - mIfconfigStdout += QString::fromLatin1( buffer, buflen ); + mIfconfigStdout += TQString::tqfromLatin1( buffer, buflen ); } void NetToolsBackend::iwconfigProcessExited( KProcess* process ) @@ -172,7 +172,7 @@ void NetToolsBackend::iwconfigProcessExited( KProcess* process ) void NetToolsBackend::iwconfigProcessStdout( KProcess*, char* buffer, int buflen ) { - mIwconfigStdout += QString::fromLatin1( buffer, buflen ); + mIwconfigStdout += TQString::tqfromLatin1( buffer, buflen ); } void NetToolsBackend::parseIfconfigOutput() @@ -180,15 +180,15 @@ void NetToolsBackend::parseIfconfigOutput() /* mIfconfigStdout contains the complete output of 'ifconfig' which we * are going to parse here. */ - QMap<QString, QString> configs; - QStringList ifList = QStringList::split( "\n\n", mIfconfigStdout ); - QStringList::Iterator it; + TQMap<TQString, TQString> configs; + TQStringList ifList = TQStringList::split( "\n\n", mIfconfigStdout ); + TQStringList::Iterator it; for ( it = ifList.begin(); it != ifList.end(); ++it ) { - int index = ( *it ).find( ' ' ); + int index = ( *it ).tqfind( ' ' ); if ( index == -1 ) continue; - QString key = ( *it ).left( index ); + TQString key = ( *it ).left( index ); configs[key] = ( *it ).mid( index ); } @@ -197,13 +197,13 @@ void NetToolsBackend::parseIfconfigOutput() * we update its data, otherwise we mark it as * 'not existing'. */ - QDictIterator<Interface> ifIt( mInterfaces ); + TQDictIterator<Interface> ifIt( mInterfaces ); for ( ; ifIt.current(); ++ifIt ) { - QString key = ifIt.currentKey(); + TQString key = ifIt.currentKey(); Interface* interface = ifIt.current(); - if ( configs.find( key ) == configs.end() ) + if ( configs.tqfind( key ) == configs.end() ) { // The interface does not exist. Meaning the driver // isn't loaded and/or the interface has not been created. @@ -211,8 +211,8 @@ void NetToolsBackend::parseIfconfigOutput() interface->getData().available = false; } // JJ 2005-07-18: use RUNNING instead of UP to detect whether interface is connected - else if ( !configs[key].contains( "inet " ) || - !configs[key].contains( "RUNNING" ) ) + else if ( !configs[key].tqcontains( "inet " ) || + !configs[key].tqcontains( "RUNNING" ) ) { // The interface is up or has an IP assigned but not both interface->getData().existing = true; @@ -221,7 +221,7 @@ void NetToolsBackend::parseIfconfigOutput() else { // ...determine the type of the interface - if ( configs[key].contains( "Ethernet" ) ) + if ( configs[key].tqcontains( "Ethernet" ) ) interface->setType( Interface::ETHERNET ); else interface->setType( Interface::PPP ); @@ -235,9 +235,9 @@ void NetToolsBackend::parseIfconfigOutput() updateComplete(); } -void NetToolsBackend::updateInterfaceData( QString& config, InterfaceData& data, int type ) +void NetToolsBackend::updateInterfaceData( TQString& config, InterfaceData& data, int type ) { - QRegExp regExp( ".*RX.*:(\\d+).*:\\d+.*:\\d+.*:\\d+" ); + TQRegExp regExp( ".*RX.*:(\\d+).*:\\d+.*:\\d+.*:\\d+" ); if ( regExp.search( config ) > -1 ) data.rxPackets = regExp.cap( 1 ).toULong(); @@ -345,15 +345,15 @@ void NetToolsBackend::parseIwconfigOutput() /* mIwconfigStdout contains the complete output of 'iwconfig' which we * are going to parse here. */ - QMap<QString, QString> configs; - QStringList ifList = QStringList::split( "\n\n", mIwconfigStdout ); - QStringList::Iterator it; + TQMap<TQString, TQString> configs; + TQStringList ifList = TQStringList::split( "\n\n", mIwconfigStdout ); + TQStringList::Iterator it; for ( it = ifList.begin(); it != ifList.end(); ++it ) { - int index = ( *it ).find( ' ' ); + int index = ( *it ).tqfind( ' ' ); if ( index == -1 ) continue; - QString key = ( *it ).left( index ); + TQString key = ( *it ).left( index ); configs[key] = ( *it ).mid( index ); } @@ -361,18 +361,18 @@ void NetToolsBackend::parseIwconfigOutput() * If we find the interface in the output of 'iwconfig' * we update its data. */ - QDictIterator<Interface> ifIt( mInterfaces ); + TQDictIterator<Interface> ifIt( mInterfaces ); for ( ; ifIt.current(); ++ifIt ) { - QString key = ifIt.currentKey(); + TQString key = ifIt.currentKey(); Interface* interface = ifIt.current(); - if ( configs.find( key ) == configs.end() ) + if ( configs.tqfind( key ) == configs.end() ) { // The interface was not found. continue; } - else if ( configs[key].contains( "no wireless extensions" ) ) + else if ( configs[key].tqcontains( "no wireless extensions" ) ) { // The interface isn't a wireless device. interface->getData().wirelessDevice = false; @@ -386,9 +386,9 @@ void NetToolsBackend::parseIwconfigOutput() } } -void NetToolsBackend::updateWirelessData( QString& config, WirelessData& data ) +void NetToolsBackend::updateWirelessData( TQString& config, WirelessData& data ) { - QRegExp regExp( "ESSID:([^\"][\\S]*)" ); + TQRegExp regExp( "ESSID:([^\"][\\S]*)" ); if ( regExp.search( config ) > -1 ) data.essid = regExp.cap( 1 ); else @@ -397,7 +397,7 @@ void NetToolsBackend::updateWirelessData( QString& config, WirelessData& data ) if ( regExp.search( config ) > -1 ) data.essid = regExp.cap( 1 ); else - data.essid = QString::null; + data.essid = TQString(); } regExp.setPattern( "Mode:(\\w*)" ); @@ -460,12 +460,12 @@ void NetToolsBackend::parseRouteOutput() /* mRouteStdout contains the complete output of 'route' which we * are going to parse here. */ - QMap<QString, QStringList> configs; - QStringList routeList = QStringList::split( "\n", mRouteStdout ); - QStringList::Iterator it; + TQMap<TQString, TQStringList> configs; + TQStringList routeList = TQStringList::split( "\n", mRouteStdout ); + TQStringList::Iterator it; for ( it = routeList.begin(); it != routeList.end(); ++it ) { - QStringList routeParameter = QStringList::split( " ", *it ); + TQStringList routeParameter = TQStringList::split( " ", *it ); if ( routeParameter.count() < 8 ) // no routing entry continue; if ( routeParameter[0] != "0.0.0.0" ) // no default route @@ -477,22 +477,22 @@ void NetToolsBackend::parseRouteOutput() * If we find the interface in the output of 'route' we update * the data of the interface. */ - QDictIterator<Interface> ifIt( mInterfaces ); + TQDictIterator<Interface> ifIt( mInterfaces ); for ( ; ifIt.current(); ++ifIt ) { - QString key = ifIt.currentKey(); + TQString key = ifIt.currentKey(); Interface* interface = ifIt.current(); - if ( configs.find( key ) != configs.end() ) + if ( configs.tqfind( key ) != configs.end() ) { // Update the default gateway. - QStringList routeParameter = configs[key]; + TQStringList routeParameter = configs[key]; interface->getData().defaultGateway = routeParameter[1]; } else { // Reset the default gateway. - interface->getData().defaultGateway = QString::null; + interface->getData().defaultGateway = TQString(); } } } |