Diffstat (limited to 'noncore/net/wellenreiter/gui/wellenreiter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 96ab7bd..afb010c 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -30,16 +30,17 @@ #include "../libwellenreiter/source/sock.hh" // <--- ugly path, FIX THIS! #include "../daemon/source/config.hh" // <--- ugly path, FIX THIS! Wellenreiter::Wellenreiter( QWidget* parent, const char* name, WFlags fl ) : WellenreiterBase( parent, name, fl ) { connect( button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); + netview->setColumnWidthMode( 1, QListView::Manual ); // // setup socket for daemon communication and start poller // daemon_fd = commsock( DAEMONADDR, DAEMONPORT ); if ( daemon_fd == -1 ) qDebug( "D'oh! Could not get file descriptor for daemon socket." ); @@ -81,21 +82,45 @@ void Wellenreiter::timerEvent( QTimerEvent* e ) handleMessage(); } else { // qDebug( "no message :(" ); } } +void Wellenreiter::addNewStation( QString type, QString essid, QString ap, 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(); + + while ( item && ( item->text( 0 ) != essid ) ) + { + qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); + item = item->itemBelow(); + } + if ( item ) + { + qDebug( "found!" ); + new MScanListItem( item, type, essid, ap, wep, channel, signal ); + } + else + { + new MScanListItem( netview, type, essid, ap, 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 - new MScanListItem( netview, "managed", "MyNet", "04:00:20:EF:A6:43", true, 6, 80 ); - new MScanListItem( netview, "adhoc", "YourNet", "40:03:A3:E7:56:22", false, 11, 30 ); + addNewStation( "managed", "MyNet", "04:00:20:EF:A6:43", true, 6, 80 ); + addNewStation( "adhoc", "YourNet", "40:03:A3:E7:56:22", false, 11, 30 ); } |