author | harlekin <harlekin> | 2002-06-23 16:18:52 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-23 16:18:52 (UTC) |
commit | 5cf97227889d00e366782d466eef5eafe1d73e5c (patch) (unidiff) | |
tree | 3a89e3db99b1ec45f69ec4bf6688fdb45eeab9a7 /noncore/net/opietooth/manager | |
parent | 6382b7352205a71557bd87b4f43d7f19f7f3330e (diff) | |
download | opie-5cf97227889d00e366782d466eef5eafe1d73e5c.zip opie-5cf97227889d00e366782d466eef5eafe1d73e5c.tar.gz opie-5cf97227889d00e366782d466eef5eafe1d73e5c.tar.bz2 |
little update
Diffstat (limited to 'noncore/net/opietooth/manager') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 69 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 3 |
3 files changed, 66 insertions, 8 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 | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qlistview.h> | 36 | #include <qlistview.h> |
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qpopupmenu.h> | ||
38 | 39 | ||
39 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
40 | #include <qpe/config.h> | 41 | #include <qpe/config.h> |
@@ -52,17 +53,19 @@ namespace OpieTooth { | |||
52 | 53 | ||
53 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); | 54 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); |
54 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); | 55 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); |
55 | connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), | 56 | // not good since lib is async |
56 | this, SLOT( addServicesToDevice( QListViewItem * ) ) ); | 57 | // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), |
58 | // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); | ||
57 | connect( ListView2, SIGNAL( clicked( QListViewItem* )), | 59 | connect( ListView2, SIGNAL( clicked( QListViewItem* )), |
58 | this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); | 60 | this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); |
61 | connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), | ||
62 | this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); | ||
59 | connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), | 63 | connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), |
60 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); | 64 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); |
61 | 65 | ||
62 | 66 | ||
63 | //Load all icons needed | 67 | //Load all icons needed |
64 | 68 | ||
65 | |||
66 | offPix = Resource::loadPixmap( "editdelete" ); | 69 | offPix = Resource::loadPixmap( "editdelete" ); |
67 | onPix = Resource::loadPixmap( "installed" ); | 70 | onPix = Resource::loadPixmap( "installed" ); |
68 | 71 | ||
@@ -84,6 +87,7 @@ namespace OpieTooth { | |||
84 | 87 | ||
85 | QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" ); | 88 | QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" ); |
86 | topLV2->setPixmap( 1, onPix ); | 89 | topLV2->setPixmap( 1, onPix ); |
90 | topLV2->setText(4, "device" ); | ||
87 | (void) new QListViewItem( topLV2, "Serial" ); | 91 | (void) new QListViewItem( topLV2, "Serial" ); |
88 | (void) new QListViewItem( topLV2, "BlueNiC" ); | 92 | (void) new QListViewItem( topLV2, "BlueNiC" ); |
89 | } | 93 | } |
@@ -251,6 +255,8 @@ namespace OpieTooth { | |||
251 | } | 255 | } |
252 | 256 | ||
253 | deviceItem->setText( 3, dev->mac() ); | 257 | deviceItem->setText( 3, dev->mac() ); |
258 | // what kind of entry is it. | ||
259 | deviceItem->setText( 4, "device"); | ||
254 | 260 | ||
255 | // ggf auch hier? | 261 | // ggf auch hier? |
256 | addServicesToDevice( deviceItem ); | 262 | addServicesToDevice( deviceItem ); |
@@ -271,6 +277,38 @@ namespace OpieTooth { | |||
271 | */ | 277 | */ |
272 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { | 278 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { |
273 | 279 | ||
280 | QPopupMenu *menu = new QPopupMenu(); | ||
281 | QPopupMenu *groups = new QPopupMenu(); | ||
282 | int ret=0; | ||
283 | |||
284 | //QSize s = menu->sizeHint ( ); | ||
285 | |||
286 | if ( item->text(4) == "device") { | ||
287 | menu->insertItem( tr("rescan sevices:"), 0); | ||
288 | menu->insertItem( tr("to group"), groups , 1); | ||
289 | menu->insertItem( tr("delete"), 2); | ||
290 | } else if ( item->text(4) == "service") { | ||
291 | menu->insertItem( tr("Test1:"), 0); | ||
292 | menu->insertItem( tr("connect"), 1); | ||
293 | menu->insertItem( tr("delete"), 2); | ||
294 | } | ||
295 | |||
296 | ret = menu->exec( point , 0); | ||
297 | |||
298 | // noch differenzieren | ||
299 | switch(ret) { | ||
300 | case 0: | ||
301 | break; | ||
302 | case 1: | ||
303 | break; | ||
304 | case 2: | ||
305 | // delete childs too | ||
306 | delete item; | ||
307 | break; | ||
308 | } | ||
309 | |||
310 | delete menu; | ||
311 | delete groups; | ||
274 | } | 312 | } |
275 | 313 | ||
276 | /** | 314 | /** |
@@ -280,7 +318,7 @@ namespace OpieTooth { | |||
280 | void BlueBase::addServicesToDevice( QListViewItem * item ) { | 318 | void BlueBase::addServicesToDevice( QListViewItem * item ) { |
281 | 319 | ||
282 | qDebug("addServicesToDevice"); | 320 | qDebug("addServicesToDevice"); |
283 | // row of mac adress | 321 | // row of mac adress text(3) |
284 | RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) ); | 322 | RemoteDevice *device = new RemoteDevice( item->text(3), item->text(0) ); |
285 | 323 | ||
286 | deviceList.insert( item->text(3) , item ); | 324 | deviceList.insert( item->text(3) , item ); |
@@ -301,23 +339,40 @@ namespace OpieTooth { | |||
301 | 339 | ||
302 | qDebug("fill services list"); | 340 | qDebug("fill services list"); |
303 | 341 | ||
304 | |||
305 | QMap<QString,QListViewItem*>::Iterator it; | 342 | QMap<QString,QListViewItem*>::Iterator it; |
306 | 343 | ||
307 | QListViewItem* deviceItem; | 344 | QListViewItem* deviceItem; |
308 | 345 | ||
346 | // get the right devices which requested the search | ||
309 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { | 347 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { |
310 | if ( it.key() == device ) { | 348 | if ( it.key() == device ) { |
311 | deviceItem = it.data(); | 349 | deviceItem = it.data(); |
312 | } | 350 | } |
313 | } | 351 | } |
314 | 352 | ||
353 | |||
354 | // empty entries | ||
355 | // QListViewItem * myChild = deviceItem->firstChild(); | ||
356 | //QList<QListViewItem*> tmpList; | ||
357 | //while( myChild ) { | ||
358 | // tmpList.append(myChild); | ||
359 | // myChild = myChild->nextSibling(); | ||
360 | // } | ||
361 | |||
362 | |||
315 | QValueList<OpieTooth::Services>::Iterator it2; | 363 | QValueList<OpieTooth::Services>::Iterator it2; |
316 | 364 | ||
317 | QListViewItem * serviceItem; | 365 | QListViewItem * serviceItem; |
318 | 366 | ||
319 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { | 367 | if (!servicesList.isEmpty() ) { |
320 | serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() ); | 368 | // add services |
369 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { | ||
370 | serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() ); | ||
371 | serviceItem->setText(4, "service"); | ||
372 | } | ||
373 | } else { | ||
374 | serviceItem = new QListViewItem( deviceItem , tr("no services found") ); | ||
375 | serviceItem->setText(4, "service"); | ||
321 | } | 376 | } |
322 | } | 377 | } |
323 | 378 | ||
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 | |||
@@ -71,7 +71,7 @@ namespace OpieTooth { | |||
71 | void addServicesToDevice( const QString& device, Services::ValueList ); | 71 | void addServicesToDevice( const QString& device, Services::ValueList ); |
72 | void addConnectedDevices(); | 72 | void addConnectedDevices(); |
73 | void startServiceActionClicked( QListViewItem *item ); | 73 | void startServiceActionClicked( QListViewItem *item ); |
74 | void startServiceActionHold( QListViewItem *item, const QPoint &point, int column); | 74 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); |
75 | void applyConfigChanges(); | 75 | void applyConfigChanges(); |
76 | 76 | ||
77 | }; | 77 | }; |
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 | |||
@@ -117,6 +117,9 @@ namespace OpieTooth { | |||
117 | progress->setProgress(0); | 117 | progress->setProgress(0); |
118 | progressStat = 0; | 118 | progressStat = 0; |
119 | 119 | ||
120 | // empty list before a new scan | ||
121 | ListView1->clear(); | ||
122 | |||
120 | QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); | 123 | QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); |
121 | deviceItem2->setText(1, "BLAH" ); | 124 | deviceItem2->setText(1, "BLAH" ); |
122 | 125 | ||