Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 189001d..3f2f138 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -94,6 +94,8 @@ using namespace OpieTooth; | |||
94 | Services s1; | 94 | Services s1; |
95 | s1.setServiceName( "Serial" ); | 95 | s1.setServiceName( "Serial" ); |
96 | s1.insertClassId(1, "BlueNic"); | ||
96 | (void) new BTServiceItem( topLV2, s1 ); | 97 | (void) new BTServiceItem( topLV2, s1 ); |
97 | s1.setServiceName( "BlueNic" ); | 98 | s1.setServiceName( "BlueNic" ); |
99 | s1.insertClassId(2, "Obex"); | ||
98 | (void) new BTServiceItem( topLV2, s1 ); | 100 | (void) new BTServiceItem( topLV2, s1 ); |
99 | 101 | ||
@@ -300,5 +302,6 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin | |||
300 | 302 | ||
301 | switch(ret) { | 303 | switch(ret) { |
302 | case 0: | 304 | case -1: |
305 | |||
303 | break; | 306 | break; |
304 | case 1: | 307 | case 1: |
@@ -314,21 +317,46 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin | |||
314 | delete groups; | 317 | delete groups; |
315 | 318 | ||
316 | } else if ( ((BTListItem*)item)->type() == "service") { | 319 | } |
317 | 320 | /** | |
318 | menu->insertItem( tr("Test1:"), 0); | 321 | * We got service sensitive PopupMenus in our factory |
319 | menu->insertItem( tr("connect"), 1); | 322 | * We will create one through the factory and will insert |
320 | menu->insertItem( tr("delete"), 2); | 323 | * our Separator + ShowInfo into the menu or create a new |
321 | 324 | * one if the factory returns 0 | |
322 | ret = menu->exec( point , 0); | 325 | * PopupMenu deletion is kind of weird. |
323 | 326 | * If escaped( -1 ) or any of our items were chosen we'll | |
324 | switch(ret) { | 327 | * delete the PopupMenu otherwise it's the responsibility of |
325 | case 0: | 328 | * the PopupMenu to delete itself |
326 | break; | 329 | * |
327 | case 1: | 330 | */ |
328 | break; | 331 | else if ( ((BTListItem*)item)->type() == "service") { |
329 | case 2: | 332 | BTServiceItem* service = (BTServiceItem*)item; |
330 | // delete childs too | 333 | QMap<int, QString> list = service->services().classIdList(); |
334 | QMap<int, QString>::Iterator it = list.begin(); | ||
335 | QPopupMenu *popup =0l; | ||
336 | if ( it != list.end() ) | ||
337 | popup = m_popHelper.find( it.key(), | ||
338 | service->services(), | ||
339 | service->parent() ); | ||
340 | |||
341 | if ( popup == 0l ) { | ||
342 | qWarning("factory returned 0l"); | ||
343 | popup = new QPopupMenu(); | ||
344 | } | ||
345 | |||
346 | int test1 = popup->insertItem( tr("Test1:"), 0); | ||
347 | int con = popup->insertItem( tr("connect"), 1); | ||
348 | int del = popup->insertItem( tr("delete"), 2); | ||
349 | |||
350 | ret = popup->exec( point ); | ||
351 | |||
352 | if ( ret == -1 ) | ||
353 | delete popup; | ||
354 | else if ( ret == test1 ) | ||
355 | delete popup; | ||
356 | else if ( ret == con ) | ||
357 | delete popup; | ||
358 | else if ( ret == del ) { | ||
359 | // take item first? -zecke | ||
331 | delete item; | 360 | delete item; |
332 | break; | ||
333 | } | 361 | } |
334 | } | 362 | } |