author | mickeyl <mickeyl> | 2004-08-24 11:53:43 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-08-24 11:53:43 (UTC) |
commit | b06390cb17114692a9fd5233d77620b385252480 (patch) (side-by-side diff) | |
tree | 91de2ed5b0eb6ed739eb6bd0126e2ad004d6a9bd | |
parent | 94611edc1942717faa15861adef25418e40ea626 (diff) | |
download | opie-b06390cb17114692a9fd5233d77620b385252480.zip opie-b06390cb17114692a9fd5233d77620b385252480.tar.gz opie-b06390cb17114692a9fd5233d77620b385252480.tar.bz2 |
apply megapatch courtesy Holger 'Zecke' Freyther:
- bump version to 1.0.3-cvs
- fix compile warnings
- fix PacketViewer not to scroll, when watching in "real time"
- fix appending text to log view
- update statistics when tab is getting activated
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 16 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/graphwindow.cpp | 34 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/graphwindow.h | 26 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/logwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 9 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/packetview.cpp | 16 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/protolistview.cpp | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/resource.cpp | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 61 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 68 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 5 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiterbase.cpp | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/opie-wellenreiter.control | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/wellenreiter.pro | 1 |
14 files changed, 150 insertions, 114 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index ae149e2..1670f93 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp @@ -15,8 +15,9 @@ /* LOCAL */ #include "configwindow.h" #include "mainwindow.h" +#include "protolistview.h" /* OPIE */ #include <opie2/onetwork.h> #ifdef QWS @@ -183,9 +184,12 @@ bool WellenreiterConfigWindow::isChannelChecked( int channel ) const case 11: return channel11->isOn(); case 12: return channel12->isOn(); case 13: return channel13->isOn(); case 14: return channel14->isOn(); + default: return false; } + + } void WellenreiterConfigWindow::changedDeviceType(int t) @@ -216,21 +220,21 @@ void WellenreiterConfigWindow::synchronizeActionsAndScripts() //newStationScript->setEnabled( newStationAction->currentItem() == 4 ); } -void WellenreiterConfigWindow::changedNetworkAction(int t) +void WellenreiterConfigWindow::changedNetworkAction(int ) { synchronizeActionsAndScripts(); } -void WellenreiterConfigWindow::changedClientAction(int t) +void WellenreiterConfigWindow::changedClientAction(int ) { synchronizeActionsAndScripts(); } -void WellenreiterConfigWindow::changedStationAction(int t) +void WellenreiterConfigWindow::changedStationAction(int ) { synchronizeActionsAndScripts(); } @@ -279,9 +283,8 @@ const QString WellenreiterConfigWindow::gpsHost() const int WellenreiterConfigWindow::gpsPort() const { - bool ok; return useGPS() ? gpsdPort->value() : -1; } @@ -289,9 +292,9 @@ void WellenreiterConfigWindow::performAction( const QString& type, const QString& essid, const QString& mac, bool wep, int channel, - int signal + int /* signal */ /* , const GpsLocation& loc */ ) { int action; QString script; @@ -316,9 +319,9 @@ void WellenreiterConfigWindow::performAction( const QString& type, owarn << "WellenreiterConfigWindow::performAction(): unknown type '" << type << "'" << oendl; return; } - odebug << "for event '" << (const char*) type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl; + odebug << "for event '" << type << "' I'm going to perform action " << action << " (script='" << script << "')" << oendl; switch( action ) { case 0: /* Ignore */ return; @@ -403,8 +406,9 @@ void WellenreiterConfigWindow::load() c->setGroup( "Capture" ); writeCaptureFile->setChecked( c->readBoolEntry( "writeCaptureFile", true ) ); captureFileName->setEnabled( writeCaptureFile->isChecked() ); getCaptureFileName->setEnabled( writeCaptureFile->isChecked() ); + parsePackets->setEnabled( writeCaptureFile->isChecked() ); captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) ); hexViewBufferUnlimited->setChecked( c->readBoolEntry( "hexViewBufferUnlimited", true ) ); hexViewBufferLimited->setChecked( !c->readBoolEntry( "hexViewBufferUnlimited", true ) ); hexViewBufferSize->setValue( c->readNumEntry( "hexViewBufferSize", 2000 ) ); diff --git a/noncore/net/wellenreiter/gui/graphwindow.cpp b/noncore/net/wellenreiter/gui/graphwindow.cpp index b4174d3..d53421c 100644 --- a/noncore/net/wellenreiter/gui/graphwindow.cpp +++ b/noncore/net/wellenreiter/gui/graphwindow.cpp @@ -18,8 +18,35 @@ #include <qpainter.h> #include <qpixmap.h> #include <qtimer.h> +/* XPM */ +static char * background[] = { +"16 16 6 1", +" c None", +". c #52676E", +"+ c #3F545B", +"@ c #394E56", +"# c #2F454C", +"$ c #364B52", +".+++++++++++++++", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############", +"+$$$$$$$$$$$$$$$", +"@###############"}; + + MFrequencySpectrum::MFrequencySpectrum( int channels, QWidget* parent, const char* name, WFlags f) :QWidget( parent, name,f ), _channels( channels ) { _values = new int[_channels]; @@ -84,9 +111,9 @@ void MFrequencySpectrum::drawBar( QPainter* p, int x, int y, int width, int heig } } -void MFrequencySpectrum::paintEvent( QPaintEvent* e ) +void MFrequencySpectrum::paintEvent( QPaintEvent* ) { QPixmap pm( size() ); QPainter p; p.begin( &pm ); @@ -117,9 +144,8 @@ void MFrequencySpectrum::mousePressEvent( QMouseEvent* e ) { int xmargin = 5; int ymargin = 2; int y = size().height() - 2 * ymargin; - int x = 0; int width = ( size().width() - 2 * xmargin ) / _channels; QPoint pos = e->pos(); int channel = ( pos.x()-xmargin ) / width; @@ -141,10 +167,8 @@ Legende::Legende( int channels, QWidget* parent, const char* name, WFlags f ) void Legende::drawContents( QPainter* p ) { int xmargin = 5; - int ymargin = 2; - int x = 0; int width = ( contentsRect().width() - 2 * xmargin ) / _channels; for ( int i = 0; i < _channels; ++i ) p->drawText( xmargin + (width*i), 12, QString().sprintf( "%02d", i+1 ) ); @@ -169,9 +193,9 @@ void MGraphWindow::testGraph() } -void MGraphWindow::timerEvent( QTimerEvent* e ) +void MGraphWindow::timerEvent( QTimerEvent* ) { for ( int i = 0; i < 14; i++ ) { spectrum->decrease( i, 1 ); diff --git a/noncore/net/wellenreiter/gui/graphwindow.h b/noncore/net/wellenreiter/gui/graphwindow.h index fafcab1..392d85b 100644 --- a/noncore/net/wellenreiter/gui/graphwindow.h +++ b/noncore/net/wellenreiter/gui/graphwindow.h @@ -89,33 +89,7 @@ class MGraphWindow : public QVBox Legende* legende; }; -/* XPM */ -static char * background[] = { -"16 16 6 1", -" c None", -". c #52676E", -"+ c #3F545B", -"@ c #394E56", -"# c #2F454C", -"$ c #364B52", -".+++++++++++++++", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############", -"+$$$$$$$$$$$$$$$", -"@###############"}; - #endif diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp index 714a9a9..a83f700 100644 --- a/noncore/net/wellenreiter/gui/logwindow.cpp +++ b/noncore/net/wellenreiter/gui/logwindow.cpp @@ -29,22 +29,20 @@ MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) :QVBox( parent, name, f ) { ledit = new QMultiLineEdit( this ); ledit->setReadOnly( true ); + ledit->setUndoEnabled( false ); + MLogWindow::_instance = this; } void MLogWindow::log( QString text ) { QTime time = QTime::currentTime(); - QString line; - line.sprintf( "[%s] %s\n", (const char*) time.toString(), (const char*) text ); - int col; - int row; - ledit->getCursorPosition( &col, &row ); - ledit->insertAt( line, col, row ); + QString line = QString( "[%1] %2\n" ).arg(time.toString() ).arg( text ); + ledit->insertLine( line ); odebug << line << oendl; } diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index ef7ffcf..3e18531 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -30,11 +30,8 @@ #include "resource.h" #include <qapplication.h> #include <qfiledialog.h> #endif -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Ui; /* QT */ #include <qcombobox.h> #include <qdatastream.h> @@ -56,8 +53,12 @@ using namespace Opie::Ui; /* STD */ #include <unistd.h> +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; + WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) :QMainWindow( parent, name, f ) { cw = new WellenreiterConfigWindow( this ); @@ -467,9 +468,9 @@ void WellenreiterMainWindow::uploadSession() QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Can't open Logfile '%1'</p>").arg( mw->captureFileName() ) ); return; } - int content_length = f.size(); +// int content_length = f.size(); ::memset( &raddr, 0, sizeof (struct sockaddr_in) ); ::memcpy( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); raddr.sin_family = rhost_info-> h_addrtype; diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp index 69438fa..d71111f 100644 --- a/noncore/net/wellenreiter/gui/packetview.cpp +++ b/noncore/net/wellenreiter/gui/packetview.cpp @@ -70,25 +70,36 @@ PacketView::PacketView( QWidget * parent, const char * name, WFlags f ) } void PacketView::add( const OPacket* p, int size ) { + /* + * don't scroll away when somebody views packages + * while scanning + */ + int value = _number->value(); + bool last = (value == static_cast<int>( _packets.count() ) ); + odebug << "PacketView::add() size = " << size << oendl; if ( size == -1 ) // unlimited buffer { _packets.append( p ); } else { // limited buffer, limit = size - while ( _packets.count() >= size ) + while ( _packets.count() >= static_cast<uint>( size ) ) { _packets.removeFirst(); + --value; } + + /* check if we lost our packet */ + last = ( value < 1 ); _packets.append( p ); } _number->setMinValue( 1 ); _number->setMaxValue( _packets.count() ); - _number->setValue( _packets.count() ); + _number->setValue( last ? _packets.count() : value ); } void PacketView::showPacket( int number ) { @@ -138,8 +149,9 @@ void PacketView::_doHexPacket( const OPacket* p ) } const QString PacketView::getLog() const { + return QString::null; } void PacketView::clear() { diff --git a/noncore/net/wellenreiter/gui/protolistview.cpp b/noncore/net/wellenreiter/gui/protolistview.cpp index 635e174..1e3d195 100644 --- a/noncore/net/wellenreiter/gui/protolistview.cpp +++ b/noncore/net/wellenreiter/gui/protolistview.cpp @@ -71,13 +71,13 @@ ProtocolListView::~ProtocolListView() void ProtocolListView::addProtocol( const QString& name ) { QHBox* hbox = new QHBox( vbox ); - new QCheckBox( name, hbox, (const char*) name ); + new QCheckBox( name, hbox, name.local8Bit() ); if ( parse ) { - QComboBox* combo = new QComboBox( hbox, (const char*) name ); + QComboBox* combo = new QComboBox( hbox, name.local8Bit() ); #ifdef QWS combo->setFixedWidth( 75 ); #endif combo->insertItem( "Pass" ); @@ -91,9 +91,9 @@ void ProtocolListView::addProtocol( const QString& name ) combo->insertItem( "MessageBox" ); } else { - QComboBox* combo = new QComboBox( hbox, (const char*) name ); + QComboBox* combo = new QComboBox( hbox, name.local8Bit() ); #ifdef QWS combo->setFixedWidth( 75 ); #endif combo->insertItem( "Pass" ); @@ -103,16 +103,16 @@ void ProtocolListView::addProtocol( const QString& name ) bool ProtocolListView::isProtocolChecked( const QString& name ) { - QCheckBox* box = (QCheckBox*) child( (const char*) name ); + QCheckBox* box = (QCheckBox*) child( name.local8Bit() ); return ( box && box->isOn() ); } QString ProtocolListView::protocolAction( const QString& name ) { - QComboBox* combo = (QComboBox*) child( (const char*) name, "QComboBox" ); + QComboBox* combo = (QComboBox*) child( name.local8Bit(), "QComboBox" ); if ( combo ) return combo->currentText(); else return "<unknown>"; diff --git a/noncore/net/wellenreiter/gui/resource.cpp b/noncore/net/wellenreiter/gui/resource.cpp index cb17f51..13096f2 100644 --- a/noncore/net/wellenreiter/gui/resource.cpp +++ b/noncore/net/wellenreiter/gui/resource.cpp @@ -24,9 +24,9 @@ namespace Resource QPixmap loadPixmap( const QString& pix ) { QString filename; - filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); + filename.sprintf( "%s/%s.png", PIXMAPPATH, pix.local8Bit() ); QPixmap pixmap( filename ); if ( pixmap.isNull() ) { odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; @@ -36,9 +36,9 @@ QPixmap loadPixmap( const QString& pix ) QIconSet loadIconSet( const QString& pix ) { QString filename; - filename.sprintf( "%s/%s.png", (const char*) PIXMAPPATH, (const char*) pix ); + filename.sprintf( "%s/%s.png", PIXMAPPATH, pix.local8Bit() ); QPixmap pixmap( filename ); if ( pixmap.isNull() ) { odebug << "Wellenreiter::Resource: can't find pixmap " + filename << oendl; diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 9e907d8..fa1d724 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -24,11 +24,9 @@ #include <qpe/resource.h> #else #include "resource.h" #endif -using namespace Opie::Core; -using namespace Opie::Ui; -using namespace Opie::Net; + /* QT */ #include <qcursor.h> #include <qdatetime.h> @@ -37,8 +35,12 @@ using namespace Opie::Net; /* STD */ #include <assert.h> +using namespace Opie::Core; +using namespace Opie::Ui; +using namespace Opie::Net; + const int col_type = 0; const int col_essid = 0; const int col_sig = 1; const int col_ap = 2; @@ -50,8 +52,10 @@ const int col_manuf = 7; const int col_firstseen = 8; const int col_lastseen = 9; const int col_location = 10; +#define DEBUG + MScanListView::MScanListView( QWidget* parent, const char* name ) :OListView( parent, name ) { setFrameShape( QListView::StyledPanel ); @@ -175,9 +179,9 @@ void MScanListView::addNewItem( const QString& type, } } else { - s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); + s = QString( "(i) New network: ESSID '%1'" ).arg( essid ); MLogWindow::logwindow()->log( s ); network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); } @@ -194,13 +198,13 @@ void MScanListView::addNewItem( const QString& type, station->setLocation( loc.dmsPosition() ); if ( type == "managed" ) { - s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); + s = QString( "(i) New Access Point in '%1' [%2]" ).arg( essid ).arg( channel ); } else { - s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); + s = QString( "(i) New AdHoc station in '%1' [%2]" ).arg( essid ).arg( channel ); } MLogWindow::logwindow()->log( s ); } @@ -233,23 +237,23 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& QString s; if ( type == "station" ) { - s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); + s = QString( "(i) New Station in '%1' [xx]" ).arg( network->text( col_essid ) ); } else { - s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); + s = QString( "(i) New Wireless Station in '%1' [xx]" ).arg( network->text( col_essid ) ); } MLogWindow::logwindow()->log( s ); } void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) { - odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl; + odebug << "WDSTraffic: " << viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl; QString s; - MScanListItem* network; +// MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != viaFrom.toString(true) && @@ -269,12 +273,12 @@ void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, } } -void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) +void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& /*to*/, const OMacAddress& via ) { QString s; - MScanListItem* network; +// MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; @@ -292,12 +296,12 @@ void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, } } -void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) +void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& /*to*/, const OMacAddress& via ) { QString s; - MScanListItem* network; +// MScanListItem* network; QListViewItemIterator it( this ); while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; @@ -314,18 +318,18 @@ void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& t } } -void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) +void MScanListView::IBSStraffic( const OMacAddress& /*from*/, const OMacAddress& /*to*/, const OMacAddress& /*via*/ ) { owarn << "D'oh! Not yet implemented..." << oendl; MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); } void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) { - odebug << "identify " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; + odebug << "identify " << macaddr.toString() << " = " << ip << "" << oendl; QListViewItemIterator it( this ); for ( ; it.current(); ++it ) { @@ -335,16 +339,16 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) return; } } odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; - MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", - (const char*) macaddr.toString(), (const char*) ip ) ); + MLogWindow::logwindow()->log( QString( "WARNING: Unhandled identification %1 = %2!" ) + .arg( macaddr.toString() ).arg( ip ) ); } void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) { - odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; + odebug << "addService '" << name << "', Server = " << macaddr.toString() << " = " << ip << "" << oendl; //TODO: Refactor that out, we need it all over the place. // Best to do it in a more comfortable abstraction in OListView // (Hmm, didn't I already start something in this direction?) @@ -383,10 +387,10 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr, return; } } odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; - MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", - (const char*) macaddr.toString(), (const char*) ip ) ); + MLogWindow::logwindow()->log( QString("WARNING: Unhandled service addition %s = %s!") + .arg( macaddr.toString() ).arg( ip ) ); } void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) @@ -394,14 +398,14 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in if ( !item ) return; MScanListItem* itm = static_cast<MScanListItem*>( item ); - odebug << "contextMenuRequested on item '" << (const char*) itm->text(0) << "' (" - << (const char*) itm->type << ") in column: '" << col << "'" << oendl; + odebug << "contextMenuRequested on item '" << itm->text(0) << "' (" + << itm->type << ") in column: '" << col << "'" << oendl; if ( itm->type == "adhoc" || itm->type == "managed" ) { - QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); + QString entry = QString( "&Join %1 Net '%2'..." ).arg( itm->type ).arg( itm->essid() ); QPopupMenu m( this ); m.insertItem( entry, 37773, 0 ); int result = m.exec( QCursor::pos() ); @@ -478,10 +482,9 @@ void MScanListItem::serializeFrom( QDataStream& s ) s >> _type; s >> wep; _wep = (wep == 'y'); - QString name; - name.sprintf( "wellenreiter/%s", (const char*) _type ); + QString name = QString( "wellenreiter/"+ _type ); setPixmap( col_type, Resource::loadPixmap( name ) ); if ( _wep ) setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! listView()->triggerUpdate(); @@ -489,16 +492,16 @@ void MScanListItem::serializeFrom( QDataStream& s ) void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) { #ifdef DEBUG - odebug << "decorating scanlist item " << (const char*) type << " / " - << (const char*) essid << " / " << (const char*) macaddr + odebug << "decorating scanlist item " << type << " / " + << essid << " / " << macaddr << "[" << channel << "]" << oendl; #endif // set icon for managed or adhoc mode QString name; - name.sprintf( "wellenreiter/%s", (const char*) type ); + name.sprintf( "wellenreiter/"+ type ); setPixmap( col_type, Resource::loadPixmap( name ) ); // special case for probed networks FIXME: This is ugly at present if ( type == "network" && probed ) diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index e801ce7..df8e9c3 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -32,11 +32,8 @@ #include <opie2/omanufacturerdb.h> #include <opie2/onetwork.h> #include <opie2/opcap.h> #include <qpe/qcopenvelope_qws.h> -using namespace Opie::Core; -using namespace Opie::Net; -using namespace Opie::Ui; /* QT */ #include <qcheckbox.h> #include <qcombobox.h> @@ -59,8 +56,13 @@ using namespace Opie::Ui; #include <sys/types.h> #include <stdlib.h> #include <signal.h> + +using namespace Opie::Core; +using namespace Opie::Net; +using namespace Opie::Ui; + Wellenreiter* Wellenreiter::instance = 0; Wellenreiter::Wellenreiter( QWidget* parent ) : WellenreiterBase( parent, 0, 0 ), @@ -73,10 +75,9 @@ Wellenreiter::Wellenreiter( QWidget* parent ) // detect operating system // #ifdef QWS - QString sys; - sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); + QString sys = QString( "(i) Running on '%1'.").arg( ODevice::inst()->systemString() ); _system = ODevice::inst()->system(); logwindow->log( sys ); #endif @@ -109,8 +110,9 @@ void Wellenreiter::initialTimer() void Wellenreiter::signalHandler( int sig ) { + Q_UNUSED( sig ) oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl; if ( Wellenreiter::instance->sniffing ) { Wellenreiter::instance->pcap->closeDumpFile(); @@ -175,9 +177,9 @@ void Wellenreiter::handleNotification( OPacket* p ) QString name = it.current()->name(); if ( configwindow->parsePackets->isProtocolChecked( name ) ) { QString action = configwindow->parsePackets->protocolAction( name ); - odebug << "parsePacket-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl; + odebug << "parsePacket-action for '" << name << "' seems to be '" << action << "'" << oendl; doAction( action, name, p ); } else { @@ -196,14 +198,14 @@ void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* else owarn << "Wellenreiter::handleManagementFrame(): '" << manage->managementType() << "' - please handle me!" << oendl; } -void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* request ) +void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManagementPacket* /* request */ ) { OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); QString essid = ssid ? ssid->ID( true /* decloak */ ) : QString("<unknown>"); - OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); - int channel = ds ? ds->channel() : -1; +// OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); +// int channel = ds ? ds->channel() : -1; OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); GpsLocation loc( -111, -111 ); if ( configwindow->enableGPS->isChecked() ) @@ -219,9 +221,9 @@ void Wellenreiter::handleManagementFrameProbeRequest( OPacket* p, OWaveLanManage odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl; } -void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response ) +void Wellenreiter::handleManagementFrameProbeResponse( OPacket* /* p */, OWaveLanManagementPacket* /* response */ ) { } @@ -286,9 +288,9 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro } } -void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAddress& from, OMacAddress& to ) +void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* /* data */ , OMacAddress& from, OMacAddress& to ) { OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); if ( wlan->fromDS() && !wlan->toDS() ) { @@ -316,18 +318,18 @@ void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAdd } } -void Wellenreiter::handleEthernetData( OPacket* p, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) +void Wellenreiter::handleEthernetData( OPacket* /* p */, OEthernetPacket* data, OMacAddress& from, OMacAddress& to ) { from = data->sourceAddress(); to = data->destinationAddress(); netView()->addNewItem( "station", "<wired>", from, false, -1, 0, GpsLocation( -111, -111 ) ); } -void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, OMacAddress& dest ) +void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& /* source */, OMacAddress& /* dest */ ) { OARPPacket* arp = (OARPPacket*) p->child( "ARP" ); if ( arp ) { @@ -344,9 +346,9 @@ void Wellenreiter::handleARPData( OPacket* p, OARPPacket*, OMacAddress& source, } } -void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, OMacAddress& dest ) +void Wellenreiter::handleIPData( OPacket* p, OIPPacket* /* ip */, OMacAddress& source, OMacAddress& /* dest */ ) { //TODO: Implement more IP based protocols ODHCPPacket* dhcp = (ODHCPPacket*) p->child( "DHCP" ); @@ -354,15 +356,15 @@ void Wellenreiter::handleIPData( OPacket* p, OIPPacket* ip, OMacAddress& source, { odebug << "Received DHCP '" << dhcp->type() << "' packet" << oendl; if ( dhcp->type() == "OFFER" ) { - odebug << "DHCP: '" << (const char*) source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; + odebug << "DHCP: '" << source.toString() << "' ('" << dhcp->serverAddress().toString() << "') seems to be a DHCP server." << oendl; netView()->identify( source, dhcp->serverAddress().toString() ); netView()->addService( "DHCP", source, dhcp->serverAddress().toString() ); } else if ( dhcp->type() == "ACK" ) { - odebug << "DHCP: '" << (const char*) dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; + odebug << "DHCP: '" << dhcp->clientMacAddress().toString() << "' ('" << dhcp->yourAddress().toString() << "') accepted the offered DHCP address." << oendl; netView()->identify( dhcp->clientMacAddress(), dhcp->yourAddress().toString() ); } } } @@ -394,12 +396,12 @@ bool Wellenreiter::checkDumpPacket( OPacket* p ) QString name = it.current()->name(); if ( configwindow->capturePackets->isProtocolChecked( name ) ) { QString action = configwindow->capturePackets->protocolAction( name ); - odebug << "capturePackets-action for '" << (const char*) name << "' seems to be '" << action << "'" << oendl; + odebug << "capturePackets-action for '" << name << "' seems to be '" << action << "'" << oendl; if ( action == "Discard" ) { - logwindow->log( QString().sprintf( "(i) dump-discarding of '%s' packet requested.", (const char*) name ) ); + logwindow->log( QString("(i) dump-discarding of '%1' packet requested." ).arg( name ) ); return false; } } else @@ -519,11 +521,9 @@ void Wellenreiter::stopClicked() #else #warning FIXME: setScreenSaverMode is not operational on the X11 build #endif - // print out statistics - for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) - statwindow->updateCounter( it.key(), it.data() ); + updateStatistics(); } void Wellenreiter::startClicked() @@ -531,9 +531,9 @@ void Wellenreiter::startClicked() // get configuration from config window const QString& interface = configwindow->interfaceName->currentText(); const int cardtype = configwindow->driverType(); - const int interval = configwindow->hoppingInterval(); +// const int interval = configwindow->hoppingInterval(); if ( ( interface == "" ) || ( cardtype == 0 ) ) { QMessageBox::information( this, "Wellenreiter II", @@ -703,9 +703,9 @@ void Wellenreiter::timerEvent( QTimerEvent* ) } } -void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) +void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* /* p */ ) { #ifdef QWS if ( action == "TouchSound" ) ODevice::inst()->playTouchSound(); @@ -717,12 +717,12 @@ void Wellenreiter::doAction( const QString& action, const QString& protocol, OPa ODevice::inst()->setLedState( Led_Mail, Led_On ); else if ( action == "LedOff" ) ODevice::inst()->setLedState( Led_Mail, Led_Off ); else if ( action == "LogMessage" ) - logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); + logwindow->log( QString(tr("Got packet with protocol '%1'","Protocol Name" ) ).arg( protocol ) ); else if ( action == "MessageBox" ) QMessageBox::information( this, "Notification!", - QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); + QString(tr( "Got packet with protocol '%1'", "Protocol Name" ) ).arg( protocol ) ); #else #warning Actions do not work with Qt/X11 yet #endif } @@ -741,11 +741,11 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); return; } - odebug << "joinNetwork() with Interface " << (const char*) iface->name() - << ": " << (const char*) type << ", " << (const char*) essid - << ", " << channel << ", " << (const char*) macaddr << oendl; + odebug << "joinNetwork() with Interface " << iface->name() + << ": " << type << ", " << essid + << ", " << channel << ", " << macaddr << oendl; QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); int count = 3; odebug << "sending " << count << " messages" << oendl; @@ -763,4 +763,16 @@ void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int ch #endif } +void Wellenreiter::updateStatistics() +{ + // print out statistics + for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) + statwindow->updateCounter( it.key(), it.data() ); +} + +void Wellenreiter::slotTabChanged( QWidget* wid ) +{ + if ( wid == statwindow ) + updateStatistics(); +} diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index f582a5f..5ac389e 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h @@ -92,9 +92,14 @@ class Wellenreiter : public WellenreiterBase { QObject* childIfToParse( Opie::Net::OPacket* p, const QString& protocol ); bool checkDumpPacket( Opie::Net::OPacket* p ); void registerSignalHandler(); + private slots: + void slotTabChanged( QWidget* ); + private: + void updateStatistics(); + #ifdef QWS Opie::Core::OSystem _system; // Opie Operating System identifier #endif diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp index a29d520..0ca0bd7 100644 --- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp @@ -157,8 +157,10 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f #ifdef QWS TabWidget->setCurrentTab( tr( "Nets" ) ); #endif + connect(TabWidget, SIGNAL(currentChanged(QWidget*)), + this, SLOT(slotTabChanged(QWidget*))); } /* * Destroys the object and frees any allocated resources diff --git a/noncore/net/wellenreiter/opie-wellenreiter.control b/noncore/net/wellenreiter/opie-wellenreiter.control index cbc287a..e7bc25d 100644 --- a/noncore/net/wellenreiter/opie-wellenreiter.control +++ b/noncore/net/wellenreiter/opie-wellenreiter.control @@ -3,8 +3,8 @@ Files: bin/wellenreiter pics/wellenreiter apps/Applications/wellenreiter.desktop Priority: optional Section: opie/applications Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org> Architecture: arm -Version: 1.0.3 +Version: 1.0.3-cvs Depends: libqpe1, libpcap0 (>=0.7.2), libopiecore2, libopienet2, libopieui2 Description: A WaveLAN Network Monitor A WaveLAN Network Monitor/Sniffer for the Opie Environment. diff --git a/noncore/net/wellenreiter/wellenreiter.pro b/noncore/net/wellenreiter/wellenreiter.pro index eb60c4a..53b762a 100644 --- a/noncore/net/wellenreiter/wellenreiter.pro +++ b/noncore/net/wellenreiter/wellenreiter.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs +VERSION = 1.0.3-cvs !contains( platform, x11 ) { message( Configuring Wellenreiter for build on Opie ) SUBDIRS = gui |