author | harlekin <harlekin> | 2002-07-20 20:45:08 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-20 20:45:08 (UTC) |
commit | 0f24c1fb86d3bb58d8696358b824c0e01752b10d (patch) (unidiff) | |
tree | 646c57bf8f5b903cd951aac9287c7703d0af4d4d | |
parent | f095be190be0bcacd7911c585d034fd031e16099 (diff) | |
download | opie-0f24c1fb86d3bb58d8696358b824c0e01752b10d.zip opie-0f24c1fb86d3bb58d8696358b824c0e01752b10d.tar.gz opie-0f24c1fb86d3bb58d8696358b824c0e01752b10d.tar.bz2 |
little update
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index d2854a1..af64663 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -271,64 +271,70 @@ void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) | |||
271 | } | 271 | } |
272 | 272 | ||
273 | 273 | ||
274 | /** | 274 | /** |
275 | * Action that is toggled on entrys on click | 275 | * Action that is toggled on entrys on click |
276 | */ | 276 | */ |
277 | void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { | 277 | void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { |
278 | } | 278 | } |
279 | 279 | ||
280 | 280 | ||
281 | /** | 281 | /** |
282 | * Action that are toggled on hold (mostly QPopups i guess) | 282 | * Action that are toggled on hold (mostly QPopups i guess) |
283 | */ | 283 | */ |
284 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { | 284 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { |
285 | 285 | ||
286 | QPopupMenu *menu = new QPopupMenu(); | 286 | QPopupMenu *menu = new QPopupMenu(); |
287 | int ret=0; | 287 | int ret=0; |
288 | 288 | ||
289 | if ( ((BTListItem*)item)->type() == "device") { | 289 | if ( ((BTListItem*)item)->type() == "device") { |
290 | 290 | ||
291 | QPopupMenu *groups = new QPopupMenu(); | 291 | QPopupMenu *groups = new QPopupMenu(); |
292 | 292 | ||
293 | menu->insertItem( tr("rescan sevices:"), 0); | 293 | menu->insertItem( tr("rescan sevices:"), 0); |
294 | menu->insertItem( tr("to group"), groups , 1); | 294 | menu->insertItem( tr("to group"), groups , 1); |
295 | menu->insertItem( tr("bound device"), 2); | 295 | // menu->insertItem( tr("bound device"), 2); |
296 | menu->insertItem( tr("delete"), 3); | 296 | menu->insertItem( tr("delete"), 3); |
297 | 297 | ||
298 | ret = menu->exec( point , 0); | 298 | ret = menu->exec( point , 0); |
299 | 299 | ||
300 | switch(ret) { | 300 | switch(ret) { |
301 | case -1: | 301 | case -1: |
302 | 302 | break; | |
303 | case 0: | ||
304 | addServicesToDevice( (BTDeviceItem*)item ); | ||
303 | break; | 305 | break; |
304 | case 1: | 306 | case 1: |
307 | |||
305 | break; | 308 | break; |
306 | case 2: | 309 | |
310 | // NO need to, since hcid does that on the fly | ||
311 | // case 2: | ||
307 | // make connection | 312 | // make connection |
308 | break; | 313 | //m_localDevice->connectTo( ((BTDeviceItem*)item)->mac() ); |
314 | //break; | ||
309 | case 3: | 315 | case 3: |
310 | // delete childs too | 316 | // deletes childs too |
311 | delete item; | 317 | delete item; |
312 | break; | 318 | break; |
313 | } | 319 | } |
314 | delete groups; | 320 | delete groups; |
315 | 321 | ||
316 | } | 322 | } |
317 | 323 | ||
318 | /* | 324 | /* |
319 | * We got service sensitive PopupMenus in our factory | 325 | * We got service sensitive PopupMenus in our factory |
320 | * We will create one through the factory and will insert | 326 | * We will create one through the factory and will insert |
321 | * our Separator + ShowInfo into the menu or create a new | 327 | * our Separator + ShowInfo into the menu or create a new |
322 | * one if the factory returns 0 | 328 | * one if the factory returns 0 |
323 | * PopupMenu deletion is kind of weird. | 329 | * PopupMenu deletion is kind of weird. |
324 | * If escaped( -1 ) or any of our items were chosen we'll | 330 | * If escaped( -1 ) or any of our items were chosen we'll |
325 | * delete the PopupMenu otherwise it's the responsibility of | 331 | * delete the PopupMenu otherwise it's the responsibility of |
326 | * the PopupMenu to delete itself | 332 | * the PopupMenu to delete itself |
327 | * | 333 | * |
328 | */ | 334 | */ |
329 | else if ( ((BTListItem*)item)->type() == "service") { | 335 | else if ( ((BTListItem*)item)->type() == "service") { |
330 | BTServiceItem* service = (BTServiceItem*)item; | 336 | BTServiceItem* service = (BTServiceItem*)item; |
331 | QMap<int, QString> list = service->services().classIdList(); | 337 | QMap<int, QString> list = service->services().classIdList(); |
332 | QMap<int, QString>::Iterator it = list.begin(); | 338 | QMap<int, QString>::Iterator it = list.begin(); |
333 | QPopupMenu *popup =0l; | 339 | QPopupMenu *popup =0l; |
334 | if ( it != list.end() ) { | 340 | if ( it != list.end() ) { |
@@ -388,50 +394,51 @@ void BlueBase::addServicesToDevice( BTDeviceItem * item ) { | |||
388 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { | 394 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { |
389 | qDebug("fill services list"); | 395 | qDebug("fill services list"); |
390 | 396 | ||
391 | QMap<QString,BTDeviceItem*>::Iterator it; | 397 | QMap<QString,BTDeviceItem*>::Iterator it; |
392 | BTDeviceItem* deviceItem = 0; | 398 | BTDeviceItem* deviceItem = 0; |
393 | 399 | ||
394 | // get the right devices which requested the search | 400 | // get the right devices which requested the search |
395 | it = m_deviceList.find( device ); | 401 | it = m_deviceList.find( device ); |
396 | if( it == m_deviceList.end() ) | 402 | if( it == m_deviceList.end() ) |
397 | return; | 403 | return; |
398 | deviceItem = it.data(); | 404 | deviceItem = it.data(); |
399 | 405 | ||
400 | QValueList<OpieTooth::Services>::Iterator it2; | 406 | QValueList<OpieTooth::Services>::Iterator it2; |
401 | BTServiceItem * serviceItem; | 407 | BTServiceItem * serviceItem; |
402 | 408 | ||
403 | if (!servicesList.isEmpty() ) { | 409 | if (!servicesList.isEmpty() ) { |
404 | // add services | 410 | // add services |
405 | QMap<int, QString> list; | 411 | QMap<int, QString> list; |
406 | QMap<int, QString>::Iterator classIt; | 412 | QMap<int, QString>::Iterator classIt; |
407 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { | 413 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { |
408 | serviceItem = new BTServiceItem( deviceItem , (*it2) ); | 414 | serviceItem = new BTServiceItem( deviceItem , (*it2) ); |
409 | list = (*it2).classIdList(); | 415 | list = (*it2).classIdList(); |
410 | classIt = list.begin(); | 416 | classIt = list.begin(); |
411 | int classId=0; | 417 | int classId=0; |
412 | if ( classIt != list.end() ) | 418 | if ( classIt != list.end() ) { |
413 | classId = classIt.key(); | 419 | classId = classIt.key(); |
420 | } | ||
414 | 421 | ||
415 | serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); | 422 | serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); |
416 | } | 423 | } |
417 | } else { | 424 | } else { |
418 | Services s1; | 425 | Services s1; |
419 | s1.setServiceName( tr("no serives found") ); | 426 | s1.setServiceName( tr("no serives found") ); |
420 | serviceItem = new BTServiceItem( deviceItem, s1 ); | 427 | serviceItem = new BTServiceItem( deviceItem, s1 ); |
421 | } | 428 | } |
422 | // now remove them from the list | 429 | // now remove them from the list |
423 | m_deviceList.remove( it ); | 430 | m_deviceList.remove( it ); |
424 | } | 431 | } |
425 | 432 | ||
426 | 433 | ||
427 | /** | 434 | /** |
428 | * Add the existing connections (pairs) to the connections tab. | 435 | * Add the existing connections (pairs) to the connections tab. |
429 | * This one triggers the search | 436 | * This one triggers the search |
430 | */ | 437 | */ |
431 | void BlueBase::addConnectedDevices() { | 438 | void BlueBase::addConnectedDevices() { |
432 | m_localDevice->searchConnections(); | 439 | m_localDevice->searchConnections(); |
433 | } | 440 | } |
434 | 441 | ||
435 | 442 | ||
436 | /** | 443 | /** |
437 | * This adds the found connections to the connection tab. | 444 | * This adds the found connections to the connection tab. |