author | harlekin <harlekin> | 2003-03-07 23:58:45 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-07 23:58:45 (UTC) |
commit | 3e92beca986b9fecd8193f55513ea1ecd2cd0866 (patch) (side-by-side diff) | |
tree | 651a9a6fe0f35c18baea5d793425e03d12e70104 | |
parent | e2f480bc22863bf803259e98b1c62933af20b48f (diff) | |
download | opie-3e92beca986b9fecd8193f55513ea1ecd2cd0866.zip opie-3e92beca986b9fecd8193f55513ea1ecd2cd0866.tar.gz opie-3e92beca986b9fecd8193f55513ea1ecd2cd0866.tar.bz2 |
nicer refresh handling for connections
-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 @@ -467,23 +467,49 @@ void BlueBase::addConnectedDevices() { */ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { - // clear the ListView first - ListView4->clear(); - QValueList<OpieTooth::ConnectionState>::Iterator it; BTConnectionItem * connectionItem; if ( !connectionList.isEmpty() ) { for (it = connectionList.begin(); it != connectionList.end(); ++it) { - connectionItem = new BTConnectionItem( ListView4, (*it) ); - if( m_deviceList.find((*it).mac()).data() ) { + QListViewItemIterator it2( ListView4 ); + bool found = false; + for ( ; it2.current(); ++it2 ) { + if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) { + found = true; + } + } + + if ( found == false ) { + connectionItem = new BTConnectionItem( ListView4, (*it) ); + + if( m_deviceList.find((*it).mac()).data() ) { + connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); + } + } - connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); - } } + + QListViewItemIterator it2( ListView4 ); + for ( ; it2.current(); ++it2 ) { + bool found = false; + for (it = connectionList.begin(); it != connectionList.end(); ++it) { + if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) { + found = true; + } + } + + if ( !found ) { + delete it2.current(); + } + + } + + } else { + ListView4->clear(); ConnectionState con; con.setMac( tr("No connections found") ); connectionItem = new BTConnectionItem( ListView4 , con ); |