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/sysbackend.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/sysbackend.cpp')
-rw-r--r-- | src/knemod/backends/sysbackend.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/knemod/backends/sysbackend.cpp b/src/knemod/backends/sysbackend.cpp index e0162ad..3ad48ea 100644 --- a/src/knemod/backends/sysbackend.cpp +++ b/src/knemod/backends/sysbackend.cpp @@ -24,10 +24,10 @@ #include <sys/socket.h> #include <netinet/in.h> -#include <qmap.h> -#include <qdir.h> -#include <qregexp.h> -#include <qstringlist.h> +#include <tqmap.h> +#include <tqdir.h> +#include <tqregexp.h> +#include <tqstringlist.h> #include <kdebug.h> #include <kprocess.h> @@ -51,7 +51,7 @@ #define SYSPATH "/sys/class/net/" #define PROCROUTE "/proc/net/route" -SysBackend::SysBackend( QDict<Interface>& interfaces ) +SysBackend::SysBackend( TQDict<Interface>& interfaces ) : BackendBase( interfaces ) { } @@ -60,23 +60,23 @@ SysBackend::~SysBackend() { } -BackendBase* SysBackend::createInstance( QDict<Interface>& interfaces ) +BackendBase* SysBackend::createInstance( TQDict<Interface>& interfaces ) { return new SysBackend( interfaces ); } void SysBackend::update() { - QDir dir( SYSPATH ); - QStringList ifList = dir.entryList( QDir::Dirs ); + TQDir dir( SYSPATH ); + TQStringList ifList = dir.entryList( TQDir::Dirs ); - 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 ( ifList.find( key ) == ifList.end() ) + if ( ifList.tqfind( key ) == ifList.end() ) { // The interface does not exist. Meaning the driver // isn't loaded and/or the interface has not been created. @@ -85,7 +85,7 @@ void SysBackend::update() } else { - if ( QFile::exists( SYSPATH + key + "/wireless" ) ) + if ( TQFile::exists( SYSPATH + key + "/wireless" ) ) { interface->getData().wirelessDevice = true; } @@ -127,7 +127,7 @@ void SysBackend::update() updateComplete(); } -bool SysBackend::readNumberFromFile( const QString& fileName, unsigned int& value ) +bool SysBackend::readNumberFromFile( const TQString& fileName, unsigned int& value ) { FILE* file = fopen( fileName.latin1(), "r" ); if ( file != NULL ) @@ -143,7 +143,7 @@ bool SysBackend::readNumberFromFile( const QString& fileName, unsigned int& valu return false; } -bool SysBackend::readStringFromFile( const QString& fileName, QString& string ) +bool SysBackend::readStringFromFile( const TQString& fileName, TQString& string ) { char buffer[64]; FILE* file = fopen( fileName.latin1(), "r" ); @@ -161,9 +161,9 @@ bool SysBackend::readStringFromFile( const QString& fileName, QString& string ) return false; } -void SysBackend::updateInterfaceData( const QString& ifName, InterfaceData& data, int type ) +void SysBackend::updateInterfaceData( const TQString& ifName, InterfaceData& data, int type ) { - QString ifFolder = SYSPATH + ifName + "/"; + TQString ifFolder = SYSPATH + ifName + "/"; unsigned int rxPackets = 0; if ( readNumberFromFile( ifFolder + "statistics/rx_packets", rxPackets ) ) @@ -247,22 +247,22 @@ void SysBackend::updateInterfaceData( const QString& ifName, InterfaceData& data if ( type == Interface::ETHERNET ) { - QString hwAddress; + TQString hwAddress; if ( readStringFromFile( ifFolder + "address", hwAddress ) ) { data.hwAddress = hwAddress; } // for the default gateway we use the proc filesystem - QFile routeFile( PROCROUTE ); + TQFile routeFile( PROCROUTE ); if ( routeFile.open( IO_ReadOnly ) ) { - QString routeData( routeFile.readAll().data() ); - QStringList routeEntries = QStringList::split( "\n", routeData ); - QStringList::Iterator it; + TQString routeData( routeFile.readAll().data() ); + TQStringList routeEntries = TQStringList::split( "\n", routeData ); + TQStringList::Iterator it; for ( it = routeEntries.begin(); it != routeEntries.end(); ++it ) { - QRegExp regExp( ".*\\s+[\\w\\d]{8}\\s+([\\w\\d]{8})\\s+(\\d{4})" ); + TQRegExp regExp( ".*\\s+[\\w\\d]{8}\\s+([\\w\\d]{8})\\s+(\\d{4})" ); if ( ( regExp.search( *it ) > -1 ) && ( regExp.cap( 2 ).toUInt() & RTF_GATEWAY ) ) { @@ -307,14 +307,14 @@ void SysBackend::updateInterfaceData( const QString& ifName, InterfaceData& data } } -void SysBackend::updateWirelessData( const QString& ifName, WirelessData& data ) +void SysBackend::updateWirelessData( const TQString& ifName, WirelessData& data ) { - QString wirelessFolder = SYSPATH + ifName + "/wireless/"; + TQString wirelessFolder = SYSPATH + ifName + "/wireless/"; unsigned int link = 0; if ( readNumberFromFile( wirelessFolder + "link", link ) ) { - data.linkQuality = QString::number( link ); + data.linkQuality = TQString::number( link ); } #ifdef HAVE_LIBIW @@ -341,7 +341,7 @@ void SysBackend::updateWirelessData( const QString& ifName, WirelessData& data ) } iw_print_freq_value( buffer, sizeof( buffer ), freq ); data.frequency = buffer; - data.channel = QString::number( channel ); + data.channel = TQString::number( channel ); } } @@ -381,7 +381,7 @@ void SysBackend::updateWirelessData( const QString& ifName, WirelessData& data ) } else { - data.nickName = QString::null; + data.nickName = TQString(); } } @@ -402,7 +402,7 @@ void SysBackend::updateWirelessData( const QString& ifName, WirelessData& data ) } else { - data.mode = QString::null; + data.mode = TQString(); } } |