author | mickeyl <mickeyl> | 2002-12-09 15:31:42 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2002-12-09 15:31:42 (UTC) |
commit | b0a600bf9dd32b908d79c2cf1f12b8088dc2590d (patch) (side-by-side diff) | |
tree | a0555985d4cf10e135cb5e3bcf318ef359cf7936 /noncore/net/wellenreiter/gui/wellenreiter.cpp | |
parent | 159a3334ecd168f422afe81853998373457fefa0 (diff) | |
download | opie-b0a600bf9dd32b908d79c2cf1f12b8088dc2590d.zip opie-b0a600bf9dd32b908d79c2cf1f12b8088dc2590d.tar.gz opie-b0a600bf9dd32b908d79c2cf1f12b8088dc2590d.tar.bz2 |
APs and adhoc stations are now grouped and displayed as belonging to a common
net.
Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index d1ace46..9c8630f 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -145,51 +145,66 @@ void Wellenreiter::timerEvent( QTimerEvent* e ) else { qDebug( "no message :(" ); } } void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) { // FIXME: this code belongs in customized QListView, not into this class // search, if we had an item with this essid once before - QListViewItem* item = netview->firstChild(); + //MScanListItem* item = dynamic_cast<MScanListItem*>( netview->firstChild() ); + MScanListItem* item = static_cast<MScanListItem*>( netview->firstChild() ); while ( item && ( item->text( 0 ) != essid ) ) { qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); - item = item->itemBelow(); + item = dynamic_cast<MScanListItem*>( item->itemBelow() ); } if ( item ) { qDebug( "found!" ); - if ( macaddr != item->text( 2 ) ) - new MScanListItem( item, type, essid, macaddr, wep, channel, signal ); - else - qDebug( "already there. ignoring..." ); + // check, if it is the same item (based on MACaddr) + + if ( macaddr == item->text( 2 ) ) + { + qDebug( "already had item with mac %s", (const char*) item->text( 2 ) ); + return; + } + + // another item belonging to the same net, so: insert the new item as child + + new MScanListItem( item, type, essid, macaddr, wep, channel, signal ); } + else { - new MScanListItem( netview, type, essid, macaddr, wep, channel, signal ); + qDebug( "inserting new network" ); + MScanListItem* network = new MScanListItem( netview, "networks", essid, QString::null, 0, 0, 0 ); + + new MScanListItem( network, type, essid, macaddr, wep, channel, signal ); } } void Wellenreiter::buttonClicked() { // FIXME: communicate with daemon and set button text according to state button->setText( "Stop Scanning" ); - // add some icons, so that we can see if this works - - addNewItem( "managed", "DummyNet", "04:00:20:EF:A6:43", true, 6, 80 ); - addNewItem( "adhoc", "DummyNet", "40:03:A3:E7:56:22", false, 11, 30 ); + // add some test stations, so that we can see if the GUI part works + addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); + addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); + addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); + addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); + addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); + QString command ("98"); - sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); + //sendcomm( DAEMONADDR, DAEMONPORT, (const char*) command ); } |