summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2002-12-09 15:31:42 (UTC)
committer mickeyl <mickeyl>2002-12-09 15:31:42 (UTC)
commitb0a600bf9dd32b908d79c2cf1f12b8088dc2590d (patch) (side-by-side diff)
treea0555985d4cf10e135cb5e3bcf318ef359cf7936
parent159a3334ecd168f422afe81853998373457fefa0 (diff)
downloadopie-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 (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.cpp6
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.h4
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp35
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiterbase.cpp7
4 files changed, 41 insertions, 11 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp
index 9532a01..189a12d 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.cpp
+++ b/noncore/net/wellenreiter/gui/scanlistitem.cpp
@@ -35,31 +35,35 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS
}
MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr,
bool wep, int channel, int signal )
:QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
{
qDebug( "creating scanlist item" );
decorateItem( type, essid, macaddr, wep, channel, signal );
}
void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
{
qDebug( "decorating scanlist item" );
// set icon for managed or adhoc mode
QString name;
name.sprintf( "wellenreiter/%s", (const char*) type );
setPixmap( col_type, Resource::loadPixmap( name ) );
// set icon for wep (wireless encryption protocol)
if ( wep )
setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap!
// set channel and signal text
+
+ if ( signal != -1 )
setText( col_sig, QString::number( signal ) );
+ if ( channel != -1 )
setText( col_channel, QString::number( channel ) );
- //setText
listView()->triggerUpdate();
+ this->type = type;
+
}
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.h b/noncore/net/wellenreiter/gui/scanlistitem.h
index dd8219a..cd9d883 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.h
+++ b/noncore/net/wellenreiter/gui/scanlistitem.h
@@ -24,28 +24,32 @@ class MScanListItem: public QListViewItem
{
public:
MScanListItem::MScanListItem( QListView* parent,
QString type,
QString essid,
QString macaddr,
bool wep,
int channel,
int signal );
MScanListItem::MScanListItem( QListViewItem* parent,
QString type,
QString essid,
QString macaddr,
bool wep,
int channel,
int signal );
protected:
virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal );
+ public:
+
+ QString type;
+
};
#endif
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
@@ -133,63 +133,78 @@ bool Wellenreiter::hasMessage()
int result = select( daemon_fd+1, &rfds, NULL, NULL, &tv );
return FD_ISSET( daemon_fd, &rfds );
}
void Wellenreiter::timerEvent( QTimerEvent* e )
{
qDebug( "checking for message..." );
if ( hasMessage() )
{
handleMessage();
}
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 ) )
+ // 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
- qDebug( "already there. ignoring..." );
}
+
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
+ // add some test stations, so that we can see if the GUI part 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 );
+ 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 );
}
diff --git a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
index 9b6424d..b1845b9 100644
--- a/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiterbase.cpp
@@ -39,53 +39,60 @@
* name 'name' and widget flags set to 'f'
*/
WellenreiterBase::WellenreiterBase( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
if ( !name )
setName( "WellenreiterBase" );
resize( 191, 294 );
setCaption( tr( "Wellenreiter" ) );
WellenreiterBaseLayout = new QVBoxLayout( this );
WellenreiterBaseLayout->setSpacing( 2 );
WellenreiterBaseLayout->setMargin( 0 );
TabWidget = new OTabWidget( this, "TabWidget", OTabWidget::Global );
ap = new QWidget( TabWidget, "ap" );
apLayout = new QVBoxLayout( ap );
apLayout->setSpacing( 2 );
apLayout->setMargin( 2 );
//--------- NETVIEW TAB --------------
netview = new QListView( ap, "netview" );
netview->addColumn( tr( "SSID" ) );
+ netview->setColumnAlignment( 0, AlignLeft || AlignVCenter );
netview->addColumn( tr( "Sig" ) );
+ netview->setColumnAlignment( 1, AlignCenter );
netview->addColumn( tr( "AP" ) );
+ netview->setColumnAlignment( 2, AlignCenter );
netview->addColumn( tr( "Chn" ) );
+ netview->setColumnAlignment( 3, AlignCenter );
netview->addColumn( tr( "W" ) );
+ netview->setColumnAlignment( 4, AlignCenter );
netview->addColumn( tr( "T" ) );
+ netview->setColumnAlignment( 5, AlignCenter );
+
netview->setFrameShape( QListView::StyledPanel );
netview->setFrameShadow( QListView::Sunken );
netview->setRootIsDecorated( TRUE );
apLayout->addWidget( netview );
TabWidget->addTab( ap, "wellenreiter/networks", tr( "Networks" ) );
//--------- LOG TAB --------------
logwindow = new MLogWindow( TabWidget, "Log" );
TabWidget->addTab( logwindow, "wellenreiter/log", tr( "Log" ) );
//--------- HEX TAB --------------
hexwindow = new MHexWindow( TabWidget, "Hex" );
TabWidget->addTab( hexwindow, "wellenreiter/hex", tr( "Hex" ) );
//--------- CONFIG TAB --------------
QPushButton* dummy = new QPushButton( "under construction", TabWidget );
TabWidget->addTab( dummy, "wellenreiter/config", tr( "Config" ) );
//--------- ABOUT TAB --------------
about = new QWidget( TabWidget, "about" );