summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-25 00:13:33 (UTC)
committer harlekin <harlekin>2003-03-25 00:13:33 (UTC)
commita70a56b2ec4a806e00a26c8768b9f3df7033e987 (patch) (unidiff)
treec0b811851694f4253c4cf323369f8034792ecf71
parentc80099645138ab1ab8ad542cbfce401bcc6d095c (diff)
downloadopie-a70a56b2ec4a806e00a26c8768b9f3df7033e987.zip
opie-a70a56b2ec4a806e00a26c8768b9f3df7033e987.tar.gz
opie-a70a56b2ec4a806e00a26c8768b9f3df7033e987.tar.bz2
give me other popups then obex again .-|
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp2
-rw-r--r--noncore/net/opietooth/manager/panpopup.cpp1
2 files changed, 2 insertions, 1 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 04fa117..935c11a 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -272,129 +272,129 @@ void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices )
272 272
273/** 273/**
274 * Action that is toggled on entrys on click 274 * Action that is toggled on entrys on click
275 */ 275 */
276void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { 276void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) {
277} 277}
278 278
279 279
280/** 280/**
281 * Action that are toggled on hold (mostly QPopups i guess) 281 * Action that are toggled on hold (mostly QPopups i guess)
282 */ 282 */
283void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { 283void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) {
284 if (!item ) 284 if (!item )
285 return; 285 return;
286 286
287 QPopupMenu *menu = new QPopupMenu(); 287 QPopupMenu *menu = new QPopupMenu();
288 int ret=0; 288 int ret=0;
289 289
290 if ( ((BTListItem*)item)->type() == "device") { 290 if ( ((BTListItem*)item)->type() == "device") {
291 291
292 QPopupMenu *groups = new QPopupMenu(); 292 QPopupMenu *groups = new QPopupMenu();
293 293
294 menu->insertItem( ((BTDeviceItem*)item)->name(),0 ); 294 menu->insertItem( ((BTDeviceItem*)item)->name(),0 );
295 menu->insertSeparator(1); 295 menu->insertSeparator(1);
296 menu->insertItem( tr("rescan sevices"), 2); 296 menu->insertItem( tr("rescan sevices"), 2);
297 menu->insertItem( tr("to group"), groups , 3); 297 menu->insertItem( tr("to group"), groups , 3);
298 menu->insertItem( tr("delete"), 4); 298 menu->insertItem( tr("delete"), 4);
299 299
300 ret = menu->exec( point , 0); 300 ret = menu->exec( point , 0);
301 301
302 switch(ret) { 302 switch(ret) {
303 case -1: 303 case -1:
304 break; 304 break;
305 case 2: 305 case 2:
306 addServicesToDevice( (BTDeviceItem*)item ); 306 addServicesToDevice( (BTDeviceItem*)item );
307 break; 307 break;
308 308
309 case 4: 309 case 4:
310 // deletes childs too 310 // deletes childs too
311 delete item; 311 delete item;
312 break; 312 break;
313 } 313 }
314 delete groups; 314 delete groups;
315 315
316 } 316 }
317 317
318 /* 318 /*
319 * We got service sensitive PopupMenus in our factory 319 * We got service sensitive PopupMenus in our factory
320 * We will create one through the factory and will insert 320 * We will create one through the factory and will insert
321 * our Separator + ShowInfo into the menu or create a new 321 * our Separator + ShowInfo into the menu or create a new
322 * one if the factory returns 0 322 * one if the factory returns 0
323 * PopupMenu deletion is kind of weird. 323 * PopupMenu deletion is kind of weird.
324 * If escaped( -1 ) or any of our items were chosen we'll 324 * If escaped( -1 ) or any of our items were chosen we'll
325 * delete the PopupMenu otherwise it's the responsibility of 325 * delete the PopupMenu otherwise it's the responsibility of
326 * the PopupMenu to delete itself 326 * the PopupMenu to delete itself
327 * 327 *
328 */ 328 */
329 else if ( ((BTListItem*)item)->type() == "service") { 329 else if ( ((BTListItem*)item)->type() == "service") {
330 BTServiceItem* service = (BTServiceItem*)item; 330 BTServiceItem* service = (BTServiceItem*)item;
331 QMap<int, QString> list = service->services().classIdList(); 331 QMap<int, QString> list = service->services().classIdList();
332 QMap<int, QString>::Iterator it = list.begin(); 332 QMap<int, QString>::Iterator it = list.begin();
333 QPopupMenu *popup =0l; 333 QPopupMenu *popup =0l;
334 if ( it != list.end() ) { 334 if ( it != list.end() ) {
335 qWarning("Searching id %d %s", it.key(), it.data().latin1() ); 335 qWarning("Searching id %d %s", it.key(), it.data().latin1() );
336 popup = m_popHelper.find( 4358, 336 popup = m_popHelper.find( it.key(),
337 service->services(), 337 service->services(),
338 (BTDeviceItem*)service->parent() ); 338 (BTDeviceItem*)service->parent() );
339 }else { 339 }else {
340 qWarning("Empty"); 340 qWarning("Empty");
341 } 341 }
342 342
343 if ( popup == 0l ) { 343 if ( popup == 0l ) {
344 qWarning("factory returned 0l"); 344 qWarning("factory returned 0l");
345 popup = new QPopupMenu(); 345 popup = new QPopupMenu();
346 } 346 }
347 int test1 = popup->insertItem( tr("Test1:"), 2); 347 int test1 = popup->insertItem( tr("Test1:"), 2);
348 348
349 ret = popup->exec( point ); 349 ret = popup->exec( point );
350 qWarning("returned from exec() "); 350 qWarning("returned from exec() ");
351 if ( ret == -1 ) { 351 if ( ret == -1 ) {
352 ; 352 ;
353 } else if ( ret == test1 ) { 353 } else if ( ret == test1 ) {
354 ; 354 ;
355 } 355 }
356 delete popup; 356 delete popup;
357 } 357 }
358 delete menu; 358 delete menu;
359} 359}
360 360
361 361
362/** 362/**
363 * Search and display avail. services for a device (on expand from device listing) 363 * Search and display avail. services for a device (on expand from device listing)
364 * @param item the service item returned 364 * @param item the service item returned
365 */ 365 */
366void BlueBase::addServicesToDevice( BTDeviceItem * item ) { 366void BlueBase::addServicesToDevice( BTDeviceItem * item ) {
367 qDebug("addServicesToDevice"); 367 qDebug("addServicesToDevice");
368 // row of mac adress text(3) 368 // row of mac adress text(3)
369 RemoteDevice device = item->remoteDevice(); 369 RemoteDevice device = item->remoteDevice();
370 m_deviceList.insert( item->mac() , item ); 370 m_deviceList.insert( item->mac() , item );
371 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 371 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
372 m_localDevice->searchServices( device ); 372 m_localDevice->searchServices( device );
373} 373}
374 374
375 375
376/** 376/**
377 * Overloaded. This one it the one that is 377 * Overloaded. This one it the one that is
378 ted to the foundServices signal 378 ted to the foundServices signal
379 * @param device the mac address of the remote device 379 * @param device the mac address of the remote device
380 * @param servicesList the list with the service the device has. 380 * @param servicesList the list with the service the device has.
381 */ 381 */
382void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 382void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
383 qDebug("fill services list"); 383 qDebug("fill services list");
384 384
385 QMap<QString,BTDeviceItem*>::Iterator it; 385 QMap<QString,BTDeviceItem*>::Iterator it;
386 BTDeviceItem* deviceItem = 0; 386 BTDeviceItem* deviceItem = 0;
387 387
388 // get the right devices which requested the search 388 // get the right devices which requested the search
389 it = m_deviceList.find( device ); 389 it = m_deviceList.find( device );
390 if( it == m_deviceList.end() ) 390 if( it == m_deviceList.end() )
391 return; 391 return;
392 deviceItem = it.data(); 392 deviceItem = it.data();
393 393
394 // remove previous entries 394 // remove previous entries
395 QList<QListViewItem> tempList; 395 QList<QListViewItem> tempList;
396 tempList.setAutoDelete( true ); 396 tempList.setAutoDelete( true );
397 QListViewItem * child = deviceItem->firstChild(); 397 QListViewItem * child = deviceItem->firstChild();
398 while( child ) { 398 while( child ) {
399 tempList.append( child ); 399 tempList.append( child );
400 child = child->nextSibling(); 400 child = child->nextSibling();
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp
index 61e632b..7a0ee55 100644
--- a/noncore/net/opietooth/manager/panpopup.cpp
+++ b/noncore/net/opietooth/manager/panpopup.cpp
@@ -1,62 +1,63 @@
1#include <qpe/qcopenvelope_qws.h> 1#include <qpe/qcopenvelope_qws.h>
2 2
3#include <qtimer.h> 3#include <qtimer.h>
4 4
5#include "panpopup.h" 5#include "panpopup.h"
6 6
7using namespace OpieTooth; 7using namespace OpieTooth;
8 8
9/* 9/*
10 * c'tor init the QAction 10 * c'tor init the QAction
11 */ 11 */
12PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { 12PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
13 13
14 qWarning("PanPopup c'tor"); 14 qWarning("PanPopup c'tor");
15 15
16 m_item = item; 16 m_item = item;
17 QAction *a, *b, *c; 17 QAction *a, *b, *c;
18 18
19 m_panconnection = 0l; 19 m_panconnection = 0l;
20 /* connect action */ 20 /* connect action */
21 21
22 22
23 a = new QAction(); // so it's get deleted 23 a = new QAction(); // so it's get deleted
24 a->setText( tr("connect") ); 24 a->setText( tr("connect") );
25 a->addTo( this ); 25 a->addTo( this );
26 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); 26 connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
27 27
28 28
29 b = new QAction(); 29 b = new QAction();
30 b->setText( tr( "connect+conf" ) ); 30 b->setText( tr( "connect+conf" ) );
31 b->addTo( this ); 31 b->addTo( this );
32 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); 32 connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
33 33
34 c = new QAction(); 34 c = new QAction();
35 c->setText( tr( "disconnect" ) ); 35 c->setText( tr( "disconnect" ) );
36 c->addTo( this ); 36 c->addTo( this );
37 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); 37 connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
38 38
39}; 39};
40 40
41PanPopup::~PanPopup() { 41PanPopup::~PanPopup() {
42 42
43} 43}
44 44
45void PanPopup::slotConnect() { 45void PanPopup::slotConnect() {
46
46 m_panconnection = new StartPanConnection( m_item->mac() ); 47 m_panconnection = new StartPanConnection( m_item->mac() );
47 m_panconnection->start(); 48 m_panconnection->start();
48} 49}
49 50
50void PanPopup::slotDisconnect() { 51void PanPopup::slotDisconnect() {
51 m_panconnection->stop(); 52 m_panconnection->stop();
52} 53}
53 54
54 55
55void PanPopup::slotConnectAndConfig() { 56void PanPopup::slotConnectAndConfig() {
56 slotConnect(); 57 slotConnect();
57 58
58 // more intelligence here later like passing the device ( bnepX ) 59 // more intelligence here later like passing the device ( bnepX )
59 QCopEnvelope e( "QPE/System", "execute(QString)" ); 60 QCopEnvelope e( "QPE/System", "execute(QString)" );
60 e << QString( "networksetup" ); 61 e << QString( "networksetup" );
61 62
62} 63}