-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 65 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 3 |
3 files changed, 64 insertions, 6 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index cc51405..772dbd1 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -37,2 +37,3 @@ #include <qdir.h> +#include <qpopupmenu.h> @@ -54,6 +55,9 @@ namespace OpieTooth { connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); - connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), - this, SLOT( addServicesToDevice( QListViewItem * ) ) ); + // not good since lib is async + // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), + // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); connect( ListView2, SIGNAL( clicked( QListViewItem* )), this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); + connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), + this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), @@ -64,3 +68,2 @@ namespace OpieTooth { - offPix = Resource::loadPixmap( "editdelete" ); @@ -86,2 +89,3 @@ namespace OpieTooth { topLV2->setPixmap( 1, onPix ); + topLV2->setText(4, "device" ); (void) new QListViewItem( topLV2, "Serial" ); @@ -253,2 +257,4 @@ namespace OpieTooth { deviceItem->setText( 3, dev->mac() ); + // what kind of entry is it. + deviceItem->setText( 4, "device"); @@ -273,2 +279,34 @@ namespace OpieTooth { + QPopupMenu *menu = new QPopupMenu(); + QPopupMenu *groups = new QPopupMenu(); + int ret=0; + + //QSize s = menu->sizeHint ( ); + + if ( item->text(4) == "device") { + menu->insertItem( tr("rescan sevices:"), 0); + menu->insertItem( tr("to group"), groups , 1); + menu->insertItem( tr("delete"), 2); + } else if ( item->text(4) == "service") { + menu->insertItem( tr("Test1:"), 0); + menu->insertItem( tr("connect"), 1); + menu->insertItem( tr("delete"), 2); + } + + ret = menu->exec( point , 0); + +// noch differenzieren + switch(ret) { + case 0: + break; + case 1: + break; + case 2: + // delete childs too + delete item; + break; + } + + delete menu; + delete groups; } @@ -282,3 +320,3 @@ namespace OpieTooth { qDebug("addServicesToDevice"); - // row of mac adress + // row of mac adress text(3) RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) ); @@ -303,3 +341,2 @@ namespace OpieTooth { - QMap<QString,QListViewItem*>::Iterator it; @@ -308,2 +345,3 @@ namespace OpieTooth { + // get the right devices which requested the search for( it = deviceList.begin(); it != deviceList.end(); ++it ) { @@ -314,2 +352,12 @@ namespace OpieTooth { + + // empty entries + // QListViewItem * myChild = deviceItem->firstChild(); + //QList<QListViewItem*> tmpList; + //while( myChild ) { + // tmpList.append(myChild); + // myChild = myChild->nextSibling(); + // } + + QValueList<OpieTooth::Services>::Iterator it2; @@ -318,4 +366,11 @@ namespace OpieTooth { + if (!servicesList.isEmpty() ) { + // add services for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() ); + serviceItem->setText(4, "service"); + } + } else { + serviceItem = new QListViewItem( deviceItem , tr("no services found") ); + serviceItem->setText(4, "service"); } diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 99d2fa6..bc48bb3 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h @@ -73,3 +73,3 @@ namespace OpieTooth { void startServiceActionClicked( QListViewItem *item ); - void startServiceActionHold( QListViewItem *item, const QPoint &point, int column); + void startServiceActionHold( QListViewItem *, const QPoint &, int ); void applyConfigChanges(); diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index 9520e73..0e6e93b 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp @@ -119,2 +119,5 @@ namespace OpieTooth { + // empty list before a new scan + ListView1->clear(); + QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); |