summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/bluebase.cpp
authorar <ar>2004-02-21 15:27:41 (UTC)
committer ar <ar>2004-02-21 15:27:41 (UTC)
commit460258f203be746ff79e14f32a823f381b8ea513 (patch) (unidiff)
tree87dddbacda3050027d343730cf021b53045e80cb /noncore/net/opietooth/manager/bluebase.cpp
parent76b70b355d2c1c32c0f74e844e0654e39db2a175 (diff)
downloadopie-460258f203be746ff79e14f32a823f381b8ea513.zip
opie-460258f203be746ff79e14f32a823f381b8ea513.tar.gz
opie-460258f203be746ff79e14f32a823f381b8ea513.tar.bz2
improve support for BigScreen
Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp261
1 files changed, 161 insertions, 100 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 2e68984..0ea45d2 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -22,11 +22,12 @@
22#include "btconnectionitem.h" 22#include "btconnectionitem.h"
23#include "rfcommassigndialogimpl.h" 23#include "rfcommassigndialogimpl.h"
24 24
25#include <remotedevice.h> 25/* OPIE */
26#include <services.h> 26#include <qpe/qpeapplication.h>
27 27#include <qpe/resource.h>
28#include <stdlib.h> 28#include <qpe/config.h>
29 29
30/* QT */
30#include <qframe.h> 31#include <qframe.h>
31#include <qlabel.h> 32#include <qlabel.h>
32#include <qpushbutton.h> 33#include <qpushbutton.h>
@@ -46,15 +47,16 @@
46#include <qtimer.h> 47#include <qtimer.h>
47#include <qlist.h> 48#include <qlist.h>
48 49
49#include <qpe/qpeapplication.h> 50/* STD */
50#include <qpe/resource.h> 51#include <remotedevice.h>
51#include <qpe/config.h> 52#include <services.h>
52 53#include <stdlib.h>
53 54
54using namespace OpieTooth; 55using namespace OpieTooth;
55 56
56BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 57BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
57 : BluetoothBase( parent, name, fl ) { 58 : BluetoothBase( parent, name, fl )
59{
58 60
59 m_localDevice = new Manager( "hci0" ); 61 m_localDevice = new Manager( "hci0" );
60 62
@@ -62,7 +64,7 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
62 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 64 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
63 65
64 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); 66 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) );
65// not good since lib is async 67 // not good since lib is async
66 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), 68 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ),
67 // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); 69 // this, SLOT( addServicesToDevice( QListViewItem * ) ) );
68 connect( ListView2, SIGNAL( clicked( QListViewItem* )), 70 connect( ListView2, SIGNAL( clicked( QListViewItem* )),
@@ -76,7 +78,7 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
76 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), 78 connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ),
77 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); 79 this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) );
78 connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ), 80 connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ),
79 this, SLOT( addSignalStrength( const QString&, const QString& ) ) ); 81 this, SLOT( addSignalStrength( const QString&, const QString& ) ) );
80 82
81 83
82 // let hold be rightButtonClicked() 84 // let hold be rightButtonClicked()
@@ -115,7 +117,8 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
115/** 117/**
116 * Reads all options from the config file 118 * Reads all options from the config file
117 */ 119 */
118void BlueBase::readConfig() { 120void BlueBase::readConfig()
121{
119 122
120 Config cfg( "bluetoothmanager" ); 123 Config cfg( "bluetoothmanager" );
121 cfg.setGroup( "bluezsettings" ); 124 cfg.setGroup( "bluezsettings" );
@@ -131,7 +134,8 @@ void BlueBase::readConfig() {
131/** 134/**
132 * Writes all options to the config file 135 * Writes all options to the config file
133 */ 136 */
134void BlueBase::writeConfig() { 137void BlueBase::writeConfig()
138{
135 139
136 Config cfg( "bluetoothmanager" ); 140 Config cfg( "bluetoothmanager" );
137 cfg.setGroup( "bluezsettings" ); 141 cfg.setGroup( "bluezsettings" );
@@ -149,7 +153,8 @@ void BlueBase::writeConfig() {
149/** 153/**
150 * Modify the hcid.conf file to our needs 154 * Modify the hcid.conf file to our needs
151 */ 155 */
152void BlueBase::writeToHciConfig() { 156void BlueBase::writeToHciConfig()
157{
153 qWarning("writeToHciConfig"); 158 qWarning("writeToHciConfig");
154 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); 159 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
155 hciconf.load(); 160 hciconf.load();
@@ -166,7 +171,8 @@ void BlueBase::writeToHciConfig() {
166/** 171/**
167 * Read the list of allready known devices 172 * Read the list of allready known devices
168 */ 173 */
169void BlueBase::readSavedDevices() { 174void BlueBase::readSavedDevices()
175{
170 176
171 QValueList<RemoteDevice> loadedDevices; 177 QValueList<RemoteDevice> loadedDevices;
172 DeviceHandler handler; 178 DeviceHandler handler;
@@ -179,12 +185,14 @@ void BlueBase::readSavedDevices() {
179/** 185/**
180 * Write the list of allready known devices 186 * Write the list of allready known devices
181 */ 187 */
182void BlueBase::writeSavedDevices() { 188void BlueBase::writeSavedDevices()
189{
183 QListViewItemIterator it( ListView2 ); 190 QListViewItemIterator it( ListView2 );
184 BTListItem* item; 191 BTListItem* item;
185 BTDeviceItem* device; 192 BTDeviceItem* device;
186 RemoteDevice::ValueList list; 193 RemoteDevice::ValueList list;
187 for ( ; it.current(); ++it ) { 194 for ( ; it.current(); ++it )
195 {
188 item = (BTListItem*)it.current(); 196 item = (BTListItem*)it.current();
189 if(item->typeId() != BTListItem::Device ) 197 if(item->typeId() != BTListItem::Device )
190 continue; 198 continue;
@@ -205,7 +213,8 @@ void BlueBase::writeSavedDevices() {
205/** 213/**
206 * Set up the gui 214 * Set up the gui
207 */ 215 */
208void BlueBase::initGui() { 216void BlueBase::initGui()
217{
209 StatusLabel->setText( status() ); // maybe move it to getStatus() 218 StatusLabel->setText( status() ); // maybe move it to getStatus()
210 cryptCheckBox->setChecked( m_useEncryption ); 219 cryptCheckBox->setChecked( m_useEncryption );
211 authCheckBox->setChecked( m_enableAuthentification ); 220 authCheckBox->setChecked( m_enableAuthentification );
@@ -222,7 +231,8 @@ void BlueBase::initGui() {
222 * Get the status informations and returns it 231 * Get the status informations and returns it
223 * @return QString the status informations gathered 232 * @return QString the status informations gathered
224 */ 233 */
225QString BlueBase::status()const{ 234QString BlueBase::status()const
235{
226 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 236 QString infoString = tr( "<b>Device name : </b> Ipaq" );
227 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 237 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
228 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 238 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
@@ -234,7 +244,8 @@ QString BlueBase::status()const{
234/** 244/**
235 * Read the current values from the gui and invoke writeConfig() 245 * Read the current values from the gui and invoke writeConfig()
236 */ 246 */
237void BlueBase::applyConfigChanges() { 247void BlueBase::applyConfigChanges()
248{
238 m_deviceName = deviceNameLine->text(); 249 m_deviceName = deviceNameLine->text();
239 m_defaultPasskey = passkeyLine->text(); 250 m_defaultPasskey = passkeyLine->text();
240 m_useEncryption = cryptCheckBox->isChecked(); 251 m_useEncryption = cryptCheckBox->isChecked();
@@ -251,12 +262,12 @@ void BlueBase::applyConfigChanges() {
251 * Launch Rfcomm Bind dialog 262 * Launch Rfcomm Bind dialog
252 * 263 *
253 */ 264 */
254void BlueBase::rfcommDialog() { 265void BlueBase::rfcommDialog()
266{
255 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); 267 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
256 268
257 rfcommAssign.showMaximized(); 269 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted )
258 270 {
259 if ( rfcommAssign.exec() == QDialog::Accepted ) {
260 rfcommAssign.saveConfig(); 271 rfcommAssign.saveConfig();
261 } 272 }
262} 273}
@@ -265,11 +276,13 @@ void BlueBase::rfcommDialog() {
265 * Add fresh found devices from scan dialog to the listing 276 * Add fresh found devices from scan dialog to the listing
266 * 277 *
267 */ 278 */
268void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { 279void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices )
280{
269 BTDeviceItem * deviceItem; 281 BTDeviceItem * deviceItem;
270 QValueList<RemoteDevice>::ConstIterator it; 282 QValueList<RemoteDevice>::ConstIterator it;
271 283
272 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { 284 for( it = newDevices.begin(); it != newDevices.end() ; ++it )
285 {
273 286
274 if (find( (*it) )) // is already inserted 287 if (find( (*it) )) // is already inserted
275 continue; 288 continue;
@@ -290,21 +303,23 @@ void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices )
290/** 303/**
291 * Action that is toggled on entrys on click 304 * Action that is toggled on entrys on click
292 */ 305 */
293void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { 306void BlueBase::startServiceActionClicked( QListViewItem */*item*/ )
294} 307{}
295 308
296 309
297/** 310/**
298 * Action that are toggled on hold (mostly QPopups i guess) 311 * Action that are toggled on hold (mostly QPopups i guess)
299 */ 312 */
300void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { 313void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ )
314{
301 if (!item ) 315 if (!item )
302 return; 316 return;
303 317
304 QPopupMenu *menu = new QPopupMenu(); 318 QPopupMenu *menu = new QPopupMenu();
305 int ret=0; 319 int ret=0;
306 320
307 if ( ((BTListItem*)item)->type() == "device") { 321 if ( ((BTListItem*)item)->type() == "device")
322 {
308 323
309 QPopupMenu *groups = new QPopupMenu(); 324 QPopupMenu *groups = new QPopupMenu();
310 325
@@ -316,7 +331,8 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
316 331
317 ret = menu->exec( point , 0); 332 ret = menu->exec( point , 0);
318 333
319 switch(ret) { 334 switch(ret)
335 {
320 case -1: 336 case -1:
321 break; 337 break;
322 case 2: 338 case 2:
@@ -343,21 +359,26 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
343 * the PopupMenu to delete itself 359 * the PopupMenu to delete itself
344 * 360 *
345 */ 361 */
346 else if ( ((BTListItem*)item)->type() == "service") { 362 else if ( ((BTListItem*)item)->type() == "service")
363 {
347 BTServiceItem* service = (BTServiceItem*)item; 364 BTServiceItem* service = (BTServiceItem*)item;
348 QMap<int, QString> list = service->services().classIdList(); 365 QMap<int, QString> list = service->services().classIdList();
349 QMap<int, QString>::Iterator it = list.begin(); 366 QMap<int, QString>::Iterator it = list.begin();
350 QPopupMenu *popup =0l; 367 QPopupMenu *popup =0l;
351 if ( it != list.end() ) { 368 if ( it != list.end() )
352 qWarning("Searching id %d %s", it.key(), it.data().latin1() ); 369 {
370 qWarning("Searching id %d %s", it.key(), it.data().latin1() );
353 popup = m_popHelper.find( it.key(), 371 popup = m_popHelper.find( it.key(),
354 service->services(), 372 service->services(),
355 (BTDeviceItem*)service->parent() ); 373 (BTDeviceItem*)service->parent() );
356 }else { 374 }
357 qWarning("Empty"); 375 else
358 } 376 {
377 qWarning("Empty");
378 }
359 379
360 if ( popup == 0l ) { 380 if ( popup == 0l )
381 {
361 qWarning("factory returned 0l"); 382 qWarning("factory returned 0l");
362 popup = new QPopupMenu(); 383 popup = new QPopupMenu();
363 } 384 }
@@ -365,9 +386,12 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
365 386
366 ret = popup->exec( point ); 387 ret = popup->exec( point );
367 qWarning("returned from exec() "); 388 qWarning("returned from exec() ");
368 if ( ret == -1 ) { 389 if ( ret == -1 )
390 {
369 ; 391 ;
370 } else if ( ret == test1 ) { 392 }
393 else if ( ret == test1 )
394 {
371 ; 395 ;
372 } 396 }
373 delete popup; 397 delete popup;
@@ -380,7 +404,8 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin
380 * Search and display avail. services for a device (on expand from device listing) 404 * Search and display avail. services for a device (on expand from device listing)
381 * @param item the service item returned 405 * @param item the service item returned
382 */ 406 */
383void BlueBase::addServicesToDevice( BTDeviceItem * item ) { 407void BlueBase::addServicesToDevice( BTDeviceItem * item )
408{
384 qDebug("addServicesToDevice"); 409 qDebug("addServicesToDevice");
385 // row of mac adress text(3) 410 // row of mac adress text(3)
386 RemoteDevice device = item->remoteDevice(); 411 RemoteDevice device = item->remoteDevice();
@@ -396,7 +421,8 @@ void BlueBase::addServicesToDevice( BTDeviceItem * item ) {
396 * @param device the mac address of the remote device 421 * @param device the mac address of the remote device
397 * @param servicesList the list with the service the device has. 422 * @param servicesList the list with the service the device has.
398 */ 423 */
399void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 424void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList )
425{
400 qDebug("fill services list"); 426 qDebug("fill services list");
401 427
402 QMap<QString,BTDeviceItem*>::Iterator it; 428 QMap<QString,BTDeviceItem*>::Iterator it;
@@ -412,9 +438,10 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s
412 QList<QListViewItem> tempList; 438 QList<QListViewItem> tempList;
413 tempList.setAutoDelete( true ); 439 tempList.setAutoDelete( true );
414 QListViewItem * child = deviceItem->firstChild(); 440 QListViewItem * child = deviceItem->firstChild();
415 while( child ) { 441 while( child )
416 tempList.append( child ); 442 {
417 child = child->nextSibling(); 443 tempList.append( child );
444 child = child->nextSibling();
418 } 445 }
419 tempList.clear(); 446 tempList.clear();
420 447
@@ -422,22 +449,27 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s
422 BTServiceItem* serviceItem; 449 BTServiceItem* serviceItem;
423 450
424 451
425 if (!servicesList.isEmpty() ) { 452 if (!servicesList.isEmpty() )
453 {
426 // add services 454 // add services
427 QMap<int, QString> list; 455 QMap<int, QString> list;
428 QMap<int, QString>::Iterator classIt; 456 QMap<int, QString>::Iterator classIt;
429 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 457 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 )
458 {
430 serviceItem = new BTServiceItem( deviceItem, (*it2) ); 459 serviceItem = new BTServiceItem( deviceItem, (*it2) );
431 list = (*it2).classIdList(); 460 list = (*it2).classIdList();
432 classIt = list.begin(); 461 classIt = list.begin();
433 int classId=0; 462 int classId=0;
434 if ( classIt != list.end() ) { 463 if ( classIt != list.end() )
464 {
435 classId = classIt.key(); 465 classId = classIt.key();
436 } 466 }
437 467
438 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); 468 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
439 } 469 }
440 } else { 470 }
471 else
472 {
441 Services s1; 473 Services s1;
442 s1.setServiceName( tr("no services found") ); 474 s1.setServiceName( tr("no services found") );
443 serviceItem = new BTServiceItem( deviceItem, s1 ); 475 serviceItem = new BTServiceItem( deviceItem, s1 );
@@ -450,82 +482,101 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s
450 482
451 483
452 484
453void BlueBase::addSignalStrength() { 485void BlueBase::addSignalStrength()
486{
454 487
455 QListViewItemIterator it( ListView4 ); 488 QListViewItemIterator it( ListView4 );
456 for ( ; it.current(); ++it ) { 489 for ( ; it.current(); ++it )
457 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() ); 490 {
458 } 491 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() );
492 }
459 493
460 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); 494 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) );
461} 495}
462 496
463void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) { 497void BlueBase::addSignalStrength( const QString& mac, const QString& strength )
498{
464 499
465 QListViewItemIterator it( ListView4 ); 500 QListViewItemIterator it( ListView4 );
466 for ( ; it.current(); ++it ) { 501 for ( ; it.current(); ++it )
467 if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) { 502 {
468 ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); 503 if( ((BTConnectionItem*)it.current())->connection().mac() == mac )
469 } 504 {
470 } 505 ((BTConnectionItem*)it.current() )->setSignalStrength( strength );
506 }
507 }
471} 508}
472 509
473/** 510/**
474 * Add the existing connections (pairs) to the connections tab. 511 * Add the existing connections (pairs) to the connections tab.
475 * This one triggers the search 512 * This one triggers the search
476 */ 513 */
477void BlueBase::addConnectedDevices() { 514void BlueBase::addConnectedDevices()
478 m_localDevice->searchConnections(); 515{
516 m_localDevice->searchConnections();
479} 517}
480 518
481/** 519/**
482 * This adds the found connections to the connection tab. 520 * This adds the found connections to the connection tab.
483 * @param connectionList the ValueList with all current connections 521 * @param connectionList the ValueList with all current connections
484 */ 522 */
485void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { 523void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
524{
486 525
487 QValueList<OpieTooth::ConnectionState>::Iterator it; 526 QValueList<OpieTooth::ConnectionState>::Iterator it;
488 BTConnectionItem * connectionItem; 527 BTConnectionItem * connectionItem;
489 528
490 if ( !connectionList.isEmpty() ) { 529 if ( !connectionList.isEmpty() )
530 {
491 531
492 for (it = connectionList.begin(); it != connectionList.end(); ++it) { 532 for (it = connectionList.begin(); it != connectionList.end(); ++it)
533 {
493 534
494 QListViewItemIterator it2( ListView4 ); 535 QListViewItemIterator it2( ListView4 );
495 bool found = false; 536 bool found = false;
496 for ( ; it2.current(); ++it2 ) { 537 for ( ; it2.current(); ++it2 )
497 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) { 538 {
498 found = true; 539 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() )
499 } 540 {
500 } 541 found = true;
542 }
543 }
501 544
502 if ( found == false ) { 545 if ( found == false )
503 connectionItem = new BTConnectionItem( ListView4, (*it) ); 546 {
547 connectionItem = new BTConnectionItem( ListView4, (*it) );
504 548
505 if( m_deviceList.find((*it).mac()).data() ) { 549 if( m_deviceList.find((*it).mac()).data() )
506 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); 550 {
507 } 551 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() );
508 } 552 }
553 }
509 554
510 } 555 }
511 556
512 QListViewItemIterator it2( ListView4 ); 557 QListViewItemIterator it2( ListView4 );
513 for ( ; it2.current(); ++it2 ) { 558 for ( ; it2.current(); ++it2 )
514 bool found = false; 559 {
515 for (it = connectionList.begin(); it != connectionList.end(); ++it) { 560 bool found = false;
516 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) { 561 for (it = connectionList.begin(); it != connectionList.end(); ++it)
517 found = true; 562 {
518 } 563 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() )
564 {
565 found = true;
566 }
519 } 567 }
520 568
521 if ( !found ) { 569 if ( !found )
522 delete it2.current(); 570 {
523 } 571 delete it2.current();
572 }
524 573
525 } 574 }
526 575
527 576
528 } else { 577 }
578 else
579 {
529 ListView4->clear(); 580 ListView4->clear();
530 ConnectionState con; 581 ConnectionState con;
531 con.setMac( tr("No connections found") ); 582 con.setMac( tr("No connections found") );
@@ -541,7 +592,8 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
541 * Find out if a device can currently be reached 592 * Find out if a device can currently be reached
542 * @param device 593 * @param device
543 */ 594 */
544void BlueBase::deviceActive( const RemoteDevice &device ) { 595void BlueBase::deviceActive( const RemoteDevice &device )
596{
545 // search by mac, async, gets a signal back 597 // search by mac, async, gets a signal back
546 // We should have a BTDeviceItem there or where does it get added to the map -zecke 598 // We should have a BTDeviceItem there or where does it get added to the map -zecke
547 m_localDevice->isAvailable( device.mac() ); 599 m_localDevice->isAvailable( device.mac() );
@@ -553,7 +605,8 @@ void BlueBase::deviceActive( const RemoteDevice &device ) {
553 * @param device - the mac address 605 * @param device - the mac address
554 * @param connected - if it is avail. or not 606 * @param connected - if it is avail. or not
555 */ 607 */
556void BlueBase::deviceActive( const QString& device, bool connected ) { 608void BlueBase::deviceActive( const QString& device, bool connected )
609{
557 qDebug("deviceActive slot"); 610 qDebug("deviceActive slot");
558 611
559 QMap<QString,BTDeviceItem*>::Iterator it; 612 QMap<QString,BTDeviceItem*>::Iterator it;
@@ -565,9 +618,12 @@ void BlueBase::deviceActive( const QString& device, bool connected ) {
565 BTDeviceItem* deviceItem = it.data(); 618 BTDeviceItem* deviceItem = it.data();
566 619
567 620
568 if ( connected ) { 621 if ( connected )
622 {
569 deviceItem->setPixmap( 1, m_onPix ); 623 deviceItem->setPixmap( 1, m_onPix );
570 } else { 624 }
625 else
626 {
571 deviceItem->setPixmap( 1, m_offPix ); 627 deviceItem->setPixmap( 1, m_offPix );
572 } 628 }
573 m_deviceList.remove( it ); 629 m_deviceList.remove( it );
@@ -577,20 +633,22 @@ void BlueBase::deviceActive( const QString& device, bool connected ) {
577/** 633/**
578 * Open the "scan for devices" dialog 634 * Open the "scan for devices" dialog
579 */ 635 */
580void BlueBase::startScan() { 636void BlueBase::startScan()
637{
581 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 638 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
582 true, WDestructiveClose ); 639 true, WDestructiveClose );
583 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), 640 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ),
584 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); 641 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) );
585 642
586 scan->showMaximized(); 643 QPEApplication::showDialog( scan );
587} 644}
588 645
589 646
590/** 647/**
591 * Set the informations about the local device in information Tab 648 * Set the informations about the local device in information Tab
592 */ 649 */
593void BlueBase::setInfo() { 650void BlueBase::setInfo()
651{
594 StatusLabel->setText( status() ); 652 StatusLabel->setText( status() );
595} 653}
596 654
@@ -598,7 +656,8 @@ void BlueBase::setInfo() {
598/** 656/**
599 * Decontructor 657 * Decontructor
600 */ 658 */
601BlueBase::~BlueBase() { 659BlueBase::~BlueBase()
660{
602 writeSavedDevices(); 661 writeSavedDevices();
603 delete m_iconLoader; 662 delete m_iconLoader;
604} 663}
@@ -610,11 +669,13 @@ BlueBase::~BlueBase() {
610 * @param dev RemoteDevice to find 669 * @param dev RemoteDevice to find
611 * @return returns true if found 670 * @return returns true if found
612 */ 671 */
613bool BlueBase::find( const RemoteDevice& rem ) { 672bool BlueBase::find( const RemoteDevice& rem )
673{
614 QListViewItemIterator it( ListView2 ); 674 QListViewItemIterator it( ListView2 );
615 BTListItem* item; 675 BTListItem* item;
616 BTDeviceItem* device; 676 BTDeviceItem* device;
617 for (; it.current(); ++it ) { 677 for (; it.current(); ++it )
678 {
618 item = (BTListItem*) it.current(); 679 item = (BTListItem*) it.current();
619 if ( item->typeId() != BTListItem::Device ) 680 if ( item->typeId() != BTListItem::Device )
620 continue; 681 continue;