Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 245290d..9d6ed6a 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -330,24 +330,72 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | |||
330 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) | 330 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) |
331 | { | 331 | { |
332 | it.current()->setText( col_ip, ip ); | 332 | it.current()->setText( col_ip, ip ); |
333 | return; | 333 | return; |
334 | } | 334 | } |
335 | } | 335 | } |
336 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | 336 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); |
337 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", | 337 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", |
338 | (const char*) macaddr.toString(), (const char*) ip ) ); | 338 | (const char*) macaddr.toString(), (const char*) ip ) ); |
339 | } | 339 | } |
340 | 340 | ||
341 | 341 | ||
342 | void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) | ||
343 | { | ||
344 | qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); | ||
345 | |||
346 | //TODO: Refactor that out, we need it all over the place. | ||
347 | // Best to do it in a more comfortable abstraction in OListView | ||
348 | // (Hmm, didn't I already start something in this direction?) | ||
349 | |||
350 | QListViewItemIterator it( this ); | ||
351 | for ( ; it.current(); ++it ) | ||
352 | { | ||
353 | if ( it.current()->text( col_ap ) == macaddr.toString(true) ) | ||
354 | { | ||
355 | |||
356 | MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); | ||
357 | |||
358 | while ( subitem && ( subitem->text( col_essid ) != name ) ) | ||
359 | { | ||
360 | #ifdef DEBUG | ||
361 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); | ||
362 | #endif | ||
363 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | ||
364 | } | ||
365 | |||
366 | if ( subitem ) | ||
367 | { | ||
368 | // we have already seen this item, it's a dupe | ||
369 | #ifdef DEBUG | ||
370 | qDebug( "%s is a dupe - ignoring...", (const char*) name ); | ||
371 | #endif | ||
372 | subitem->receivedBeacon(); //FIXME: sent data bit | ||
373 | return; | ||
374 | } | ||
375 | |||
376 | // never seen that - add new item | ||
377 | |||
378 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", false, -1, -1 ); | ||
379 | item->setText( col_essid, name ); | ||
380 | |||
381 | return; | ||
382 | } | ||
383 | } | ||
384 | qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); | ||
385 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", | ||
386 | (const char*) macaddr.toString(), (const char*) ip ) ); | ||
387 | } | ||
388 | |||
389 | |||
342 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | 390 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) |
343 | { | 391 | { |
344 | if ( !item ) return; | 392 | if ( !item ) return; |
345 | 393 | ||
346 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | 394 | MScanListItem* itm = static_cast<MScanListItem*>( item ); |
347 | 395 | ||
348 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", | 396 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", |
349 | (const char*) itm->text(0), (const char*) itm->type, col ); | 397 | (const char*) itm->text(0), (const char*) itm->type, col ); |
350 | 398 | ||
351 | if ( itm->type == "adhoc" || itm->type == "managed" ) | 399 | if ( itm->type == "adhoc" || itm->type == "managed" ) |
352 | { | 400 | { |
353 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); | 401 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); |