summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp32
1 files changed, 7 insertions, 25 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 7733934..b8aa81c 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -70,181 +70,163 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
addColumn( tr( "Last Seen" ) );
setColumnAlignment( 8, AlignCenter );
setRootIsDecorated( true );
setAllColumnsShowFocus( true );
};
MScanListView::~MScanListView()
{
};
OListViewItem* MScanListView::childFactory()
{
return new MScanListItem( this );
}
void MScanListView::serializeTo( QDataStream& s) const
{
qDebug( "serializing MScanListView" );
OListView::serializeTo( s );
}
void MScanListView::serializeFrom( QDataStream& s)
{
qDebug( "serializing MScanListView" );
OListView::serializeFrom( s );
}
void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb )
{
_manufacturerdb = manufacturerdb;
}
void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
{
// FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...)
qDebug( "MScanList::addNewItem( %s / %s / %s [%d]",
(const char*) type,
(const char*) essid,
(const char*) macaddr,
channel );
// search, if we already have seen this net
QString s;
MScanListItem* network;
MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
- while ( item && ( item->text( 0 ) != essid ) )
+ while ( item && ( item->text( col_essid ) != essid ) )
{
- qDebug( "itemtext: %s", (const char*) item->text( 0 ) );
- item = static_cast<MScanListItem*> ( item->itemBelow() );
+ qDebug( "itemtext: %s", (const char*) item->text( col_essid ) );
+ item = static_cast<MScanListItem*> ( item->nextSibling() );
}
if ( item )
{
- // animate the item
-
- /*
-
- const QPixmap* pixmap = item->pixmap( 0 );
- const QPixmap* nextpixmap = ani2;
- if ( pixmap == ani1 )
- nextpixmap = ani2;
- else if ( pixmap == ani2 )
- nextpixmap = ani3;
- else if ( pixmap == ani3 )
- nextpixmap = ani4;
- else if ( pixmap == ani4 )
- nextpixmap = ani1;
- item->setPixmap( 0, *nextpixmap ); */
-
- //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap );
-
// we have already seen this net, check all childs if MAC exists
network = item;
item = static_cast<MScanListItem*> ( item->firstChild() );
assert( item ); // this shouldn't fail
- while ( item && ( item->text( 2 ) != macaddr ) )
+ while ( item && ( item->text( col_ap ) != macaddr ) )
{
- qDebug( "subitemtext: %s", (const char*) item->text( 2 ) );
- item = static_cast<MScanListItem*> ( item->itemBelow() );
+ qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) );
+ item = static_cast<MScanListItem*> ( item->nextSibling() );
}
if ( item )
{
// we have already seen this item, it's a dupe
#ifdef DEBUG
qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
#endif
item->receivedBeacon();
return;
}
}
else
{
s.sprintf( "(i) new network: '%s'", (const char*) essid );
network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 );
}
// insert new station as child from network
// no essid to reduce clutter, maybe later we have a nick or stationname to display!?
qDebug( "inserting new station %s", (const char*) macaddr );
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 )
{
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->itemBelow() );
+ 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 );
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() );
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
{
qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" );
}
}
void MScanListView::toDStraffic( QString from, QString to, QString via )
{
QString s;
MScanListItem* network;