-rw-r--r-- | noncore/applets/wirelessapplet/wireless.cpp | 74 |
1 files changed, 40 insertions, 34 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index 72ac380..cee789c 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp | |||
@@ -52,4 +52,4 @@ | |||
52 | 52 | ||
53 | #define MDEBUG | 53 | //#define MDEBUG |
54 | //#undef MDEBUG | 54 | #undef MDEBUG |
55 | 55 | ||
@@ -221,2 +221,3 @@ void WirelessApplet::checkInterface() | |||
221 | ONetwork* net = ONetwork::instance(); | 221 | ONetwork* net = ONetwork::instance(); |
222 | net->synchronize(); | ||
222 | ONetwork::InterfaceIterator it = net->iterator(); | 223 | ONetwork::InterfaceIterator it = net->iterator(); |
@@ -326,10 +327,22 @@ void WirelessApplet::timerEvent( QTimerEvent* ) | |||
326 | { | 327 | { |
328 | #ifdef MDEBUG | ||
327 | qDebug( "WirelessApplet::timerEvent" ); | 329 | qDebug( "WirelessApplet::timerEvent" ); |
328 | OWirelessNetworkInterface* iface = interface; | 330 | #endif |
329 | 331 | if ( interface ) | |
330 | if ( iface ) | ||
331 | { | 332 | { |
333 | if ( !ONetwork::instance()->isPresent( (const char*) interface->name() ) ) | ||
334 | { | ||
335 | #ifdef MDEBUG | ||
336 | qDebug( "WIFIAPPLET: Interface no longer present." ); | ||
337 | #endif | ||
338 | interface = 0L; | ||
339 | mustRepaint(); | ||
340 | return; | ||
341 | } | ||
342 | |||
332 | if ( mustRepaint() ) | 343 | if ( mustRepaint() ) |
333 | { | 344 | { |
345 | #ifdef MDEBUG | ||
334 | qDebug( "WIFIAPPLET: A value has changed -> repainting." ); | 346 | qDebug( "WIFIAPPLET: A value has changed -> repainting." ); |
347 | #endif | ||
335 | repaint(); | 348 | repaint(); |
@@ -358,4 +371,2 @@ bool WirelessApplet::mustRepaint() | |||
358 | { | 371 | { |
359 | OWirelessNetworkInterface* iface = interface; | ||
360 | |||
361 | // check if there are enough changes to justify a (flickering) repaint | 372 | // check if there are enough changes to justify a (flickering) repaint |
@@ -364,6 +375,6 @@ bool WirelessApplet::mustRepaint() | |||
364 | 375 | ||
365 | if ( iface != oldiface ) | 376 | if ( interface != oldiface ) |
366 | { | 377 | { |
367 | oldiface = iface; | 378 | oldiface = interface; |
368 | if ( iface ) | 379 | if ( interface ) |
369 | { | 380 | { |
@@ -393,3 +404,3 @@ bool WirelessApplet::mustRepaint() | |||
393 | int noiseH = 50; // iface->noisePercent() * ( height() - 3 ) / 100; | 404 | int noiseH = 50; // iface->noisePercent() * ( height() - 3 ) / 100; |
394 | int signalH = iface->signalStrength() * ( height() - 3 ) / 100; | 405 | int signalH = interface->signalStrength() * ( height() - 3 ) / 100; |
395 | int qualityH = 50; // iface->qualityPercent() * ( height() - 3 ) / 100; | 406 | int qualityH = 50; // iface->qualityPercent() * ( height() - 3 ) / 100; |
@@ -406,3 +417,3 @@ bool WirelessApplet::mustRepaint() | |||
406 | 417 | ||
407 | if ( rocESSID && ( oldESSID != iface->SSID() ) ) | 418 | if ( rocESSID && ( oldESSID != interface->SSID() ) ) |
408 | { | 419 | { |
@@ -413,3 +424,3 @@ bool WirelessApplet::mustRepaint() | |||
413 | } | 424 | } |
414 | else if ( rocFREQ && ( oldFREQ != iface->frequency() ) ) | 425 | else if ( rocFREQ && ( oldFREQ != interface->frequency() ) ) |
415 | { | 426 | { |
@@ -420,3 +431,3 @@ bool WirelessApplet::mustRepaint() | |||
420 | } | 431 | } |
421 | else if ( rocAP && ( oldAP != iface->associatedAP().toString() ) ) | 432 | else if ( rocAP && ( oldAP != interface->associatedAP().toString() ) ) |
422 | { | 433 | { |
@@ -427,3 +438,3 @@ bool WirelessApplet::mustRepaint() | |||
427 | } | 438 | } |
428 | else if ( rocMODE && ( oldMODE != iface->mode() ) ) | 439 | else if ( rocMODE && ( oldMODE != interface->mode() ) ) |
429 | { | 440 | { |
@@ -435,6 +446,6 @@ bool WirelessApplet::mustRepaint() | |||
435 | 446 | ||
436 | oldESSID = iface->SSID(); | 447 | oldESSID = interface->SSID(); |
437 | oldMODE = iface->mode(); | 448 | oldMODE = interface->mode(); |
438 | oldFREQ = iface->frequency(); | 449 | oldFREQ = interface->frequency(); |
439 | oldAP = iface->associatedAP().toString(); | 450 | oldAP = interface->associatedAP().toString(); |
440 | 451 | ||
@@ -445,4 +456,3 @@ void WirelessApplet::updatePopupWindow() | |||
445 | { | 456 | { |
446 | OWirelessNetworkInterface* iface = interface; | 457 | int qualityH = interface->signalStrength(); |
447 | int qualityH = iface->signalStrength(); | ||
448 | 458 | ||
@@ -452,9 +462,9 @@ void WirelessApplet::updatePopupWindow() | |||
452 | QString freqString; | 462 | QString freqString; |
453 | QString cell = ( iface->mode() == "Managed" ) ? "AP: " : "Cell: "; | 463 | QString cell = ( interface->mode() == "Managed" ) ? "AP: " : "Cell: "; |
454 | freqString.sprintf( "%.3f GHz", iface->frequency() ); | 464 | freqString.sprintf( "%.3f GHz", interface->frequency() ); |
455 | status->statusLabel->setText( "Station: " + iface->nickName() + "<br>" + | 465 | status->statusLabel->setText( "Station: " + interface->nickName() + "<br>" + |
456 | "ESSID: " + iface->SSID() + "<br>" + | 466 | "ESSID: " + interface->SSID() + "<br>" + |
457 | "MODE: " + iface->mode() + "<br>" + | 467 | "MODE: " + interface->mode() + "<br>" + |
458 | "FREQ: " + freqString + "<br>" + | 468 | "FREQ: " + freqString + "<br>" + |
459 | cell + " " + iface->associatedAP().toString() ); | 469 | cell + " " + interface->associatedAP().toString() ); |
460 | } | 470 | } |
@@ -463,6 +473,4 @@ const char** WirelessApplet::getQualityPixmap() | |||
463 | { | 473 | { |
464 | OWirelessNetworkInterface* iface = interface; | 474 | if ( !interface ) return ( const char** ) nowireless_xpm; |
465 | 475 | int qualityH = interface->signalStrength(); | |
466 | if ( !iface ) return ( const char** ) nowireless_xpm; | ||
467 | int qualityH = iface->signalStrength(); | ||
468 | if ( qualityH < 0 ) return ( const char** ) nowireless_xpm; | 476 | if ( qualityH < 0 ) return ( const char** ) nowireless_xpm; |
@@ -484,4 +492,2 @@ void WirelessApplet::paintEvent( QPaintEvent* ) | |||
484 | { | 492 | { |
485 | OWirelessNetworkInterface* iface = interface; | ||
486 | |||
487 | QPainter p( this ); | 493 | QPainter p( this ); |
@@ -498,3 +504,3 @@ void WirelessApplet::paintEvent( QPaintEvent* ) | |||
498 | int signalH = 50; // iface->signalPercent() * ( height() - 3 ) / 100; | 504 | int signalH = 50; // iface->signalPercent() * ( height() - 3 ) / 100; |
499 | int qualityH = iface->signalStrength(); // iface->qualityPercent() * ( height() - 3 ) / 100; | 505 | int qualityH = interface->signalStrength(); // iface->qualityPercent() * ( height() - 3 ) / 100; |
500 | 506 | ||