summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/scanlist.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp77
1 files changed, 38 insertions, 39 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 3b7120a..a2be782 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -17,21 +17,26 @@
17#include "configwindow.h" 17#include "configwindow.h"
18#include "logwindow.h" 18#include "logwindow.h"
19 19
20#include <assert.h> 20/* OPIE */
21#include <qcursor.h>
22#include <qdatetime.h>
23#include <qpopupmenu.h>
24#include <qcheckbox.h>
25
26#ifdef QWS 21#ifdef QWS
22#include <opie2/odebug.h>
27#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
28#endif
29
30#ifdef QWS
31#include <qpe/resource.h> 24#include <qpe/resource.h>
32#else 25#else
33#include "resource.h" 26#include "resource.h"
34#endif 27#endif
28using namespace Opie::Core;
29using namespace Opie::Ui;
30using namespace Opie::Net;
31
32/* QT */
33#include <qcursor.h>
34#include <qdatetime.h>
35#include <qpopupmenu.h>
36#include <qcheckbox.h>
37
38/* STD */
39#include <assert.h>
35 40
36const int col_type = 0; 41const int col_type = 0;
37const int col_essid = 0; 42const int col_essid = 0;
@@ -46,12 +51,6 @@ const int col_firstseen = 8;
46const int col_lastseen = 9; 51const int col_lastseen = 9;
47const int col_location = 10; 52const int col_location = 10;
48 53
49using namespace Opie::Net;
50using namespace Opie::Ui;
51using namespace Opie::Net;
52using namespace Opie::Ui;
53using namespace Opie::Ui;
54using namespace Opie::Net;
55MScanListView::MScanListView( QWidget* parent, const char* name ) 54MScanListView::MScanListView( QWidget* parent, const char* name )
56 :OListView( parent, name ) 55 :OListView( parent, name )
57{ 56{
@@ -106,14 +105,14 @@ OListViewItem* MScanListView::childFactory()
106 105
107void MScanListView::serializeTo( QDataStream& s) const 106void MScanListView::serializeTo( QDataStream& s) const
108{ 107{
109 qDebug( "serializing MScanListView" ); 108 odebug << "serializing MScanListView" << oendl;
110 OListView::serializeTo( s ); 109 OListView::serializeTo( s );
111} 110}
112 111
113 112
114void MScanListView::serializeFrom( QDataStream& s) 113void MScanListView::serializeFrom( QDataStream& s)
115{ 114{
116 qDebug( "serializing MScanListView" ); 115 odebug << "serializing MScanListView" << oendl;
117 OListView::serializeFrom( s ); 116 OListView::serializeFrom( s );
118} 117}
119 118
@@ -143,7 +142,7 @@ void MScanListView::addNewItem( const QString& type,
143 while ( item && ( item->text( col_essid ) != essid ) ) 142 while ( item && ( item->text( col_essid ) != essid ) )
144 { 143 {
145 #ifdef DEBUG 144 #ifdef DEBUG
146 qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); 145 odebug << "itemtext: " << (const char*) item->text( col_essid ) << "" << oendl;
147 #endif 146 #endif
148 item = static_cast<MScanListItem*> ( item->nextSibling() ); 147 item = static_cast<MScanListItem*> ( item->nextSibling() );
149 } 148 }
@@ -159,7 +158,7 @@ void MScanListView::addNewItem( const QString& type,
159 while ( item && ( item->text( col_ap ) != macaddr ) ) 158 while ( item && ( item->text( col_ap ) != macaddr ) )
160 { 159 {
161 #ifdef DEBUG 160 #ifdef DEBUG
162 qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); 161 odebug << "subitemtext: " << (const char*) item->text( col_ap ) << "" << oendl;
163 #endif 162 #endif
164 item = static_cast<MScanListItem*> ( item->nextSibling() ); 163 item = static_cast<MScanListItem*> ( item->nextSibling() );
165 } 164 }
@@ -168,7 +167,7 @@ void MScanListView::addNewItem( const QString& type,
168 { 167 {
169 // we have already seen this item, it's a dupe 168 // we have already seen this item, it's a dupe
170 #ifdef DEBUG 169 #ifdef DEBUG
171 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); 170 odebug << "" << (const char*) macaddr << " is a dupe - ignoring..." << oendl;
172 #endif 171 #endif
173 item->receivedBeacon(); 172 item->receivedBeacon();
174 return; 173 return;
@@ -186,7 +185,7 @@ void MScanListView::addNewItem( const QString& type,
186 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 185 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
187 186
188 #ifdef DEBUG 187 #ifdef DEBUG
189 qDebug( "inserting new station %s", (const char*) macaddr ); 188 odebug << "inserting new station " << (const char*) macaddr << "" << oendl;
190 #endif 189 #endif
191 190
192 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 191 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
@@ -212,7 +211,7 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress&
212 while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) 211 while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) )
213 { 212 {
214 #ifdef DEBUG 213 #ifdef DEBUG
215 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); 214 odebug << "subitemtext: " << (const char*) subitem->text( col_ap ) << "" << oendl;
216 #endif 215 #endif
217 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 216 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
218 } 217 }
@@ -221,7 +220,7 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress&
221 { 220 {
222 // we have already seen this item, it's a dupe 221 // we have already seen this item, it's a dupe
223 #ifdef DEBUG 222 #ifdef DEBUG
224 qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); 223 odebug << "" << (const char*) addr.toString(true) << " is a dupe - ignoring..." << oendl;
225 #endif 224 #endif
226 subitem->receivedBeacon(); //FIXME: sent data bit 225 subitem->receivedBeacon(); //FIXME: sent data bit
227 return; 226 return;
@@ -246,7 +245,7 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress&
246 245
247void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) 246void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo )
248{ 247{
249 qDebug( "WDSTraffic: %s and %s seem to form a WDS", (const char*) viaFrom.toString(), (const char*) viaTo.toString() ); 248 odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << (const char*) viaTo.toString() << " seem to form a WDS" << oendl;
250 QString s; 249 QString s;
251 MScanListItem* network; 250 MScanListItem* network;
252 251
@@ -264,7 +263,7 @@ void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to,
264 } 263 }
265 else 264 else
266 { 265 {
267 qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); 266 odebug << "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" << oendl;
268 MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); 267 MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" );
269 } 268 }
270} 269}
@@ -286,7 +285,7 @@ void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to,
286 } 285 }
287 else 286 else
288 { 287 {
289 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); 288 odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl;
290 MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); 289 MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" );
291 290
292 } 291 }
@@ -309,7 +308,7 @@ void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& t
309 } 308 }
310 else 309 else
311 { 310 {
312 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); 311 odebug << "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" << oendl;
313 MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); 312 MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" );
314 } 313 }
315} 314}
@@ -317,14 +316,14 @@ void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& t
317 316
318void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 317void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
319{ 318{
320 qWarning( "D'oh! Not yet implemented..." ); 319 owarn << "D'oh! Not yet implemented..." << oendl;
321 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); 320 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" );
322} 321}
323 322
324 323
325void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) 324void MScanListView::identify( const OMacAddress& macaddr, const QString& ip )
326{ 325{
327 qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); 326 odebug << "identify " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl;
328 327
329 QListViewItemIterator it( this ); 328 QListViewItemIterator it( this );
330 for ( ; it.current(); ++it ) 329 for ( ; it.current(); ++it )
@@ -335,7 +334,7 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip )
335 return; 334 return;
336 } 335 }
337 } 336 }
338 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); 337 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
339 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", 338 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!",
340 (const char*) macaddr.toString(), (const char*) ip ) ); 339 (const char*) macaddr.toString(), (const char*) ip ) );
341} 340}
@@ -343,7 +342,7 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip )
343 342
344void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) 343void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip )
345{ 344{
346 qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); 345 odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << (const char*) ip << "" << oendl;
347 346
348 //TODO: Refactor that out, we need it all over the place. 347 //TODO: Refactor that out, we need it all over the place.
349 // Best to do it in a more comfortable abstraction in OListView 348 // Best to do it in a more comfortable abstraction in OListView
@@ -360,7 +359,7 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr,
360 while ( subitem && ( subitem->text( col_essid ) != name ) ) 359 while ( subitem && ( subitem->text( col_essid ) != name ) )
361 { 360 {
362 #ifdef DEBUG 361 #ifdef DEBUG
363 qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); 362 odebug << "subitemtext: " << (const char*) subitem->text( col_essid ) << "" << oendl;
364 #endif 363 #endif
365 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 364 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
366 } 365 }
@@ -369,7 +368,7 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr,
369 { 368 {
370 // we have already seen this item, it's a dupe 369 // we have already seen this item, it's a dupe
371 #ifdef DEBUG 370 #ifdef DEBUG
372 qDebug( "%s is a dupe - ignoring...", (const char*) name ); 371 odebug << "" << (const char*) name << " is a dupe - ignoring..." << oendl;
373 #endif 372 #endif
374 subitem->receivedBeacon(); //FIXME: sent data bit 373 subitem->receivedBeacon(); //FIXME: sent data bit
375 return; 374 return;
@@ -383,7 +382,7 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr,
383 return; 382 return;
384 } 383 }
385 } 384 }
386 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); 385 odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl;
387 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", 386 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!",
388 (const char*) macaddr.toString(), (const char*) ip ) ); 387 (const char*) macaddr.toString(), (const char*) ip ) );
389} 388}
@@ -421,7 +420,7 @@ MScanListItem::MScanListItem( QListView* parent, const QString& type, const QStr
421 _channel( channel ), _signal( signal ), _beacons( 1 ) 420 _channel( channel ), _signal( signal ), _beacons( 1 )
422{ 421{
423 #ifdef DEBUG 422 #ifdef DEBUG
424 qDebug( "creating scanlist item" ); 423 odebug << "creating scanlist item" << oendl;
425 #endif 424 #endif
426 425
427 if ( WellenreiterConfigWindow::instance() ) 426 if ( WellenreiterConfigWindow::instance() )
@@ -435,7 +434,7 @@ MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const
435 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 434 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
436{ 435{
437 #ifdef DEBUG 436 #ifdef DEBUG
438 qDebug( "creating scanlist item" ); 437 odebug << "creating scanlist item" << oendl;
439 #endif 438 #endif
440 if ( WellenreiterConfigWindow::instance() ) 439 if ( WellenreiterConfigWindow::instance() )
441 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here 440 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
@@ -459,7 +458,7 @@ OListViewItem* MScanListItem::childFactory()
459void MScanListItem::serializeTo( QDataStream& s ) const 458void MScanListItem::serializeTo( QDataStream& s ) const
460{ 459{
461 #ifdef DEBUG 460 #ifdef DEBUG
462 qDebug( "serializing MScanListItem" ); 461 odebug << "serializing MScanListItem" << oendl;
463 #endif 462 #endif
464 OListViewItem::serializeTo( s ); 463 OListViewItem::serializeTo( s );
465 464
@@ -470,7 +469,7 @@ void MScanListItem::serializeTo( QDataStream& s ) const
470void MScanListItem::serializeFrom( QDataStream& s ) 469void MScanListItem::serializeFrom( QDataStream& s )
471{ 470{
472 #ifdef DEBUG 471 #ifdef DEBUG
473 qDebug( "serializing MScanListItem" ); 472 odebug << "serializing MScanListItem" << oendl;
474 #endif 473 #endif
475 OListViewItem::serializeFrom( s ); 474 OListViewItem::serializeFrom( s );
476 475
@@ -556,7 +555,7 @@ void MScanListItem::receivedBeacon()
556{ 555{
557 _beacons++; 556 _beacons++;
558 #ifdef DEBUG 557 #ifdef DEBUG
559 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); 558 odebug << "MScanListItem " << (const char*) _macaddr << ": received beacon #" << _beacons << "" << oendl;
560 #endif 559 #endif
561 setText( col_sig, QString::number( _beacons ) ); 560 setText( col_sig, QString::number( _beacons ) );
562 setText( col_lastseen, QTime::currentTime().toString() ); 561 setText( col_lastseen, QTime::currentTime().toString() );