summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp56
-rw-r--r--noncore/net/opietooth/manager/popuphelper.cpp2
2 files changed, 44 insertions, 14 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
@@ -95,4 +95,6 @@ using namespace OpieTooth;
s1.setServiceName( "Serial" );
+ s1.insertClassId(1, "BlueNic");
(void) new BTServiceItem( topLV2, s1 );
s1.setServiceName( "BlueNic" );
+ s1.insertClassId(2, "Obex");
(void) new BTServiceItem( topLV2, s1 );
@@ -301,3 +303,4 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
switch(ret) {
- case 0:
+ case -1:
+
break;
@@ -315,19 +318,44 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
- } else if ( ((BTListItem*)item)->type() == "service") {
+ }
+ /**
+ * We got service sensitive PopupMenus in our factory
+ * We will create one through the factory and will insert
+ * our Separator + ShowInfo into the menu or create a new
+ * one if the factory returns 0
+ * PopupMenu deletion is kind of weird.
+ * If escaped( -1 ) or any of our items were chosen we'll
+ * delete the PopupMenu otherwise it's the responsibility of
+ * the PopupMenu to delete itself
+ *
+ */
+ else if ( ((BTListItem*)item)->type() == "service") {
+ BTServiceItem* service = (BTServiceItem*)item;
+ QMap<int, QString> list = service->services().classIdList();
+ QMap<int, QString>::Iterator it = list.begin();
+ QPopupMenu *popup =0l;
+ if ( it != list.end() )
+ popup = m_popHelper.find( it.key(),
+ service->services(),
+ service->parent() );
+
+ if ( popup == 0l ) {
+ qWarning("factory returned 0l");
+ popup = new QPopupMenu();
+ }
- menu->insertItem( tr("Test1:"), 0);
- menu->insertItem( tr("connect"), 1);
- menu->insertItem( tr("delete"), 2);
+ int test1 = popup->insertItem( tr("Test1:"), 0);
+ int con = popup->insertItem( tr("connect"), 1);
+ int del = popup->insertItem( tr("delete"), 2);
- ret = menu->exec( point , 0);
+ ret = popup->exec( point );
- switch(ret) {
- case 0:
- break;
- case 1:
- break;
- case 2:
- // delete childs too
+ if ( ret == -1 )
+ delete popup;
+ else if ( ret == test1 )
+ delete popup;
+ else if ( ret == con )
+ delete popup;
+ else if ( ret == del ) {
+ // take item first? -zecke
delete item;
- break;
}
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp
index d8404d6..26c4b02 100644
--- a/noncore/net/opietooth/manager/popuphelper.cpp
+++ b/noncore/net/opietooth/manager/popuphelper.cpp
@@ -17,4 +17,6 @@ void PopupHelper::insert( int id, popupFactory fact ) {
QPopupMenu* PopupHelper::find( int id, const Services& ser, QListViewItem* item ) {
+ qWarning("find");
FactoryMap::Iterator it = m_map.find(id );
if ( it != m_map.end() ) {
+ qWarning("found");
popupFactory fact = it.data();