Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 29030ab..b1cddd2 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -134,49 +134,49 @@ void BlueBase::readConfig() | |||
134 | /** | 134 | /** |
135 | * Writes all options to the config file | 135 | * Writes all options to the config file |
136 | */ | 136 | */ |
137 | void BlueBase::writeConfig() | 137 | void BlueBase::writeConfig() |
138 | { | 138 | { |
139 | 139 | ||
140 | Config cfg( "bluetoothmanager" ); | 140 | Config cfg( "bluetoothmanager" ); |
141 | cfg.setGroup( "bluezsettings" ); | 141 | cfg.setGroup( "bluezsettings" ); |
142 | 142 | ||
143 | cfg.writeEntry( "name" , m_deviceName ); | 143 | cfg.writeEntry( "name" , m_deviceName ); |
144 | cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); | 144 | cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); |
145 | cfg.writeEntry( "useEncryption" , m_useEncryption ); | 145 | cfg.writeEntry( "useEncryption" , m_useEncryption ); |
146 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); | 146 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); |
147 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); | 147 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); |
148 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); | 148 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); |
149 | 149 | ||
150 | writeToHciConfig(); | 150 | writeToHciConfig(); |
151 | } | 151 | } |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Modify the hcid.conf file to our needs | 154 | * Modify the hcid.conf file to our needs |
155 | */ | 155 | */ |
156 | void BlueBase::writeToHciConfig() | 156 | void BlueBase::writeToHciConfig() |
157 | { | 157 | { |
158 | qWarning("writeToHciConfig"); | 158 | owarn << "writeToHciConfig" << oendl; |
159 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); | 159 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); |
160 | hciconf.load(); | 160 | hciconf.load(); |
161 | hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" ); | 161 | hciconf.setPinHelper( "/opt/QtPalmtop/bin/bluepin" ); |
162 | hciconf.setName( m_deviceName ); | 162 | hciconf.setName( m_deviceName ); |
163 | hciconf.setEncrypt( m_useEncryption ); | 163 | hciconf.setEncrypt( m_useEncryption ); |
164 | hciconf.setAuth( m_enableAuthentification ); | 164 | hciconf.setAuth( m_enableAuthentification ); |
165 | hciconf.setPscan( m_enablePagescan ); | 165 | hciconf.setPscan( m_enablePagescan ); |
166 | hciconf.setIscan( m_enableInquiryscan ); | 166 | hciconf.setIscan( m_enableInquiryscan ); |
167 | hciconf.save(); | 167 | hciconf.save(); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Read the list of allready known devices | 172 | * Read the list of allready known devices |
173 | */ | 173 | */ |
174 | void BlueBase::readSavedDevices() | 174 | void BlueBase::readSavedDevices() |
175 | { | 175 | { |
176 | 176 | ||
177 | QValueList<RemoteDevice> loadedDevices; | 177 | QValueList<RemoteDevice> loadedDevices; |
178 | DeviceHandler handler; | 178 | DeviceHandler handler; |
179 | loadedDevices = handler.load(); | 179 | loadedDevices = handler.load(); |
180 | 180 | ||
181 | addSearchedDevices( loadedDevices ); | 181 | addSearchedDevices( loadedDevices ); |
182 | } | 182 | } |
@@ -346,105 +346,105 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin | |||
346 | } | 346 | } |
347 | delete groups; | 347 | delete groups; |
348 | 348 | ||
349 | } | 349 | } |
350 | 350 | ||
351 | /* | 351 | /* |
352 | * We got service sensitive PopupMenus in our factory | 352 | * We got service sensitive PopupMenus in our factory |
353 | * We will create one through the factory and will insert | 353 | * We will create one through the factory and will insert |
354 | * our Separator + ShowInfo into the menu or create a new | 354 | * our Separator + ShowInfo into the menu or create a new |
355 | * one if the factory returns 0 | 355 | * one if the factory returns 0 |
356 | * PopupMenu deletion is kind of weird. | 356 | * PopupMenu deletion is kind of weird. |
357 | * If escaped( -1 ) or any of our items were chosen we'll | 357 | * If escaped( -1 ) or any of our items were chosen we'll |
358 | * delete the PopupMenu otherwise it's the responsibility of | 358 | * delete the PopupMenu otherwise it's the responsibility of |
359 | * the PopupMenu to delete itself | 359 | * the PopupMenu to delete itself |
360 | * | 360 | * |
361 | */ | 361 | */ |
362 | else if ( ((BTListItem*)item)->type() == "service") | 362 | else if ( ((BTListItem*)item)->type() == "service") |
363 | { | 363 | { |
364 | BTServiceItem* service = (BTServiceItem*)item; | 364 | BTServiceItem* service = (BTServiceItem*)item; |
365 | QMap<int, QString> list = service->services().classIdList(); | 365 | QMap<int, QString> list = service->services().classIdList(); |
366 | QMap<int, QString>::Iterator it = list.begin(); | 366 | QMap<int, QString>::Iterator it = list.begin(); |
367 | QPopupMenu *popup =0l; | 367 | QPopupMenu *popup =0l; |
368 | if ( it != list.end() ) | 368 | if ( it != list.end() ) |
369 | { | 369 | { |
370 | qWarning("Searching id %d %s", it.key(), it.data().latin1() ); | 370 | owarn << "Searching id " << it.key() << " " << it.data().latin1() << "" << oendl; |
371 | popup = m_popHelper.find( it.key(), | 371 | popup = m_popHelper.find( it.key(), |
372 | service->services(), | 372 | service->services(), |
373 | (BTDeviceItem*)service->parent() ); | 373 | (BTDeviceItem*)service->parent() ); |
374 | } | 374 | } |
375 | else | 375 | else |
376 | { | 376 | { |
377 | qWarning("Empty"); | 377 | owarn << "Empty" << oendl; |
378 | } | 378 | } |
379 | 379 | ||
380 | if ( popup == 0l ) | 380 | if ( popup == 0l ) |
381 | { | 381 | { |
382 | qWarning("factory returned 0l"); | 382 | owarn << "factory returned 0l" << oendl; |
383 | popup = new QPopupMenu(); | 383 | popup = new QPopupMenu(); |
384 | } | 384 | } |
385 | int test1 = popup->insertItem( tr("Test1:"), 2); | 385 | int test1 = popup->insertItem( tr("Test1:"), 2); |
386 | 386 | ||
387 | ret = popup->exec( point ); | 387 | ret = popup->exec( point ); |
388 | qWarning("returned from exec() "); | 388 | owarn << "returned from exec() " << oendl; |
389 | if ( ret == -1 ) | 389 | if ( ret == -1 ) |
390 | { | 390 | { |
391 | ; | 391 | ; |
392 | } | 392 | } |
393 | else if ( ret == test1 ) | 393 | else if ( ret == test1 ) |
394 | { | 394 | { |
395 | ; | 395 | ; |
396 | } | 396 | } |
397 | delete popup; | 397 | delete popup; |
398 | } | 398 | } |
399 | delete menu; | 399 | delete menu; |
400 | } | 400 | } |
401 | 401 | ||
402 | 402 | ||
403 | /** | 403 | /** |
404 | * 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) |
405 | * @param item the service item returned | 405 | * @param item the service item returned |
406 | */ | 406 | */ |
407 | void BlueBase::addServicesToDevice( BTDeviceItem * item ) | 407 | void BlueBase::addServicesToDevice( BTDeviceItem * item ) |
408 | { | 408 | { |
409 | qDebug("addServicesToDevice"); | 409 | odebug << "addServicesToDevice" << oendl; |
410 | // row of mac adress text(3) | 410 | // row of mac adress text(3) |
411 | RemoteDevice device = item->remoteDevice(); | 411 | RemoteDevice device = item->remoteDevice(); |
412 | m_deviceList.insert( item->mac() , item ); | 412 | m_deviceList.insert( item->mac() , item ); |
413 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back | 413 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back |
414 | m_localDevice->searchServices( device ); | 414 | m_localDevice->searchServices( device ); |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | /** | 418 | /** |
419 | * Overloaded. This one it the one that is | 419 | * Overloaded. This one it the one that is |
420 | ted to the foundServices signal | 420 | ted to the foundServices signal |
421 | * @param device the mac address of the remote device | 421 | * @param device the mac address of the remote device |
422 | * @param servicesList the list with the service the device has. | 422 | * @param servicesList the list with the service the device has. |
423 | */ | 423 | */ |
424 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) | 424 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) |
425 | { | 425 | { |
426 | qDebug("fill services list"); | 426 | odebug << "fill services list" << oendl; |
427 | 427 | ||
428 | QMap<QString,BTDeviceItem*>::Iterator it; | 428 | QMap<QString,BTDeviceItem*>::Iterator it; |
429 | BTDeviceItem* deviceItem = 0; | 429 | BTDeviceItem* deviceItem = 0; |
430 | 430 | ||
431 | // get the right devices which requested the search | 431 | // get the right devices which requested the search |
432 | it = m_deviceList.find( device ); | 432 | it = m_deviceList.find( device ); |
433 | if( it == m_deviceList.end() ) | 433 | if( it == m_deviceList.end() ) |
434 | return; | 434 | return; |
435 | deviceItem = it.data(); | 435 | deviceItem = it.data(); |
436 | 436 | ||
437 | // remove previous entries | 437 | // remove previous entries |
438 | QList<QListViewItem> tempList; | 438 | QList<QListViewItem> tempList; |
439 | tempList.setAutoDelete( true ); | 439 | tempList.setAutoDelete( true ); |
440 | QListViewItem * child = deviceItem->firstChild(); | 440 | QListViewItem * child = deviceItem->firstChild(); |
441 | while( child ) | 441 | while( child ) |
442 | { | 442 | { |
443 | tempList.append( child ); | 443 | tempList.append( child ); |
444 | child = child->nextSibling(); | 444 | child = child->nextSibling(); |
445 | } | 445 | } |
446 | tempList.clear(); | 446 | tempList.clear(); |
447 | 447 | ||
448 | QValueList<OpieTooth::Services>::Iterator it2; | 448 | QValueList<OpieTooth::Services>::Iterator it2; |
449 | BTServiceItem* serviceItem; | 449 | BTServiceItem* serviceItem; |
450 | 450 | ||
@@ -586,49 +586,49 @@ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) | |||
586 | // recall connection search after some time | 586 | // recall connection search after some time |
587 | QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); | 587 | QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); |
588 | } | 588 | } |
589 | 589 | ||
590 | 590 | ||
591 | /** | 591 | /** |
592 | * Find out if a device can currently be reached | 592 | * Find out if a device can currently be reached |
593 | * @param device | 593 | * @param device |
594 | */ | 594 | */ |
595 | void BlueBase::deviceActive( const RemoteDevice &device ) | 595 | void BlueBase::deviceActive( const RemoteDevice &device ) |
596 | { | 596 | { |
597 | // search by mac, async, gets a signal back | 597 | // search by mac, async, gets a signal back |
598 | // 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 |
599 | m_localDevice->isAvailable( device.mac() ); | 599 | m_localDevice->isAvailable( device.mac() ); |
600 | } | 600 | } |
601 | 601 | ||
602 | 602 | ||
603 | /** | 603 | /** |
604 | * The signal catcher. Set the avail. status on device. | 604 | * The signal catcher. Set the avail. status on device. |
605 | * @param device - the mac address | 605 | * @param device - the mac address |
606 | * @param connected - if it is avail. or not | 606 | * @param connected - if it is avail. or not |
607 | */ | 607 | */ |
608 | void BlueBase::deviceActive( const QString& device, bool connected ) | 608 | void BlueBase::deviceActive( const QString& device, bool connected ) |
609 | { | 609 | { |
610 | qDebug("deviceActive slot"); | 610 | odebug << "deviceActive slot" << oendl; |
611 | 611 | ||
612 | QMap<QString,BTDeviceItem*>::Iterator it; | 612 | QMap<QString,BTDeviceItem*>::Iterator it; |
613 | 613 | ||
614 | it = m_deviceList.find( device ); | 614 | it = m_deviceList.find( device ); |
615 | if( it == m_deviceList.end() ) | 615 | if( it == m_deviceList.end() ) |
616 | return; | 616 | return; |
617 | 617 | ||
618 | BTDeviceItem* deviceItem = it.data(); | 618 | BTDeviceItem* deviceItem = it.data(); |
619 | 619 | ||
620 | 620 | ||
621 | if ( connected ) | 621 | if ( connected ) |
622 | { | 622 | { |
623 | deviceItem->setPixmap( 1, m_onPix ); | 623 | deviceItem->setPixmap( 1, m_onPix ); |
624 | } | 624 | } |
625 | else | 625 | else |
626 | { | 626 | { |
627 | deviceItem->setPixmap( 1, m_offPix ); | 627 | deviceItem->setPixmap( 1, m_offPix ); |
628 | } | 628 | } |
629 | m_deviceList.remove( it ); | 629 | m_deviceList.remove( it ); |
630 | } | 630 | } |
631 | 631 | ||
632 | 632 | ||
633 | /** | 633 | /** |
634 | * Open the "scan for devices" dialog | 634 | * Open the "scan for devices" dialog |