summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/applets/wirelessapplet/networkinfo.cpp24
1 files changed, 14 insertions, 10 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
@@ -172,12 +172,14 @@ void MWirelessNetworkInterface::updateStatistics()
172 QString status; 172 QString status;
173 QString name; 173 QString name;
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 if ( hasFile )
178 {
177 wstream.readLine(); // skip the first two lines 179 wstream.readLine(); // skip the first two lines
178 wstream.readLine(); // because they only contain headers 180 wstream.readLine(); // because they only contain headers
179 181 }
180 if ( wstream.atEnd() ) 182 if ( ( !hasFile ) || ( wstream.atEnd() ) )
181 { 183 {
182 qDebug( "WIFIAPPLET: D'oh! Someone removed the card..." ); 184 qDebug( "WIFIAPPLET: D'oh! Someone removed the card..." );
183 quality = -1; 185 quality = -1;
@@ -202,13 +204,13 @@ void MWirelessNetworkInterface::updateStatistics()
202 204
203MNetwork::MNetwork() 205MNetwork::MNetwork()
204{ 206{
205 qDebug( "MNetwork::MNetwork()" ); 207 //qDebug( "MNetwork::MNetwork()" );
206 procfile = "/proc/net/dev"; 208 procfile = PROCNETDEV;
207} 209}
208 210
209MNetwork::~MNetwork() 211MNetwork::~MNetwork()
210{ 212{
211 qDebug( "MNetwork::~MNetwork()" ); 213 //qDebug( "MNetwork::~MNetwork()" );
212} 214}
213 215
214//--------------------------------------------------------------------------- 216//---------------------------------------------------------------------------
@@ -217,13 +219,13 @@ MNetwork::~MNetwork()
217 219
218MWirelessNetwork::MWirelessNetwork() 220MWirelessNetwork::MWirelessNetwork()
219{ 221{
220 qDebug( "MWirelessNetwork::MWirelessNetwork()" ); 222 //qDebug( "MWirelessNetwork::MWirelessNetwork()" );
221 procfile = "/proc/net/wireless"; 223 procfile = PROCNETWIRELESS;
222} 224}
223 225
224MWirelessNetwork::~MWirelessNetwork() 226MWirelessNetwork::~MWirelessNetwork()
225{ 227{
226 qDebug( "MWirelessNetwork::~MWirelessNetwork()" ); 228 //qDebug( "MWirelessNetwork::~MWirelessNetwork()" );
227} 229}
228 230
229MNetworkInterface* MWirelessNetwork::createInterface( const char* n ) const 231MNetworkInterface* MWirelessNetwork::createInterface( const char* n ) const
@@ -247,7 +249,9 @@ void MNetwork::enumerateInterfaces()
247 interfaces.clear(); 249 interfaces.clear();
248 QString str; 250 QString str;
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 );
252 s.readLine(); 256 s.readLine();
253 s.readLine(); 257 s.readLine();