summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-07 23:58:45 (UTC)
committer harlekin <harlekin>2003-03-07 23:58:45 (UTC)
commit3e92beca986b9fecd8193f55513ea1ecd2cd0866 (patch) (unidiff)
tree651a9a6fe0f35c18baea5d793425e03d12e70104
parente2f480bc22863bf803259e98b1c62933af20b48f (diff)
downloadopie-3e92beca986b9fecd8193f55513ea1ecd2cd0866.zip
opie-3e92beca986b9fecd8193f55513ea1ecd2cd0866.tar.gz
opie-3e92beca986b9fecd8193f55513ea1ecd2cd0866.tar.bz2
nicer refresh handling for connections
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
@@ -464,29 +464,55 @@ void BlueBase::addConnectedDevices() {
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