-rw-r--r-- | noncore/applets/wirelessapplet/networkinfo.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/noncore/applets/wirelessapplet/networkinfo.cpp b/noncore/applets/wirelessapplet/networkinfo.cpp index dc5c3be..22d7d83 100644 --- a/noncore/applets/wirelessapplet/networkinfo.cpp +++ b/noncore/applets/wirelessapplet/networkinfo.cpp | |||
@@ -174,8 +174,10 @@ void MWirelessNetworkInterface::updateStatistics() | |||
174 | QFile wfile( PROCNETWIRELESS ); | 174 | QFile wfile( PROCNETWIRELESS ); |
175 | wfile.open( IO_ReadOnly ); | 175 | bool hasFile = wfile.open( IO_ReadOnly ); |
176 | QTextStream wstream( &wfile ); | 176 | QTextStream wstream( &wfile ); |
177 | wstream.readLine(); // skip the first two lines | 177 | if ( hasFile ) |
178 | wstream.readLine(); // because they only contain headers | 178 | { |
179 | 179 | wstream.readLine(); // skip the first two lines | |
180 | if ( wstream.atEnd() ) | 180 | wstream.readLine(); // because they only contain headers |
181 | } | ||
182 | if ( ( !hasFile ) || ( wstream.atEnd() ) ) | ||
181 | { | 183 | { |
@@ -204,4 +206,4 @@ MNetwork::MNetwork() | |||
204 | { | 206 | { |
205 | qDebug( "MNetwork::MNetwork()" ); | 207 | //qDebug( "MNetwork::MNetwork()" ); |
206 | procfile = "/proc/net/dev"; | 208 | procfile = PROCNETDEV; |
207 | } | 209 | } |
@@ -210,3 +212,3 @@ MNetwork::~MNetwork() | |||
210 | { | 212 | { |
211 | qDebug( "MNetwork::~MNetwork()" ); | 213 | //qDebug( "MNetwork::~MNetwork()" ); |
212 | } | 214 | } |
@@ -219,4 +221,4 @@ MWirelessNetwork::MWirelessNetwork() | |||
219 | { | 221 | { |
220 | qDebug( "MWirelessNetwork::MWirelessNetwork()" ); | 222 | //qDebug( "MWirelessNetwork::MWirelessNetwork()" ); |
221 | procfile = "/proc/net/wireless"; | 223 | procfile = PROCNETWIRELESS; |
222 | } | 224 | } |
@@ -225,3 +227,3 @@ MWirelessNetwork::~MWirelessNetwork() | |||
225 | { | 227 | { |
226 | qDebug( "MWirelessNetwork::~MWirelessNetwork()" ); | 228 | //qDebug( "MWirelessNetwork::~MWirelessNetwork()" ); |
227 | } | 229 | } |
@@ -249,3 +251,5 @@ void MNetwork::enumerateInterfaces() | |||
249 | QFile f( procfile ); | 251 | QFile f( procfile ); |
250 | f.open( IO_ReadOnly ); | 252 | bool hasFile = f.open( IO_ReadOnly ); |
253 | if ( !hasFile ) | ||
254 | return; | ||
251 | QTextStream s( &f ); | 255 | QTextStream s( &f ); |