Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 9e907d8..fa1d724 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -26,7 +26,5 @@ | |||
26 | #include "resource.h" | 26 | #include "resource.h" |
27 | #endif | 27 | #endif |
28 | using namespace Opie::Core; | 28 | |
29 | using namespace Opie::Ui; | ||
30 | using namespace Opie::Net; | ||
31 | 29 | ||
32 | /* QT */ | 30 | /* QT */ |
@@ -39,4 +37,8 @@ using namespace Opie::Net; | |||
39 | #include <assert.h> | 37 | #include <assert.h> |
40 | 38 | ||
39 | using namespace Opie::Core; | ||
40 | using namespace Opie::Ui; | ||
41 | using namespace Opie::Net; | ||
42 | |||
41 | const int col_type = 0; | 43 | const int col_type = 0; |
42 | const int col_essid = 0; | 44 | const int col_essid = 0; |
@@ -52,4 +54,6 @@ const int col_lastseen = 9; | |||
52 | const int col_location = 10; | 54 | const int col_location = 10; |
53 | 55 | ||
56 | #define DEBUG | ||
57 | |||
54 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 58 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
55 | :OListView( parent, name ) | 59 | :OListView( parent, name ) |
@@ -177,5 +181,5 @@ void MScanListView::addNewItem( const QString& type, | |||
177 | else | 181 | else |
178 | { | 182 | { |
179 | s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); | 183 | s = QString( "(i) New network: ESSID '%1'" ).arg( essid ); |
180 | MLogWindow::logwindow()->log( s ); | 184 | MLogWindow::logwindow()->log( s ); |
181 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); | 185 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); |
@@ -196,9 +200,9 @@ void MScanListView::addNewItem( const QString& type, | |||
196 | if ( type == "managed" ) | 200 | if ( type == "managed" ) |
197 | { | 201 | { |
198 | s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); | 202 | s = QString( "(i) New Access Point in '%1' [%2]" ).arg( essid ).arg( channel ); |
199 | } | 203 | } |
200 | else | 204 | else |
201 | { | 205 | { |
202 | s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); | 206 | s = QString( "(i) New AdHoc station in '%1' [%2]" ).arg( essid ).arg( channel ); |
203 | } | 207 | } |
204 | MLogWindow::logwindow()->log( s ); | 208 | MLogWindow::logwindow()->log( s ); |
@@ -235,9 +239,9 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& | |||
235 | if ( type == "station" ) | 239 | if ( type == "station" ) |
236 | { | 240 | { |
237 | s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 241 | s = QString( "(i) New Station in '%1' [xx]" ).arg( network->text( col_essid ) ); |
238 | } | 242 | } |
239 | else | 243 | else |
240 | { | 244 | { |
241 | s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); | 245 | s = QString( "(i) New Wireless Station in '%1' [xx]" ).arg( network->text( col_essid ) ); |
242 | } | 246 | } |
243 | MLogWindow::logwindow()->log( s ); | 247 | MLogWindow::logwindow()->log( s ); |
@@ -247,7 +251,7 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& | |||
247 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) | 251 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) |
248 | { | 252 | { |
249 | odebug << "WDSTraffic: " << (const char*) viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl; | 253 | odebug << "WDSTraffic: " << viaFrom.toString() << " and " << viaTo.toString() << " seem to form a WDS" << oendl; |
250 | QString s; | 254 | QString s; |
251 | MScanListItem* network; | 255 | // MScanListItem* network; |
252 | 256 | ||
253 | QListViewItemIterator it( this ); | 257 | QListViewItemIterator it( this ); |
@@ -271,8 +275,8 @@ void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, | |||
271 | 275 | ||
272 | 276 | ||
273 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 277 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& /*to*/, const OMacAddress& via ) |
274 | { | 278 | { |
275 | QString s; | 279 | QString s; |
276 | MScanListItem* network; | 280 | // MScanListItem* network; |
277 | 281 | ||
278 | QListViewItemIterator it( this ); | 282 | QListViewItemIterator it( this ); |
@@ -294,8 +298,8 @@ void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, | |||
294 | 298 | ||
295 | 299 | ||
296 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 300 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& /*to*/, const OMacAddress& via ) |
297 | { | 301 | { |
298 | QString s; | 302 | QString s; |
299 | MScanListItem* network; | 303 | // MScanListItem* network; |
300 | 304 | ||
301 | QListViewItemIterator it( this ); | 305 | QListViewItemIterator it( this ); |
@@ -316,5 +320,5 @@ void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& t | |||
316 | 320 | ||
317 | 321 | ||
318 | void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 322 | void MScanListView::IBSStraffic( const OMacAddress& /*from*/, const OMacAddress& /*to*/, const OMacAddress& /*via*/ ) |
319 | { | 323 | { |
320 | owarn << "D'oh! Not yet implemented..." << oendl; | 324 | owarn << "D'oh! Not yet implemented..." << oendl; |
@@ -325,5 +329,5 @@ void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, | |||
325 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | 329 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) |
326 | { | 330 | { |
327 | odebug << "identify " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; | 331 | odebug << "identify " << macaddr.toString() << " = " << ip << "" << oendl; |
328 | 332 | ||
329 | QListViewItemIterator it( this ); | 333 | QListViewItemIterator it( this ); |
@@ -337,6 +341,6 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | |||
337 | } | 341 | } |
338 | odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; | 342 | 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!", | 343 | MLogWindow::logwindow()->log( QString( "WARNING: Unhandled identification %1 = %2!" ) |
340 | (const char*) macaddr.toString(), (const char*) ip ) ); | 344 | .arg( macaddr.toString() ).arg( ip ) ); |
341 | } | 345 | } |
342 | 346 | ||
@@ -344,5 +348,5 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | |||
344 | void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) | 348 | void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) |
345 | { | 349 | { |
346 | odebug << "addService '" << (const char*) name << "', Server = " << (const char*) macaddr.toString() << " = " << ip << "" << oendl; | 350 | odebug << "addService '" << name << "', Server = " << macaddr.toString() << " = " << ip << "" << oendl; |
347 | 351 | ||
348 | //TODO: Refactor that out, we need it all over the place. | 352 | //TODO: Refactor that out, we need it all over the place. |
@@ -385,6 +389,6 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr, | |||
385 | } | 389 | } |
386 | odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; | 390 | 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!", | 391 | MLogWindow::logwindow()->log( QString("WARNING: Unhandled service addition %s = %s!") |
388 | (const char*) macaddr.toString(), (const char*) ip ) ); | 392 | .arg( macaddr.toString() ).arg( ip ) ); |
389 | } | 393 | } |
390 | 394 | ||
@@ -396,10 +400,10 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in | |||
396 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | 400 | MScanListItem* itm = static_cast<MScanListItem*>( item ); |
397 | 401 | ||
398 | odebug << "contextMenuRequested on item '" << (const char*) itm->text(0) << "' (" | 402 | odebug << "contextMenuRequested on item '" << itm->text(0) << "' (" |
399 | << (const char*) itm->type << ") in column: '" << col << "'" << oendl; | 403 | << itm->type << ") in column: '" << col << "'" << oendl; |
400 | 404 | ||
401 | if ( itm->type == "adhoc" || itm->type == "managed" ) | 405 | if ( itm->type == "adhoc" || itm->type == "managed" ) |
402 | { | 406 | { |
403 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); | 407 | QString entry = QString( "&Join %1 Net '%2'..." ).arg( itm->type ).arg( itm->essid() ); |
404 | 408 | ||
405 | QPopupMenu m( this ); | 409 | QPopupMenu m( this ); |
@@ -480,6 +484,5 @@ void MScanListItem::serializeFrom( QDataStream& s ) | |||
480 | _wep = (wep == 'y'); | 484 | _wep = (wep == 'y'); |
481 | 485 | ||
482 | QString name; | 486 | QString name = QString( "wellenreiter/"+ _type ); |
483 | name.sprintf( "wellenreiter/%s", (const char*) _type ); | ||
484 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 487 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
485 | if ( _wep ) | 488 | if ( _wep ) |
@@ -491,6 +494,6 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, | |||
491 | { | 494 | { |
492 | #ifdef DEBUG | 495 | #ifdef DEBUG |
493 | odebug << "decorating scanlist item " << (const char*) type << " / " | 496 | odebug << "decorating scanlist item " << type << " / " |
494 | << (const char*) essid << " / " << (const char*) macaddr | 497 | << essid << " / " << macaddr |
495 | << "[" << channel << "]" << oendl; | 498 | << "[" << channel << "]" << oendl; |
496 | #endif | 499 | #endif |
@@ -498,5 +501,5 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, | |||
498 | // set icon for managed or adhoc mode | 501 | // set icon for managed or adhoc mode |
499 | QString name; | 502 | QString name; |
500 | name.sprintf( "wellenreiter/%s", (const char*) type ); | 503 | name.sprintf( "wellenreiter/"+ type ); |
501 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 504 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
502 | 505 | ||