summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/scanlist.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 1cf49e0..3a6aa15 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -44,27 +44,27 @@ const int col_manuf = 6;
44const int col_firstseen = 7; 44const int col_firstseen = 7;
45const int col_lastseen = 8; 45const int col_lastseen = 8;
46 46
47MScanListView::MScanListView( QWidget* parent, const char* name ) 47MScanListView::MScanListView( QWidget* parent, const char* name )
48 :OListView( parent, name ), _manufacturerdb( 0 ) 48 :OListView( parent, name ), _manufacturerdb( 0 )
49{ 49{
50 50
51 setFrameShape( QListView::StyledPanel ); 51 setFrameShape( QListView::StyledPanel );
52 setFrameShadow( QListView::Sunken ); 52 setFrameShadow( QListView::Sunken );
53 53
54 addColumn( tr( "Net/Station" ) ); 54 addColumn( tr( "Net/Station" ) );
55 setColumnAlignment( 0, AlignLeft || AlignVCenter ); 55 setColumnAlignment( 0, AlignLeft || AlignVCenter );
56 addColumn( tr( "B" ) ); 56 addColumn( tr( "#" ) );
57 setColumnAlignment( 1, AlignCenter ); 57 setColumnAlignment( 1, AlignCenter );
58 addColumn( tr( "AP" ) ); 58 addColumn( tr( "MAC" ) );
59 setColumnAlignment( 2, AlignCenter ); 59 setColumnAlignment( 2, AlignCenter );
60 addColumn( tr( "Chn" ) ); 60 addColumn( tr( "Chn" ) );
61 setColumnAlignment( 3, AlignCenter ); 61 setColumnAlignment( 3, AlignCenter );
62 addColumn( tr( "W" ) ); 62 addColumn( tr( "W" ) );
63 setColumnAlignment( 4, AlignCenter ); 63 setColumnAlignment( 4, AlignCenter );
64 addColumn( tr( "T" ) ); 64 addColumn( tr( "T" ) );
65 setColumnAlignment( 5, AlignCenter ); 65 setColumnAlignment( 5, AlignCenter );
66 addColumn( tr( "Manufacturer" ) ); 66 addColumn( tr( "Manufacturer" ) );
67 setColumnAlignment( 6, AlignCenter ); 67 setColumnAlignment( 6, AlignCenter );
68 addColumn( tr( "First Seen" ) ); 68 addColumn( tr( "First Seen" ) );
69 setColumnAlignment( 7, AlignCenter ); 69 setColumnAlignment( 7, AlignCenter );
70 addColumn( tr( "Last Seen" ) ); 70 addColumn( tr( "Last Seen" ) );
@@ -139,46 +139,47 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
139 { 139 {
140 // we have already seen this item, it's a dupe 140 // we have already seen this item, it's a dupe
141 #ifdef DEBUG 141 #ifdef DEBUG
142 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); 142 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
143 #endif 143 #endif
144 item->receivedBeacon(); 144 item->receivedBeacon();
145 return; 145 return;
146 } 146 }
147 } 147 }
148 else 148 else
149 { 149 {
150 s.sprintf( "(i) new network: '%s'", (const char*) essid ); 150 s.sprintf( "(i) new network: '%s'", (const char*) essid );
151 //TODO send s to logwindow
151 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); 152 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 );
152 } 153 }
153 154
154 155
155 // insert new station as child from network 156 // insert new station as child from network
156
157 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 157 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
158 158
159 qDebug( "inserting new station %s", (const char*) macaddr ); 159 qDebug( "inserting new station %s", (const char*) macaddr );
160 160
161 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 161 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
162 if ( _manufacturerdb ) 162 if ( _manufacturerdb )
163 station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); 163 station->setManufacturer( _manufacturerdb->lookup( macaddr ) );
164 164
165 if ( type == "managed" ) 165 if ( type == "managed" )
166 { 166 {
167 s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); 167 s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel );
168 } 168 }
169 else 169 else
170 { 170 {
171 s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); 171 s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel );
172 } 172 }
173 //TODO send s to logwindow
173 174
174} 175}
175 176
176 177
177void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, const QString& type ) 178void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, const QString& type )
178{ 179{
179 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); 180 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
180 181
181 while ( subitem && ( subitem->text( col_ap ) != addr ) ) 182 while ( subitem && ( subitem->text( col_ap ) != addr ) )
182 { 183 {
183 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); 184 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) );
184 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 185 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
@@ -189,24 +190,35 @@ void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, cons
189 // we have already seen this item, it's a dupe 190 // we have already seen this item, it's a dupe
190 #ifdef DEBUG 191 #ifdef DEBUG
191 qDebug( "%s is a dupe - ignoring...", (const char*) addr ); 192 qDebug( "%s is a dupe - ignoring...", (const char*) addr );
192 #endif 193 #endif
193 subitem->receivedBeacon(); //FIXME: sent data bit 194 subitem->receivedBeacon(); //FIXME: sent data bit
194 return; 195 return;
195 } 196 }
196 197
197 // Hey, it seems to be a new item :-D 198 // Hey, it seems to be a new item :-D
198 MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr, false, -1, -1 ); 199 MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr, false, -1, -1 );
199 if ( _manufacturerdb ) 200 if ( _manufacturerdb )
200 station->setManufacturer( _manufacturerdb->lookup( addr ) ); 201 station->setManufacturer( _manufacturerdb->lookup( addr ) );
202
203 QString s;
204 if ( type == "station" )
205 {
206 s.sprintf( "(i) new station in '%s' [??]", (const char*) network->text( col_essid ) );
207 }
208 else
209 {
210 s.sprintf( "(i) new wireless station in '%s' [??]", (const char*) network->text( col_essid ) );
211 }
212 //TODO send s to logwindow
201} 213}
202 214
203 215
204void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ) 216void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo )
205{ 217{
206 QString s; 218 QString s;
207 MScanListItem* network; 219 MScanListItem* network;
208 220
209 QListViewItemIterator it( this ); 221 QListViewItemIterator it( this );
210 while ( it.current() && 222 while ( it.current() &&
211 it.current()->text( col_ap ) != viaFrom && 223 it.current()->text( col_ap ) != viaFrom &&
212 it.current()->text( col_ap ) != viaTo ) ++it; 224 it.current()->text( col_ap ) != viaTo ) ++it;