Diffstat (limited to 'noncore/applets/wirelessapplet/wireless.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/applets/wirelessapplet/wireless.cpp | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/noncore/applets/wirelessapplet/wireless.cpp b/noncore/applets/wirelessapplet/wireless.cpp index cbaf5d6..dc9742a 100644 --- a/noncore/applets/wirelessapplet/wireless.cpp +++ b/noncore/applets/wirelessapplet/wireless.cpp @@ -25,4 +25,5 @@ /* OPIE */ +#include <opie2/onetwork.h> #include <opie2/otaskbarapplet.h> #include <qpe/qpeapplication.h> @@ -208,10 +209,9 @@ void WirelessControl::writeConfigEntry( const char *entry, int val ) WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) : QWidget( parent, name ), visualStyle( STYLE_ANTENNA ), - timer( 0 ), interface( 0 ), + timer( 0 ), interface( 0 ), oldiface( 0 ), rocESSID( false ), rocFREQ( false ), rocAP( false ), rocMODE( false ) { setFixedHeight( 18 ); setFixedWidth( 14 ); - network = new MWirelessNetwork(); status = new WirelessControl( this, this, "wireless status" ); } @@ -219,9 +219,17 @@ WirelessApplet::WirelessApplet( QWidget *parent, const char *name ) void WirelessApplet::checkInterface() { - interface = network->getFirstInterface(); + interface = 0L; + ONetwork* net = ONetwork::instance(); + ONetwork::InterfaceIterator it = net->iterator(); + + while ( it.current() && !it.current()->isWireless() ) ++it; + + if ( it.current() && it.current()->isWireless() ) + interface = static_cast<OWirelessNetworkInterface*>( it.current() ); + if ( interface ) { #ifdef MDEBUG - qDebug( "WIFIAPPLET: using interface '%s'", ( const char* ) interface->getName() ); + qDebug( "WIFIAPPLET: using interface '%s'", ( const char* ) interface->name() ); #endif @@ -245,5 +253,5 @@ void WirelessApplet::renewDHCP() if ( !interface ) return ; - QString ifacename( interface->getName() ); + QString ifacename( interface->name() ); // At first we are trying dhcpcd @@ -318,5 +326,7 @@ WirelessApplet::~WirelessApplet() void WirelessApplet::timerEvent( QTimerEvent* ) { - MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface; + /* + + OWirelessNetworkInterface* iface = interface; if ( iface ) @@ -340,4 +350,6 @@ void WirelessApplet::timerEvent( QTimerEvent* ) } else checkInterface(); + + */ } @@ -352,5 +364,5 @@ void WirelessApplet::mousePressEvent( QMouseEvent * ) bool WirelessApplet::mustRepaint() { - MWirelessNetworkInterface * iface = ( MWirelessNetworkInterface* ) interface; + OWirelessNetworkInterface* iface = interface; // check if there are enough changes to justify a (flickering) repaint @@ -386,7 +398,7 @@ bool WirelessApplet::mustRepaint() } - int noiseH = iface->noisePercent() * ( height() - 3 ) / 100; - int signalH = iface->signalPercent() * ( height() - 3 ) / 100; - int qualityH = iface->qualityPercent() * ( height() - 3 ) / 100; + int noiseH = 50; // iface->noisePercent() * ( height() - 3 ) / 100; + int signalH = iface->signalStrength() * ( height() - 3 ) / 100; + int qualityH = 50; // iface->qualityPercent() * ( height() - 3 ) / 100; if ( ( noiseH != oldnoiseH ) @@ -400,5 +412,5 @@ bool WirelessApplet::mustRepaint() } - if ( rocESSID && ( oldESSID != iface->essid ) ) + if ( rocESSID && ( oldESSID != iface->SSID() ) ) { #ifdef MDEBUG @@ -407,5 +419,5 @@ bool WirelessApplet::mustRepaint() renewDHCP(); } - else if ( rocFREQ && ( oldFREQ != iface->freq ) ) + else if ( rocFREQ && ( oldFREQ != iface->frequency() ) ) { #ifdef MDEBUG @@ -414,5 +426,5 @@ bool WirelessApplet::mustRepaint() renewDHCP(); } - else if ( rocAP && ( oldAP != iface->APAddr ) ) + else if ( rocAP && ( oldAP != iface->associatedAP().toString() ) ) { #ifdef MDEBUG @@ -421,5 +433,5 @@ bool WirelessApplet::mustRepaint() renewDHCP(); } - else if ( rocMODE && ( oldMODE != iface->mode ) ) + else if ( rocMODE && ( oldMODE != iface->mode() ) ) { #ifdef MDEBUG @@ -429,8 +441,8 @@ bool WirelessApplet::mustRepaint() } - oldESSID = iface->essid; - oldMODE = iface->mode; - oldFREQ = iface->freq; - oldAP = iface->APAddr; + oldESSID = iface->SSID(); + oldMODE = iface->mode(); + oldFREQ = iface->frequency(); + oldAP = iface->associatedAP().toString(); return false; |