summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp23
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h2
2 files changed, 20 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index b8aa81c..1cf49e0 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -161,54 +161,54 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
if ( _manufacturerdb )
station->setManufacturer( _manufacturerdb->lookup( macaddr ) );
if ( type == "managed" )
{
s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel );
}
else
{
s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel );
}
}
-void MScanListView::addIfNotExisting( MScanListItem* network, QString addr )
+void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, const QString& type )
{
MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
while ( subitem && ( subitem->text( col_ap ) != addr ) )
{
qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) );
subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
}
if ( subitem )
{
// we have already seen this item, it's a dupe
#ifdef DEBUG
qDebug( "%s is a dupe - ignoring...", (const char*) addr );
#endif
subitem->receivedBeacon(); //FIXME: sent data bit
return;
}
// Hey, it seems to be a new item :-D
- MScanListItem* station = new MScanListItem( network, "station", /* network->text( col_essid ) */ "", addr, false, -1, -1 );
+ MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr, false, -1, -1 );
if ( _manufacturerdb )
station->setManufacturer( _manufacturerdb->lookup( addr ) );
}
void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo )
{
QString s;
MScanListItem* network;
QListViewItemIterator it( this );
while ( it.current() &&
it.current()->text( col_ap ) != viaFrom &&
it.current()->text( col_ap ) != viaTo ) ++it;
MScanListItem* item = static_cast<MScanListItem*>( it.current() );
@@ -224,43 +224,58 @@ void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QStri
}
}
void MScanListView::toDStraffic( QString from, QString to, QString via )
{
QString s;
MScanListItem* network;
QListViewItemIterator it( this );
while ( it.current() && it.current()->text( col_ap ) != via ) ++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 );
+ addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" );
}
else
{
qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" );
}
}
void MScanListView::fromDStraffic( QString from, QString to, QString via )
{
- qWarning( "D'oh! Not yet implemented..." );
+ QString s;
+ MScanListItem* network;
+
+ QListViewItemIterator it( this );
+ while ( it.current() && it.current()->text( col_ap ) != via ) ++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
+ {
+ qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" );
+ }
}
void MScanListView::IBSStraffic( QString from, QString to, QString via )
{
qWarning( "D'oh! Not yet implemented..." );
}
//============================================================
// MScanListItem
//============================================================
MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr,
bool wep, int channel, int signal )
:OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
_type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
_channel( channel ), _signal( signal ), _beacons( 1 )
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index a14d426..56bf837 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -34,33 +34,33 @@ class MScanListView: public OListView
virtual ~MScanListView();
void setManufacturerDB( ManufacturerDB* manufacturerdb );
virtual OListViewItem* childFactory();
virtual void serializeTo( QDataStream& s ) const;
virtual void serializeFrom( QDataStream& s );
public slots:
void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
void fromDStraffic( QString from, QString to, QString via ); // NYI
void toDStraffic( QString from, QString to, QString via );
void WDStraffic( QString from, QString to, QString viaFrom, QString viaTo );
void IBSStraffic( QString from, QString to, QString via ); // NYI
protected:
- void addIfNotExisting( MScanListItem* parent, QString addr );
+ void addIfNotExisting( MScanListItem* parent, QString addr, const QString& type = "station" );
private:
ManufacturerDB* _manufacturerdb;
};
//****************************** MScanListItem ****************************************************************
class MScanListItem: public OListViewItem
{
public:
MScanListItem::MScanListItem( QListView* parent,
QString type = "unknown",
QString essid = "unknown",
QString macaddr = "unknown",
bool wep = false,