summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/scanlist.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp98
1 files changed, 73 insertions, 25 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 3a6aa15..d5665b4 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -17,2 +17,3 @@
#include "configwindow.h"
+#include "logwindow.h"
@@ -42,5 +43,6 @@ const int col_wep = 4;
const int col_traffic = 5;
-const int col_manuf = 6;
-const int col_firstseen = 7;
-const int col_lastseen = 8;
+const int col_ip = 6;
+const int col_manuf = 7;
+const int col_firstseen = 8;
+const int col_lastseen = 9;
@@ -54,19 +56,21 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
addColumn( tr( "Net/Station" ) );
- setColumnAlignment( 0, AlignLeft || AlignVCenter );
+ setColumnAlignment( col_essid, AlignLeft || AlignVCenter );
addColumn( tr( "#" ) );
- setColumnAlignment( 1, AlignCenter );
+ setColumnAlignment( col_sig, AlignCenter );
addColumn( tr( "MAC" ) );
- setColumnAlignment( 2, AlignCenter );
+ setColumnAlignment( col_ap, AlignCenter );
addColumn( tr( "Chn" ) );
- setColumnAlignment( 3, AlignCenter );
+ setColumnAlignment( col_channel, AlignCenter );
addColumn( tr( "W" ) );
- setColumnAlignment( 4, AlignCenter );
+ setColumnAlignment( col_wep, AlignCenter );
addColumn( tr( "T" ) );
- setColumnAlignment( 5, AlignCenter );
+ setColumnAlignment( col_traffic, AlignCenter );
+ addColumn( tr( "IP" ) );
+ setColumnAlignment( col_ip, AlignCenter );
addColumn( tr( "Manufacturer" ) );
- setColumnAlignment( 6, AlignCenter );
+ setColumnAlignment( col_manuf, AlignCenter );
addColumn( tr( "First Seen" ) );
- setColumnAlignment( 7, AlignCenter );
+ setColumnAlignment( col_firstseen, AlignCenter );
addColumn( tr( "Last Seen" ) );
- setColumnAlignment( 8, AlignCenter );
+ setColumnAlignment( col_lastseen, AlignCenter );
setRootIsDecorated( true );
@@ -105,7 +109,6 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
- qDebug( "MScanList::addNewItem( %s / %s / %s [%d]",
- (const char*) type,
- (const char*) essid,
- (const char*) macaddr,
- channel );
+ #ifdef DEBUG
+ qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type,
+ (const char*) essid, (const char*) macaddr, channel );
+ #endif
@@ -119,3 +122,5 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
{
+ #ifdef DEBUG
qDebug( "itemtext: %s", (const char*) item->text( col_essid ) );
+ #endif
item = static_cast<MScanListItem*> ( item->nextSibling() );
@@ -133,3 +138,5 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
{
+ #ifdef DEBUG
qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) );
+ #endif
item = static_cast<MScanListItem*> ( item->nextSibling() );
@@ -149,4 +156,4 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
{
- s.sprintf( "(i) new network: '%s'", (const char*) essid );
- //TODO send s to logwindow
+ s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid );
+ MLogWindow::logwindow()->log( s );
network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 );
@@ -158,3 +165,5 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
+ #ifdef DEBUG
qDebug( "inserting new station %s", (const char*) macaddr );
+ #endif
@@ -166,3 +175,3 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
{
- s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel );
+ s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel );
}
@@ -170,5 +179,5 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
{
- s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel );
+ s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel );
}
- //TODO send s to logwindow
+ MLogWindow::logwindow()->log( s );
@@ -183,3 +192,5 @@ void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, cons
{
+ #ifdef DEBUG
qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) );
+ #endif
subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
@@ -205,3 +216,3 @@ void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, cons
{
- s.sprintf( "(i) new station in '%s' [??]", (const char*) network->text( col_essid ) );
+ s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) );
}
@@ -209,5 +220,5 @@ void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, cons
{
- s.sprintf( "(i) new wireless station in '%s' [??]", (const char*) network->text( col_essid ) );
+ s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) );
}
- //TODO send s to logwindow
+ MLogWindow::logwindow()->log( s );
}
@@ -235,2 +246,3 @@ void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QStri
qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" );
+ MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" );
}
@@ -256,2 +268,4 @@ void MScanListView::toDStraffic( QString from, QString to, QString via )
qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" );
+ MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" );
+
}
@@ -259,2 +273,3 @@ void MScanListView::toDStraffic( QString from, QString to, QString via )
+
void MScanListView::fromDStraffic( QString from, QString to, QString via )
@@ -276,2 +291,3 @@ void MScanListView::fromDStraffic( QString from, QString to, QString via )
qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" );
+ MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" );
}
@@ -279,2 +295,3 @@ void MScanListView::fromDStraffic( QString from, QString to, QString via )
+
void MScanListView::IBSStraffic( QString from, QString to, QString via )
@@ -282,4 +299,25 @@ void MScanListView::IBSStraffic( QString from, QString to, QString via )
qWarning( "D'oh! Not yet implemented..." );
+ MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" );
}
+
+void MScanListView::identify( const QString& macaddr, const QString& ip )
+{
+ qDebug( "identify %s = %s", (const char*) macaddr, (const char*) ip );
+
+ QListViewItemIterator it( this );
+ for ( ; it.current(); ++it )
+ {
+ if ( it.current()->text( col_ap ) == macaddr )
+ {
+ it.current()->setText( col_ip, ip );
+ return;
+ }
+ }
+ qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" );
+ MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!",
+ (const char*) macaddr, (const char*) ip ) );
+}
+
+
//============================================================
@@ -294,3 +332,5 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS
{
+ #ifdef DEBUG
qDebug( "creating scanlist item" );
+ #endif
if ( WellenreiterConfigWindow::instance() && type == "network" )
@@ -304,3 +344,5 @@ MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid
{
+ #ifdef DEBUG
qDebug( "creating scanlist item" );
+ #endif
decorateItem( type, essid, macaddr, wep, channel, signal );
@@ -315,3 +357,5 @@ void MScanListItem::serializeTo( QDataStream& s ) const
{
+ #ifdef DEBUG
qDebug( "serializing MScanListItem" );
+ #endif
OListViewItem::serializeTo( s );
@@ -324,3 +368,5 @@ void MScanListItem::serializeFrom( QDataStream& s )
{
+ #ifdef DEBUG
qDebug( "serializing MScanListItem" );
+ #endif
OListViewItem::serializeFrom( s );
@@ -342,2 +388,3 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
{
+ #ifdef DEBUG
qDebug( "decorating scanlist item %s / %s / %s [%d]",
@@ -347,2 +394,3 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
channel );
+ #endif