Diffstat (limited to 'noncore/net/opietooth/manager') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 40 |
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 | |||
@@ -446,65 +446,91 @@ void BlueBase::addSignalStrength() { | |||
446 | void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) { | 446 | void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) { |
447 | 447 | ||
448 | QListViewItemIterator it( ListView4 ); | 448 | QListViewItemIterator it( ListView4 ); |
449 | for ( ; it.current(); ++it ) { | 449 | for ( ; it.current(); ++it ) { |
450 | if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) { | 450 | if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) { |
451 | ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); | 451 | ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); |
452 | } | 452 | } |
453 | } | 453 | } |
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 | */ |
460 | void BlueBase::addConnectedDevices() { | 460 | void 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 | */ |
468 | void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { | 468 | void 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 | */ |
501 | void BlueBase::deviceActive( const RemoteDevice &device ) { | 527 | void BlueBase::deviceActive( const RemoteDevice &device ) { |
502 | // search by mac, async, gets a signal back | 528 | // search by mac, async, gets a signal back |
503 | // We should have a BTDeviceItem there or where does it get added to the map -zecke | 529 | // We should have a BTDeviceItem there or where does it get added to the map -zecke |
504 | m_localDevice->isAvailable( device.mac() ); | 530 | m_localDevice->isAvailable( device.mac() ); |
505 | } | 531 | } |
506 | 532 | ||
507 | 533 | ||
508 | /** | 534 | /** |
509 | * The signal catcher. Set the avail. status on device. | 535 | * The signal catcher. Set the avail. status on device. |
510 | * @param device - the mac address | 536 | * @param device - the mac address |