author | harlekin <harlekin> | 2003-03-06 23:17:10 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-06 23:17:10 (UTC) |
commit | 78a2773ef477a4ab7327350e5f1f6c07428ad8a4 (patch) (side-by-side diff) | |
tree | d93e516530f66c0b15260c283d21481e92cfeb18 | |
parent | 94a385f5f6868e930361dc8d25d3e87eacd20feb (diff) | |
download | opie-78a2773ef477a4ab7327350e5f1f6c07428ad8a4.zip opie-78a2773ef477a4ab7327350e5f1f6c07428ad8a4.tar.gz opie-78a2773ef477a4ab7327350e5f1f6c07428ad8a4.tar.bz2 |
remove previous found services on rescan
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 5c5f069..8b15c4f 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -38,16 +38,17 @@ #include <qvbox.h> #include <qmessagebox.h> #include <qcheckbox.h> #include <qlineedit.h> #include <qlistview.h> #include <qdir.h> #include <qpopupmenu.h> #include <qtimer.h> +#include <qlist.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> using namespace OpieTooth; @@ -380,19 +381,30 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s BTDeviceItem* deviceItem = 0; // get the right devices which requested the search it = m_deviceList.find( device ); if( it == m_deviceList.end() ) return; deviceItem = it.data(); + // remove previous entries + QList<QListViewItem> tempList; + tempList.setAutoDelete( true ); + QListViewItem * child = deviceItem->firstChild(); + while( child ) { + tempList.append( child ); + child = child->nextSibling(); + } + tempList.clear(); + QValueList<OpieTooth::Services>::Iterator it2; BTServiceItem * serviceItem; + if (!servicesList.isEmpty() ) { // add services QMap<int, QString> list; QMap<int, QString>::Iterator classIt; for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { serviceItem = new BTServiceItem( deviceItem , (*it2) ); list = (*it2).classIdList(); classIt = list.begin(); @@ -400,17 +412,17 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s if ( classIt != list.end() ) { classId = classIt.key(); } serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); } } else { Services s1; - s1.setServiceName( tr("no serives found") ); + s1.setServiceName( tr("no services found") ); serviceItem = new BTServiceItem( deviceItem, s1 ); } // now remove them from the list m_deviceList.remove( it ); } /** @@ -441,17 +453,17 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) } } else { ConnectionState con; con.setMac( tr("No connections found") ); connectionItem = new BTConnectionItem( ListView4 , con ); } // recall connection search after some time - QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) ); + QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); } /** * Find out if a device can currently be reached * @param device */ void BlueBase::deviceActive( const RemoteDevice &device ) { |