summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp16
-rw-r--r--noncore/net/wellenreiter/gui/graphwindow.cpp34
-rw-r--r--noncore/net/wellenreiter/gui/graphwindow.h26
-rw-r--r--noncore/net/wellenreiter/gui/logwindow.cpp10
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp9
-rw-r--r--noncore/net/wellenreiter/gui/packetview.cpp16
-rw-r--r--noncore/net/wellenreiter/gui/protolistview.cpp10
-rw-r--r--noncore/net/wellenreiter/gui/resource.cpp4
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp61
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp68
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h5
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp2
-rw-r--r--noncore/net/wellenreiter/opie-wellenreiter.control2
-rw-r--r--noncore/net/wellenreiter/wellenreiter.pro1
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
@@ -7,24 +7,25 @@
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
/* LOCAL */
#include "configwindow.h"
#include "mainwindow.h"
+#include "protolistview.h"
/* OPIE */
#include <opie2/onetwork.h>
#ifdef QWS
#include <opie2/oapplication.h>
#include <opie2/oconfig.h>
#include <opie2/odevice.h>
#include <opie2/odebug.h>
using namespace Opie::Core;
using namespace Opie::Net;
#endif
@@ -175,25 +176,28 @@ bool WellenreiterConfigWindow::isChannelChecked( int channel ) const
case 3: return channel3->isOn();
case 4: return channel4->isOn();
case 5: return channel5->isOn();
case 6: return channel6->isOn();
case 7: return channel7->isOn();
case 8: return channel8->isOn();
case 9: return channel9->isOn();
case 10: return channel10->isOn();
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)
{
if ( t != DEVTYPE_FILE ) return;
QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false);
if ( !name.isEmpty() && QFile::exists( name ) )
{
interfaceName->insertItem( name );
interfaceName->setCurrentItem( interfaceName->count()-1 );
}
@@ -208,37 +212,37 @@ void WellenreiterConfigWindow::changedDeviceType(int t)
void WellenreiterConfigWindow::synchronizeActionsAndScripts()
{
if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide();
if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide();
if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide();
//newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 );
//newClientScript->setEnabled( newClientAction->currentItem() == 4 );
//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();
}
void WellenreiterConfigWindow::getCaptureFileNameClicked()
{
QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
odebug << "name = " << name << "" << oendl;
if ( !name.isEmpty() )
{
captureFileName->setText( name );
@@ -271,35 +275,34 @@ bool WellenreiterConfigWindow::useGPS() const
return enableGPS->isChecked();
}
const QString WellenreiterConfigWindow::gpsHost() const
{
return useGPS() ? gpsdHost->currentText() : QString::null;
}
int WellenreiterConfigWindow::gpsPort() const
{
- bool ok;
return useGPS() ? gpsdPort->value() : -1;
}
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;
if ( type == "network" )
{
action = newNetworkAction->currentItem();
script = newNetworkScript->text();
}
else if ( type == "managed" || type == "adhoc" )
{
@@ -308,25 +311,25 @@ void WellenreiterConfigWindow::performAction( const QString& type,
}
else if ( type == "station" )
{
action = newStationAction->currentItem();
script = newStationScript->text();
}
else
{
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;
case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return;
case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return;
case 3: /* Blink LED */ break; //FIXME: Implement this
case 4: /* Run Script */
{
/**
*
* Script Substitution Information:
@@ -395,24 +398,25 @@ void WellenreiterConfigWindow::load()
performAutodetection();
}
prismHeader->setChecked( c->readBoolEntry( "prism", false ) );
hopChannels->setChecked( c->readBoolEntry( "hop", true ) );
hopInterval->setValue( c->readNumEntry( "interval", 250 ) );
adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) );
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 ) );
c->setGroup( "UI" );
lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) );
openTree->setChecked( c->readBoolEntry( "openTree", true ) );
disablePM->setChecked( c->readBoolEntry( "disablePM", true ) );
newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 1 ) ); // Default: Play Alarm
newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) );
newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 2 ) ); // Default: Play Click
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
@@ -10,24 +10,51 @@
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "graphwindow.h"
#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];
_dirty = new bool[_channels];
for ( int i = 0; i < channels; ++i )
{ _values[i] = 0;
_dirty[i] = true;
}
// we draw everything on our own
setBackgroundMode( QWidget::NoBackground );
@@ -76,25 +103,25 @@ void MFrequencySpectrum::drawBar( QPainter* p, int x, int y, int width, int heig
int s = (s2-s1)*i/maxheight + s1;
int v = (v2-v1)*i/maxheight + v1;
if ( i == 0 )
drawBottomLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) );
else if ( i == height-1 )
drawTopLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) );
else
drawLine( p, x, y-i, width, QColor( h,s,v, QColor::Hsv ) );
}
}
-void MFrequencySpectrum::paintEvent( QPaintEvent* e )
+void MFrequencySpectrum::paintEvent( QPaintEvent* )
{
QPixmap pm( size() );
QPainter p;
p.begin( &pm );
p.drawTiledPixmap( 0, 0, size().width(), size().height(), QPixmap( (const char**) &background ) );
int xmargin = 5;
int ymargin = 2;
int y = size().height() - 2 * ymargin;
int x = 0;
int width = ( size().width() - 2 * xmargin ) / _channels;
@@ -109,50 +136,47 @@ void MFrequencySpectrum::paintEvent( QPaintEvent* e )
}
p.end();
bitBlt( this, 0, 0, &pm );
}
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;
int height = 100 - ( pos.y()-ymargin )*100/y;
if ( channel < 15 ) _values[channel] = height;
}
Legende::Legende( int channels, QWidget* parent, const char* name, WFlags f )
:QFrame( parent, name, f ), _channels( channels )
{
setLineWidth( 2 );
setFrameStyle( Panel + Sunken );
setFixedHeight( 16 );
}
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 ) );
}
MGraphWindow::MGraphWindow( QWidget* parent, const char* name, WFlags f )
:QVBox( parent, name, f )
{
spectrum = new MFrequencySpectrum( 14, this );
legende = new Legende( 14, this );
@@ -161,25 +185,25 @@ MGraphWindow::MGraphWindow( QWidget* parent, const char* name, WFlags f )
void MGraphWindow::testGraph()
{
static int i = 0;
spectrum->setValue( i++, 100 );
if ( i == 14 ) i = 0;
QTimer::singleShot( 2000, this, SLOT( testGraph() ) );
}
-void MGraphWindow::timerEvent( QTimerEvent* e )
+void MGraphWindow::timerEvent( QTimerEvent* )
{
for ( int i = 0; i < 14; i++ )
{
spectrum->decrease( i, 1 );
}
spectrum->repaint();
}
void MGraphWindow::traffic( int channel, int signal )
{
spectrum->setValue( channel-1, signal );
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
@@ -81,41 +81,15 @@ class MGraphWindow : public QVBox
protected:
virtual void timerEvent( QTimerEvent* e );
protected slots:
virtual void testGraph();
protected:
MFrequencySpectrum* spectrum;
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
@@ -21,38 +21,36 @@ using namespace Opie::Core;
/* QT */
#include <qmultilineedit.h>
#include <qdatetime.h>
MLogWindow* MLogWindow::_instance;
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;
}
void MLogWindow::clear()
{
ledit->clear();
}
const QString MLogWindow::getLog() const
{
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
@@ -22,50 +22,51 @@
#include "scanlist.h"
/* OPIE */
#ifdef QWS
#include <qpe/resource.h>
#include <opie2/odebug.h>
#include <opie2/ofiledialog.h>
#else
#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>
#include <qfile.h>
#include <qfileinfo.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qiconset.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qpushbutton.h>
#include <qstatusbar.h>
#include <qspinbox.h>
#include <qtextstream.h>
#include <qtoolbutton.h>
#include <qwhatsthis.h>
/* 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 );
mw = new Wellenreiter( this );
mw->setConfigWindow( cw );
setCentralWidget( mw );
// setup application icon
setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) );
#ifndef QWS
@@ -459,25 +460,25 @@ void WellenreiterMainWindow::uploadSession()
{
QMessageBox::warning( 0, tr( "Error" ), tr( "<p>Logfile '%1' doesn't exist</p>").arg( mw->captureFileName() ) );
return;
}
QFile f( mw->captureFileName() );
if ( !f.open( IO_ReadOnly ) )
{
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;
raddr.sin_port = htons ( 80 );
sock = ::socket( AF_INET, SOCK_STREAM, 0 );
if ( sock >= 0 )
{
if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 )
{
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
@@ -62,41 +62,52 @@ PacketView::PacketView( QWidget * parent, const char * name, WFlags f )
_packets.setAutoDelete( true );
connect( _number, SIGNAL( valueChanged( int ) ), this, SLOT( showPacket( int ) ) );
connect( parent, SIGNAL( currentChanged( QWidget *) ), this, SLOT( activated( QWidget* ) ) );
clear();
}
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 )
{
_list->clear();
_hex->setText("");
const OPacket* p = _packets.at( number-1 );
if ( p )
{
_doSubPackets( const_cast<QObjectList*>( p->children() ), 0 );
_doHexPacket( p );
@@ -130,24 +141,25 @@ void PacketView::_doSubPackets( QObjectList* l, int counter )
}
void PacketView::_doHexPacket( const OPacket* p )
{
if ( oApp->desktop()->width() > 320 )
_hex->setText( p->dump( 16 ) );
else
_hex->setText( p->dump( 8 ) );
}
const QString PacketView::getLog() const
{
+ return QString::null;
}
void PacketView::clear()
{
_packets.clear();
_number->setMinValue( 0 );
_number->setMaxValue( 0 );
_label->setText( "---" );
_list->clear();
_hex->setText( " <center><i>-- no Packet available --</i></center> " );
}
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
@@ -63,58 +63,58 @@ ProtocolListView::ProtocolListView( QWidget* parent, const char* name, WFlags f
addProtocol( "TCP" );
}
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" );
combo->insertItem( "Discard!" );
combo->insertItem( "TouchSound" );
combo->insertItem( "AlarmSound" );
combo->insertItem( "KeySound" );
combo->insertItem( "LedOn" );
combo->insertItem( "LedOff" );
combo->insertItem( "LogMessage" );
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" );
combo->insertItem( "Discard!" );
}
}
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
@@ -16,34 +16,34 @@
#include "resource.h"
#define PIXMAPPATH "/usr/local/share"
#include <qiconset.h>
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;
}
return pixmap;
};
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;
}
return QIconSet( pixmap );
};
};
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
@@ -16,50 +16,54 @@
#include "scanlist.h"
#include "configwindow.h"
#include "logwindow.h"
/* OPIE */
#ifdef QWS
#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#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>
#include <qpopupmenu.h>
#include <qcheckbox.h>
/* 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;
const int col_channel = 3;
const int col_wep = 4;
const int col_traffic = 5;
const int col_ip = 6;
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 );
setFrameShadow( QListView::Sunken );
addColumn( tr( "Net/Station" ) );
setColumnAlignment( col_essid, AlignLeft || AlignVCenter );
addColumn( tr( "#" ) );
setColumnAlignment( col_sig, AlignCenter );
addColumn( tr( "MAC" ) );
setColumnAlignment( col_ap, AlignCenter );
@@ -167,48 +171,48 @@ void MScanListView::addNewItem( const QString& type,
if ( item )
{
// we have already seen this item, it's a dupe
#ifdef DEBUG
odebug << "" << macaddr << " is a dupe - ignoring..." << oendl;
#endif
item->receivedBeacon();
return;
}
}
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 );
}
// insert new station as child from network
// no essid to reduce clutter, maybe later we have a nick or stationname to display!?
#ifdef DEBUG
odebug << "inserting new station " << macaddr << "" << oendl;
#endif
MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
station->setManufacturer( mac.manufacturer() );
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 );
}
void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type )
{
MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) )
{
#ifdef DEBUG
@@ -225,134 +229,134 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress&
#endif
subitem->receivedBeacon(); //FIXME: sent data bit
return;
}
// Hey, it seems to be a new item :-D
MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 );
station->setManufacturer( addr.manufacturer() );
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) &&
it.current()->text( col_ap ) != viaTo.toString(true) ) ++it;
MScanListItem* item = static_cast<MScanListItem*>( it.current() );
if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations
{
addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from );
addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to );
}
else
{
odebug << "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" << oendl;
MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" );
}
}
-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;
MScanListItem* item = static_cast<MScanListItem*>( it.current() );
if ( item ) // AP has shown up yet, so just add our new "from" - station
{
addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" );
}
else
{
odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl;
MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" );
}
}
-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;
MScanListItem* item = static_cast<MScanListItem*>( it.current() );
if ( item ) // AP has shown up yet, so just add our new "from" - station
{
addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" );
}
else
{
odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl;
MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" );
}
}
-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 )
{
if ( it.current()->text( col_ap ) == macaddr.toString(true) )
{
it.current()->setText( col_ip, 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?)
QListViewItemIterator it( this );
for ( ; it.current(); ++it )
{
if ( it.current()->text( col_ap ) == macaddr.toString(true) )
{
MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() );
@@ -375,41 +379,41 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr,
return;
}
// never seen that - add new item
MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 );
item->setText( col_essid, name );
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 )
{
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() );
if ( result == 37773 )
emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() );
}
}
//============================================================
// MScanListItem
//============================================================
@@ -470,43 +474,42 @@ void MScanListItem::serializeTo( QDataStream& s ) const
void MScanListItem::serializeFrom( QDataStream& s )
{
#ifdef DEBUG
odebug << "serializing MScanListItem" << oendl;
#endif
OListViewItem::serializeFrom( s );
Q_UINT8 wep;
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();
}
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 )
{
setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) );
}
// set icon for wep (wireless encryption protocol)
if ( wep )
setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
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
@@ -24,67 +24,68 @@
/* OPIE */
#ifdef QWS
#include <opie2/oapplication.h>
#include <opie2/odebug.h>
#include <opie2/odevice.h>
#else
#include <qapplication.h>
#endif
#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>
#include <qdatetime.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qmessagebox.h>
#include <qobjectlist.h>
#include <qregexp.h>
#include <qspinbox.h>
#include <qtimer.h>
#include <qtoolbutton.h>
#include <qmainwindow.h>
/* STD */
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#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 ),
sniffing( false ), iface( 0 ), configwindow( 0 )
{
logwindow->log( "(i) Wellenreiter has been started." );
//
// 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
netview->setColumnWidthMode( 1, QListView::Manual );
connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ),
this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) );
pcap = new OPacketCapturer();
pcap->setAutoDelete( false );
gps = new GPS( this );
@@ -101,24 +102,25 @@ Wellenreiter::~Wellenreiter()
}
void Wellenreiter::initialTimer()
{
odebug << "preloading manufacturer database..." << oendl;
OManufacturerDB::instance();
}
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();
Wellenreiter::instance->pcap->close();
Wellenreiter::instance->stopClicked();
}
oerr << "Phew. Seemed to work." << oendl;
::exit( -1 );
}
@@ -167,69 +169,69 @@ void Wellenreiter::channelHopped(int c)
void Wellenreiter::handleNotification( OPacket* p )
{
QObjectList* l = p->queryList();
QObjectListIt it( *l );
QObject* o;
while ( (o = it.current()) != 0 )
{
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
{
odebug << "protocol '" << name << "' not checked in parsePackets." << oendl;
}
++it;
}
}
void Wellenreiter::handleManagementFrame( OPacket* p, OWaveLanManagementPacket* manage )
{
if ( manage->managementType() == "Beacon" ) handleManagementFrameBeacon( p, manage );
else if ( manage->managementType() == "ProbeRequest" ) handleManagementFrameProbeRequest( p, manage );
else if ( manage->managementType() == "ProbeResponse" ) handleManagementFrameProbeResponse( p, manage );
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() )
{
// TODO: add check if GPS is working!?
odebug << "Wellenreiter::gathering GPS data..." << oendl;
loc = gps->position();
odebug << "Wellenreiter::GPS data received is ( " << loc.latitude() << " , " << loc.longitude() << " ) - dms string = '" << loc.dmsPosition().latin1() << "'" << oendl;
}
if ( essid.length() )
netView()->addNewItem( "adhoc", essid, header->macAddress2(), false /* should check FrameControl field */, -1, 0, loc, true /* only probed */ );
odebug << "Wellenreiter::invalid frame [possibly noise] detected!" << oendl;
}
-void Wellenreiter::handleManagementFrameProbeResponse( OPacket* p, OWaveLanManagementPacket* response )
+void Wellenreiter::handleManagementFrameProbeResponse( OPacket* /* p */, OWaveLanManagementPacket* /* response */ )
{
}
void Wellenreiter::handleManagementFrameBeacon( OPacket* p, OWaveLanManagementPacket* beacon )
{
QString type;
if ( beacon->canIBSS() )
{
type = "adhoc";
}
else if ( beacon->canESS() )
@@ -278,25 +280,25 @@ void Wellenreiter::handleControlFrame( OPacket* p, OWaveLanControlPacket* contro
if ( control->controlType() == "Acknowledge" )
{
netView()->addNewItem( "adhoc", "<unknown>", header->macAddress1(), false, -1, 0, GpsLocation( -111, -111 ) );
}
else
{
odebug << "Wellenreiter::handleControlFrame - please handle " << control->controlType() << " in a future version! :D" << oendl;
}
}
-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() )
{
netView()->fromDStraffic( wlan->macAddress3(), wlan->macAddress1(), wlan->macAddress2() );
from = wlan->macAddress3();
to = wlan->macAddress2();
}
else if ( !wlan->fromDS() && wlan->toDS() )
{
netView()->toDStraffic( wlan->macAddress2(), wlan->macAddress3(), wlan->macAddress1() );
from = wlan->macAddress2();
@@ -308,69 +310,69 @@ void Wellenreiter::handleWlanData( OPacket* p, OWaveLanDataPacket* data, OMacAdd
from = wlan->macAddress4();
to = wlan->macAddress3();
}
else
{
netView()->IBSStraffic( wlan->macAddress2(), wlan->macAddress1(), wlan->macAddress3() );
from = wlan->macAddress2();
to = wlan->macAddress1();
}
}
-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 )
{
odebug << "Received ARP traffic (type '" << arp->type() << "'): " << oendl;
if ( arp->type() == "REQUEST" )
{
netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
}
else if ( arp->type() == "REPLY" )
{
netView()->identify( arp->senderMacAddress(), arp->senderIPV4Address().toString() );
netView()->identify( arp->targetMacAddress(), arp->targetIPV4Address().toString() );
}
}
}
-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" );
if ( dhcp )
{
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() );
}
}
}
QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
{
if ( configwindow->parsePackets->isProtocolChecked( protocol ) )
if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" )
return 0;
@@ -386,28 +388,28 @@ bool Wellenreiter::checkDumpPacket( OPacket* p )
return true; // semantic change - we're logging anyway now to /tmp/wellenreiter
QObjectList* l = p->queryList();
QObjectListIt it( *l );
QObject* o;
while ( (o = it.current()) != 0 )
{
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
{
odebug << "protocol '" << name << "' not checked in capturePackets." << oendl;
}
++it;
}
return true;
}
@@ -511,37 +513,35 @@ void Wellenreiter::stopClicked()
sniffing = false;
emit( stoppedSniffing() );
#ifdef QWS
if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() )
{
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#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()
{
// 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",
tr( "No device configured.\nPlease reconfigure!" ) );
return;
}
// configure device
ONetwork* net = ONetwork::instance();
// TODO: check if interface is wireless and support sniffing for non-wireless interfaces
@@ -695,72 +695,84 @@ void Wellenreiter::timerEvent( QTimerEvent* )
stopClicked();
}
else
{
receivePacket( p );
// We no longer delete packets here. Ownership of the packets is
// transferred to the PacketView.
//delete p;
}
}
-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();
else if ( action == "AlarmSound" )
ODevice::inst()->playAlarmSound();
else if ( action == "KeySound" )
ODevice::inst()->playKeySound();
else if ( action == "LedOn" )
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
}
void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr)
{
#ifdef QWS
if ( !iface )
{
QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) );
return;
}
if ( sniffing )
{
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;
msg << QString("count") << QString::number(count);
odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl;
msg << QString(iface->name()) << QString("Mode") << type;
odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl;
msg << QString(iface->name()) << QString("ESSID") << essid;
odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl;
msg << QString(iface->name()) << QString("Channel") << channel;
// odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl;
// msg << QString(iface->name()) << QString("MacAddr") << macaddr;
#else
QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) );
#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
@@ -84,25 +84,30 @@ class Wellenreiter : public WellenreiterBase {
void handleManagementFrameProbeResponse( Opie::Net::OPacket* p, Opie::Net::OWaveLanManagementPacket* );
void handleControlFrame( Opie::Net::OPacket* p, Opie::Net::OWaveLanControlPacket* control );
void handleWlanData( Opie::Net::OPacket* p, Opie::Net::OWaveLanDataPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
void handleEthernetData( Opie::Net::OPacket* p, Opie::Net::OEthernetPacket* data, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
void handleARPData( Opie::Net::OPacket* p, Opie::Net::OARPPacket* arp, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
void handleIPData( Opie::Net::OPacket* p, Opie::Net::OIPPacket* ip, Opie::Net::OMacAddress& from, Opie::Net::OMacAddress& to );
void handleNotification( Opie::Net::OPacket* p );
void doAction( const QString& action, const QString& protocol, Opie::Net::OPacket* p );
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
Opie::Net::OWirelessNetworkInterface* iface;
Opie::Net::OPacketCapturer* pcap;
WellenreiterConfigWindow* configwindow;
GPS* gps;
//void readConfig();
//void writeConfig();
};
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
@@ -149,24 +149,26 @@ WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags f
TabWidget->addTab( graphwindow, /* "wellenreiter/graph", */ tr( "Graph" ) );
TabWidget->addTab( logwindow, /* "wellenreiter/log", */ tr( "Log" ) );
TabWidget->addTab( hexwindow, /* "wellenreiter/hex", */ tr( "Hex" ) );
TabWidget->addTab( statwindow, /* "wellenreiter/hex", */ tr( "Stat" ) );
TabWidget->addTab( about, /* "wellenreiter/about", */ tr( "About" ) );
#endif
WellenreiterBaseLayout->addWidget( TabWidget );
#ifdef QWS
TabWidget->setCurrentTab( tr( "Nets" ) );
#endif
+ connect(TabWidget, SIGNAL(currentChanged(QWidget*)),
+ this, SLOT(slotTabChanged(QWidget*)));
}
/*
* Destroys the object and frees any allocated resources
*/
WellenreiterBase::~WellenreiterBase()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Main event handler. Reimplemented to handle application
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
@@ -1,10 +1,10 @@
Package: opie-wellenreiter
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,13 +1,14 @@
TEMPLATE = subdirs
+VERSION = 1.0.3-cvs
!contains( platform, x11 ) {
message( Configuring Wellenreiter for build on Opie )
SUBDIRS = gui
include ( $(OPIEDIR)/include.pro )
}
contains( platform, x11 ) {
message( Configuring Wellenreiter for build on Qt/X11 )
SUBDIRS = lib gui
system( mkdir -p $OPIEDIR/lib $OPIEDIR/bin $OPIEDIR/share/pics )
}