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 | |||
@@ -340,4 +340,52 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | |||
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 | { |