summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp40
1 files changed, 33 insertions, 7 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 9663b52..b5a09e5 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -454,49 +454,75 @@ void BlueBase::addSignalStrength( const QString& mac, const QString& strength )
454} 454}
455 455
456/** 456/**
457 * Add the existing connections (pairs) to the connections tab. 457 * Add the existing connections (pairs) to the connections tab.
458 * This one triggers the search 458 * This one triggers the search
459 */ 459 */
460void BlueBase::addConnectedDevices() { 460void BlueBase::addConnectedDevices() {
461 m_localDevice->searchConnections(); 461 m_localDevice->searchConnections();
462} 462}
463 463
464/** 464/**
465 * This adds the found connections to the connection tab. 465 * This adds the found connections to the connection tab.
466 * @param connectionList the ValueList with all current connections 466 * @param connectionList the ValueList with all current connections
467 */ 467 */
468void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { 468void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) {
469 469
470 // clear the ListView first
471 ListView4->clear();
472
473 QValueList<OpieTooth::ConnectionState>::Iterator it; 470 QValueList<OpieTooth::ConnectionState>::Iterator it;
474 BTConnectionItem * connectionItem; 471 BTConnectionItem * connectionItem;
475 472
476 if ( !connectionList.isEmpty() ) { 473 if ( !connectionList.isEmpty() ) {
477 474
478 for (it = connectionList.begin(); it != connectionList.end(); ++it) { 475 for (it = connectionList.begin(); it != connectionList.end(); ++it) {
479 connectionItem = new BTConnectionItem( ListView4, (*it) );
480 476
481 if( m_deviceList.find((*it).mac()).data() ) { 477 QListViewItemIterator it2( ListView4 );
478 bool found = false;
479 for ( ; it2.current(); ++it2 ) {
480 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) {
481 found = true;
482 }
483 }
484
485 if ( found == false ) {
486 connectionItem = new BTConnectionItem( ListView4, (*it) );
487
488 if( m_deviceList.find((*it).mac()).data() ) {
489 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() );
490 }
491 }
482 492
483 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() );
484 }
485 } 493 }
494
495 QListViewItemIterator it2( ListView4 );
496 for ( ; it2.current(); ++it2 ) {
497 bool found = false;
498 for (it = connectionList.begin(); it != connectionList.end(); ++it) {
499 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) {
500 found = true;
501 }
502 }
503
504 if ( !found ) {
505 delete it2.current();
506 }
507
508 }
509
510
486 } else { 511 } else {
512 ListView4->clear();
487 ConnectionState con; 513 ConnectionState con;
488 con.setMac( tr("No connections found") ); 514 con.setMac( tr("No connections found") );
489 connectionItem = new BTConnectionItem( ListView4 , con ); 515 connectionItem = new BTConnectionItem( ListView4 , con );
490 } 516 }
491 517
492 // recall connection search after some time 518 // recall connection search after some time
493 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); 519 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) );
494} 520}
495 521
496 522
497/** 523/**
498 * Find out if a device can currently be reached 524 * Find out if a device can currently be reached
499 * @param device 525 * @param device
500 */ 526 */
501void BlueBase::deviceActive( const RemoteDevice &device ) { 527void BlueBase::deviceActive( const RemoteDevice &device ) {
502 // search by mac, async, gets a signal back 528 // search by mac, async, gets a signal back