summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index d2854a1..af64663 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -103,449 +103,456 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
103 (void) new BTServiceItem( topLV2, s1 ); 103 (void) new BTServiceItem( topLV2, s1 );
104 104
105 writeToHciConfig(); 105 writeToHciConfig();
106 // search conncetions 106 // search conncetions
107 addConnectedDevices(); 107 addConnectedDevices();
108 m_iconLoader = new BTIconLoader(); 108 m_iconLoader = new BTIconLoader();
109 readSavedDevices(); 109 readSavedDevices();
110} 110}
111 111
112/** 112/**
113 * Reads all options from the config file 113 * Reads all options from the config file
114 */ 114 */
115void BlueBase::readConfig() { 115void BlueBase::readConfig() {
116 116
117 Config cfg( "bluetoothmanager" ); 117 Config cfg( "bluetoothmanager" );
118 cfg.setGroup( "bluezsettings" ); 118 cfg.setGroup( "bluezsettings" );
119 119
120 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 120 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
121 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 121 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
122 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); 122 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE );
123 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); 123 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE );
124 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); 124 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE );
125 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); 125 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE );
126} 126}
127 127
128/** 128/**
129 * Writes all options to the config file 129 * Writes all options to the config file
130 */ 130 */
131void BlueBase::writeConfig() { 131void BlueBase::writeConfig() {
132 132
133 Config cfg( "bluetoothmanager" ); 133 Config cfg( "bluetoothmanager" );
134 cfg.setGroup( "bluezsettings" ); 134 cfg.setGroup( "bluezsettings" );
135 135
136 cfg.writeEntry( "name" , m_deviceName ); 136 cfg.writeEntry( "name" , m_deviceName );
137 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); 137 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey );
138 cfg.writeEntry( "useEncryption" , m_useEncryption ); 138 cfg.writeEntry( "useEncryption" , m_useEncryption );
139 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); 139 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification );
140 cfg.writeEntry( "enablePagescan" , m_enablePagescan ); 140 cfg.writeEntry( "enablePagescan" , m_enablePagescan );
141 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); 141 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan );
142 142
143 writeToHciConfig(); 143 writeToHciConfig();
144} 144}
145 145
146/** 146/**
147 * Modify the hcid.conf file to our needs 147 * Modify the hcid.conf file to our needs
148 */ 148 */
149void BlueBase::writeToHciConfig() { 149void BlueBase::writeToHciConfig() {
150 qWarning("writeToHciConfig"); 150 qWarning("writeToHciConfig");
151 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); 151 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
152 hciconf.load(); 152 hciconf.load();
153 hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); 153 hciconf.setPinHelper( "/bin/QtPalmtop/bin/blue-pin" );
154 hciconf.setName( m_deviceName ); 154 hciconf.setName( m_deviceName );
155 hciconf.setEncrypt( m_useEncryption ); 155 hciconf.setEncrypt( m_useEncryption );
156 hciconf.setAuth( m_enableAuthentification ); 156 hciconf.setAuth( m_enableAuthentification );
157 hciconf.setPscan( m_enablePagescan ); 157 hciconf.setPscan( m_enablePagescan );
158 hciconf.setIscan( m_enableInquiryscan ); 158 hciconf.setIscan( m_enableInquiryscan );
159 hciconf.save(); 159 hciconf.save();
160} 160}
161 161
162 162
163/** 163/**
164 * Read the list of allready known devices 164 * Read the list of allready known devices
165 * 165 *
166 */ 166 */
167void BlueBase::readSavedDevices() { 167void BlueBase::readSavedDevices() {
168 168
169 QValueList<RemoteDevice> loadedDevices; 169 QValueList<RemoteDevice> loadedDevices;
170 DeviceHandler handler; 170 DeviceHandler handler;
171 loadedDevices = handler.load(); 171 loadedDevices = handler.load();
172 172
173 addSearchedDevices( loadedDevices ); 173 addSearchedDevices( loadedDevices );
174} 174}
175 175
176 176
177/** 177/**
178 * Write the list of allready known devices 178 * Write the list of allready known devices
179 * 179 *
180 */ 180 */
181void BlueBase::writeSavedDevices() { 181void BlueBase::writeSavedDevices() {
182 QListViewItemIterator it( ListView2 ); 182 QListViewItemIterator it( ListView2 );
183 BTListItem* item; 183 BTListItem* item;
184 BTDeviceItem* device; 184 BTDeviceItem* device;
185 RemoteDevice::ValueList list; 185 RemoteDevice::ValueList list;
186 for ( ; it.current(); ++it ) { 186 for ( ; it.current(); ++it ) {
187 item = (BTListItem*)it.current(); 187 item = (BTListItem*)it.current();
188 if(item->typeId() != BTListItem::Device ) 188 if(item->typeId() != BTListItem::Device )
189 continue; 189 continue;
190 device = (BTDeviceItem*)item; 190 device = (BTDeviceItem*)item;
191 191
192 list.append( device->remoteDevice() ); 192 list.append( device->remoteDevice() );
193 } 193 }
194 /* 194 /*
195 * if not empty save the List through DeviceHandler 195 * if not empty save the List through DeviceHandler
196 */ 196 */
197 if ( list.isEmpty() ) 197 if ( list.isEmpty() )
198 return; 198 return;
199 DeviceHandler handler; 199 DeviceHandler handler;
200 handler.save( list ); 200 handler.save( list );
201} 201}
202 202
203 203
204/** 204/**
205 * Set up the gui 205 * Set up the gui
206 */ 206 */
207void BlueBase::initGui() { 207void BlueBase::initGui() {
208 StatusLabel->setText( status() ); // maybe move it to getStatus() 208 StatusLabel->setText( status() ); // maybe move it to getStatus()
209 cryptCheckBox->setChecked( m_useEncryption ); 209 cryptCheckBox->setChecked( m_useEncryption );
210 authCheckBox->setChecked( m_enableAuthentification ); 210 authCheckBox->setChecked( m_enableAuthentification );
211 pagescanCheckBox->setChecked( m_enablePagescan ); 211 pagescanCheckBox->setChecked( m_enablePagescan );
212 inquiryscanCheckBox->setChecked( m_enableInquiryscan ); 212 inquiryscanCheckBox->setChecked( m_enableInquiryscan );
213 deviceNameLine->setText( m_deviceName ); 213 deviceNameLine->setText( m_deviceName );
214 passkeyLine->setText( m_defaultPasskey ); 214 passkeyLine->setText( m_defaultPasskey );
215 // set info tab 215 // set info tab
216 setInfo(); 216 setInfo();
217} 217}
218 218
219 219
220/** 220/**
221 * Get the status informations and returns it 221 * Get the status informations and returns it
222 * @return QString the status informations gathered 222 * @return QString the status informations gathered
223 */ 223 */
224QString BlueBase::status()const{ 224QString BlueBase::status()const{
225 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 225 QString infoString = tr( "<b>Device name : </b> Ipaq" );
226 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 226 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
227 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 227 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
228 228
229 return (infoString); 229 return (infoString);
230} 230}
231 231
232 232
233/** 233/**
234 * Read the current values from the gui and invoke writeConfig() 234 * Read the current values from the gui and invoke writeConfig()
235 */ 235 */
236void BlueBase::applyConfigChanges() { 236void BlueBase::applyConfigChanges() {
237 m_deviceName = deviceNameLine->text(); 237 m_deviceName = deviceNameLine->text();
238 m_defaultPasskey = passkeyLine->text(); 238 m_defaultPasskey = passkeyLine->text();
239 m_useEncryption = cryptCheckBox->isChecked(); 239 m_useEncryption = cryptCheckBox->isChecked();
240 m_enableAuthentification = authCheckBox->isChecked(); 240 m_enableAuthentification = authCheckBox->isChecked();
241 m_enablePagescan = pagescanCheckBox->isChecked(); 241 m_enablePagescan = pagescanCheckBox->isChecked();
242 m_enableInquiryscan = inquiryscanCheckBox->isChecked(); 242 m_enableInquiryscan = inquiryscanCheckBox->isChecked();
243 243
244 writeConfig(); 244 writeConfig();
245 245
246 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); 246 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
247} 247}
248 248
249/** 249/**
250 * Add fresh found devices from scan dialog to the listing 250 * Add fresh found devices from scan dialog to the listing
251 * 251 *
252 */ 252 */
253void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { 253void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) {
254 BTDeviceItem * deviceItem; 254 BTDeviceItem * deviceItem;
255 QValueList<RemoteDevice>::ConstIterator it; 255 QValueList<RemoteDevice>::ConstIterator it;
256 256
257 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { 257 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) {
258 258
259 if (find( (*it) )) // is already inserted 259 if (find( (*it) )) // is already inserted
260 continue; 260 continue;
261 261
262 deviceItem = new BTDeviceItem( ListView2 , (*it) ); 262 deviceItem = new BTDeviceItem( ListView2 , (*it) );
263 deviceItem->setExpandable ( true ); 263 deviceItem->setExpandable ( true );
264 264
265 // look if device is avail. atm, async 265 // look if device is avail. atm, async
266 deviceActive( (*it) ); 266 deviceActive( (*it) );
267 267
268 // ggf auch hier? 268 // ggf auch hier?
269 addServicesToDevice( deviceItem ); 269 addServicesToDevice( deviceItem );
270 } 270 }
271} 271}
272 272
273 273
274/** 274/**
275 * Action that is toggled on entrys on click 275 * Action that is toggled on entrys on click
276 */ 276 */
277void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { 277void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) {
278} 278}
279 279
280 280
281/** 281/**
282 * Action that are toggled on hold (mostly QPopups i guess) 282 * Action that are toggled on hold (mostly QPopups i guess)
283 */ 283 */
284void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { 284void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) {
285 285
286 QPopupMenu *menu = new QPopupMenu(); 286 QPopupMenu *menu = new QPopupMenu();
287 int ret=0; 287 int ret=0;
288 288
289 if ( ((BTListItem*)item)->type() == "device") { 289 if ( ((BTListItem*)item)->type() == "device") {
290 290
291 QPopupMenu *groups = new QPopupMenu(); 291 QPopupMenu *groups = new QPopupMenu();
292 292
293 menu->insertItem( tr("rescan sevices:"), 0); 293 menu->insertItem( tr("rescan sevices:"), 0);
294 menu->insertItem( tr("to group"), groups , 1); 294 menu->insertItem( tr("to group"), groups , 1);
295 menu->insertItem( tr("bound device"), 2); 295 // menu->insertItem( tr("bound device"), 2);
296 menu->insertItem( tr("delete"), 3); 296 menu->insertItem( tr("delete"), 3);
297 297
298 ret = menu->exec( point , 0); 298 ret = menu->exec( point , 0);
299 299
300 switch(ret) { 300 switch(ret) {
301 case -1: 301 case -1:
302 302 break;
303 case 0:
304 addServicesToDevice( (BTDeviceItem*)item );
303 break; 305 break;
304 case 1: 306 case 1:
307
305 break; 308 break;
306 case 2: 309
310 // NO need to, since hcid does that on the fly
311 // case 2:
307 // make connection 312 // make connection
308 break; 313 //m_localDevice->connectTo( ((BTDeviceItem*)item)->mac() );
314 //break;
309 case 3: 315 case 3:
310 // delete childs too 316 // deletes childs too
311 delete item; 317 delete item;
312 break; 318 break;
313 } 319 }
314 delete groups; 320 delete groups;
315 321
316 } 322 }
317 323
318 /* 324 /*
319 * We got service sensitive PopupMenus in our factory 325 * We got service sensitive PopupMenus in our factory
320 * We will create one through the factory and will insert 326 * We will create one through the factory and will insert
321 * our Separator + ShowInfo into the menu or create a new 327 * our Separator + ShowInfo into the menu or create a new
322 * one if the factory returns 0 328 * one if the factory returns 0
323 * PopupMenu deletion is kind of weird. 329 * PopupMenu deletion is kind of weird.
324 * If escaped( -1 ) or any of our items were chosen we'll 330 * If escaped( -1 ) or any of our items were chosen we'll
325 * delete the PopupMenu otherwise it's the responsibility of 331 * delete the PopupMenu otherwise it's the responsibility of
326 * the PopupMenu to delete itself 332 * the PopupMenu to delete itself
327 * 333 *
328 */ 334 */
329 else if ( ((BTListItem*)item)->type() == "service") { 335 else if ( ((BTListItem*)item)->type() == "service") {
330 BTServiceItem* service = (BTServiceItem*)item; 336 BTServiceItem* service = (BTServiceItem*)item;
331 QMap<int, QString> list = service->services().classIdList(); 337 QMap<int, QString> list = service->services().classIdList();
332 QMap<int, QString>::Iterator it = list.begin(); 338 QMap<int, QString>::Iterator it = list.begin();
333 QPopupMenu *popup =0l; 339 QPopupMenu *popup =0l;
334 if ( it != list.end() ) { 340 if ( it != list.end() ) {
335 qWarning("Searching id %d %s", it.key(), it.data().latin1() ); 341 qWarning("Searching id %d %s", it.key(), it.data().latin1() );
336 popup = m_popHelper.find( it.key(), 342 popup = m_popHelper.find( it.key(),
337 service->services(), 343 service->services(),
338 service->parent() ); 344 service->parent() );
339 }else { 345 }else {
340 qWarning("Empty"); 346 qWarning("Empty");
341 } 347 }
342 348
343 if ( popup == 0l ) { 349 if ( popup == 0l ) {
344 qWarning("factory returned 0l"); 350 qWarning("factory returned 0l");
345 popup = new QPopupMenu(); 351 popup = new QPopupMenu();
346 } 352 }
347 353
348 int test1 = popup->insertItem( tr("Test1:"), 0); 354 int test1 = popup->insertItem( tr("Test1:"), 0);
349 int con = popup->insertItem( tr("connect"), 1); 355 int con = popup->insertItem( tr("connect"), 1);
350 int del = popup->insertItem( tr("delete"), 2); 356 int del = popup->insertItem( tr("delete"), 2);
351 357
352 ret = popup->exec( point ); 358 ret = popup->exec( point );
353 359
354 if ( ret == -1 ) 360 if ( ret == -1 )
355 delete popup; 361 delete popup;
356 else if ( ret == test1 ) 362 else if ( ret == test1 )
357 delete popup; 363 delete popup;
358 else if ( ret == con ) 364 else if ( ret == con )
359 delete popup; 365 delete popup;
360 else if ( ret == del ) { 366 else if ( ret == del ) {
361 // take item first? -zecke 367 // take item first? -zecke
362 delete item; 368 delete item;
363 } 369 }
364 } 370 }
365 delete menu; 371 delete menu;
366} 372}
367 373
368 374
369/** 375/**
370 * Search and display avail. services for a device (on expand from device listing) 376 * Search and display avail. services for a device (on expand from device listing)
371 * @param item the service item returned 377 * @param item the service item returned
372 */ 378 */
373void BlueBase::addServicesToDevice( BTDeviceItem * item ) { 379void BlueBase::addServicesToDevice( BTDeviceItem * item ) {
374 qDebug("addServicesToDevice"); 380 qDebug("addServicesToDevice");
375 // row of mac adress text(3) 381 // row of mac adress text(3)
376 RemoteDevice device = item->remoteDevice(); 382 RemoteDevice device = item->remoteDevice();
377 m_deviceList.insert( item->mac() , item ); 383 m_deviceList.insert( item->mac() , item );
378 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 384 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
379 m_localDevice->searchServices( device ); 385 m_localDevice->searchServices( device );
380} 386}
381 387
382 388
383/** 389/**
384 * Overloaded. This one it the one that is connected to the foundServices signal 390 * Overloaded. This one it the one that is connected to the foundServices signal
385 * @param device the mac address of the remote device 391 * @param device the mac address of the remote device
386 * @param servicesList the list with the service the device has. 392 * @param servicesList the list with the service the device has.
387 */ 393 */
388void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 394void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
389 qDebug("fill services list"); 395 qDebug("fill services list");
390 396
391 QMap<QString,BTDeviceItem*>::Iterator it; 397 QMap<QString,BTDeviceItem*>::Iterator it;
392 BTDeviceItem* deviceItem = 0; 398 BTDeviceItem* deviceItem = 0;
393 399
394 // get the right devices which requested the search 400 // get the right devices which requested the search
395 it = m_deviceList.find( device ); 401 it = m_deviceList.find( device );
396 if( it == m_deviceList.end() ) 402 if( it == m_deviceList.end() )
397 return; 403 return;
398 deviceItem = it.data(); 404 deviceItem = it.data();
399 405
400 QValueList<OpieTooth::Services>::Iterator it2; 406 QValueList<OpieTooth::Services>::Iterator it2;
401 BTServiceItem * serviceItem; 407 BTServiceItem * serviceItem;
402 408
403 if (!servicesList.isEmpty() ) { 409 if (!servicesList.isEmpty() ) {
404 // add services 410 // add services
405 QMap<int, QString> list; 411 QMap<int, QString> list;
406 QMap<int, QString>::Iterator classIt; 412 QMap<int, QString>::Iterator classIt;
407 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 413 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
408 serviceItem = new BTServiceItem( deviceItem , (*it2) ); 414 serviceItem = new BTServiceItem( deviceItem , (*it2) );
409 list = (*it2).classIdList(); 415 list = (*it2).classIdList();
410 classIt = list.begin(); 416 classIt = list.begin();
411 int classId=0; 417 int classId=0;
412 if ( classIt != list.end() ) 418 if ( classIt != list.end() ) {
413 classId = classIt.key(); 419 classId = classIt.key();
420 }
414 421
415 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); 422 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
416 } 423 }
417 } else { 424 } else {
418 Services s1; 425 Services s1;
419 s1.setServiceName( tr("no serives found") ); 426 s1.setServiceName( tr("no serives found") );
420 serviceItem = new BTServiceItem( deviceItem, s1 ); 427 serviceItem = new BTServiceItem( deviceItem, s1 );
421 } 428 }
422 // now remove them from the list 429 // now remove them from the list
423 m_deviceList.remove( it ); 430 m_deviceList.remove( it );
424} 431}
425 432
426 433
427/** 434/**
428 * Add the existing connections (pairs) to the connections tab. 435 * Add the existing connections (pairs) to the connections tab.
429 * This one triggers the search 436 * This one triggers the search
430 */ 437 */
431void BlueBase::addConnectedDevices() { 438void BlueBase::addConnectedDevices() {
432 m_localDevice->searchConnections(); 439 m_localDevice->searchConnections();
433} 440}
434 441
435 442
436/** 443/**
437 * This adds the found connections to the connection tab. 444 * This adds the found connections to the connection tab.
438 * @param connectionList the ValueList with all current connections 445 * @param connectionList the ValueList with all current connections
439 */ 446 */
440void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { 447void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) {
441 448
442 // clear the ListView first 449 // clear the ListView first
443 ListView4->clear(); 450 ListView4->clear();
444 451
445 QValueList<OpieTooth::ConnectionState>::Iterator it; 452 QValueList<OpieTooth::ConnectionState>::Iterator it;
446 BTConnectionItem * connectionItem; 453 BTConnectionItem * connectionItem;
447 454
448 if ( !connectionList.isEmpty() ) { 455 if ( !connectionList.isEmpty() ) {
449 456
450 for (it = connectionList.begin(); it != connectionList.end(); ++it) { 457 for (it = connectionList.begin(); it != connectionList.end(); ++it) {
451 connectionItem = new BTConnectionItem( ListView4 , (*it) ); 458 connectionItem = new BTConnectionItem( ListView4 , (*it) );
452 } 459 }
453 } else { 460 } else {
454 ConnectionState con; 461 ConnectionState con;
455 con.setMac( tr("No connections found") ); 462 con.setMac( tr("No connections found") );
456 connectionItem = new BTConnectionItem( ListView4 , con ); 463 connectionItem = new BTConnectionItem( ListView4 , con );
457 } 464 }
458 465
459 // recall connection search after some time 466 // recall connection search after some time
460 QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) ); 467 QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) );
461} 468}
462 469
463 470
464/** 471/**
465 * Find out if a device can currently be reached 472 * Find out if a device can currently be reached
466 * @param device 473 * @param device
467 */ 474 */
468void BlueBase::deviceActive( const RemoteDevice &device ) { 475void BlueBase::deviceActive( const RemoteDevice &device ) {
469 // search by mac, async, gets a signal back 476 // search by mac, async, gets a signal back
470 // We should have a BTDeviceItem there or where does it get added to the map -zecke 477 // We should have a BTDeviceItem there or where does it get added to the map -zecke
471 m_localDevice->isAvailable( device.mac() ); 478 m_localDevice->isAvailable( device.mac() );
472} 479}
473 480
474 481
475/** 482/**
476 * The signal catcher. Set the avail. status on device. 483 * The signal catcher. Set the avail. status on device.
477 * @param device - the mac address 484 * @param device - the mac address
478 * @param connected - if it is avail. or not 485 * @param connected - if it is avail. or not
479 */ 486 */
480void BlueBase::deviceActive( const QString& device, bool connected ) { 487void BlueBase::deviceActive( const QString& device, bool connected ) {
481 qDebug("deviceActive slot"); 488 qDebug("deviceActive slot");
482 489
483 QMap<QString,BTDeviceItem*>::Iterator it; 490 QMap<QString,BTDeviceItem*>::Iterator it;
484 491
485 it = m_deviceList.find( device ); 492 it = m_deviceList.find( device );
486 if( it == m_deviceList.end() ) 493 if( it == m_deviceList.end() )
487 return; 494 return;
488 495
489 BTDeviceItem* deviceItem = it.data(); 496 BTDeviceItem* deviceItem = it.data();
490 497
491 498
492 if ( connected ) { 499 if ( connected ) {
493 deviceItem->setPixmap( 1, m_onPix ); 500 deviceItem->setPixmap( 1, m_onPix );
494 } else { 501 } else {
495 deviceItem->setPixmap( 1, m_offPix ); 502 deviceItem->setPixmap( 1, m_offPix );
496 } 503 }
497 m_deviceList.remove( it ); 504 m_deviceList.remove( it );
498} 505}
499 506
500 507
501/** 508/**
502 * Open the "scan for devices" dialog 509 * Open the "scan for devices" dialog
503 */ 510 */
504void BlueBase::startScan() { 511void BlueBase::startScan() {
505 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 512 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
506 true, WDestructiveClose ); 513 true, WDestructiveClose );
507 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ), 514 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ),
508 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) ); 515 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) );
509 516
510 scan->showMaximized(); 517 scan->showMaximized();
511} 518}
512 519
513 520
514/** 521/**
515 * Set the informations about the local device in information Tab 522 * Set the informations about the local device in information Tab
516 */ 523 */
517void BlueBase::setInfo() { 524void BlueBase::setInfo() {
518 StatusLabel->setText( status() ); 525 StatusLabel->setText( status() );
519} 526}
520 527
521 528
522/** 529/**
523 * Decontructor 530 * Decontructor
524 */ 531 */
525BlueBase::~BlueBase() { 532BlueBase::~BlueBase() {
526 writeSavedDevices(); 533 writeSavedDevices();
527 delete m_iconLoader; 534 delete m_iconLoader;
528} 535}
529 536
530 537
531/** 538/**
532 * find searches the ListView for a BTDeviceItem containig 539 * find searches the ListView for a BTDeviceItem containig
533 * the same Device if found return true else false 540 * the same Device if found return true else false
534 * @param dev RemoteDevice to find 541 * @param dev RemoteDevice to find
535 * @return returns true if found 542 * @return returns true if found
536 */ 543 */
537bool BlueBase::find( const RemoteDevice& rem ) { 544bool BlueBase::find( const RemoteDevice& rem ) {
538 QListViewItemIterator it( ListView2 ); 545 QListViewItemIterator it( ListView2 );
539 BTListItem* item; 546 BTListItem* item;
540 BTDeviceItem* device; 547 BTDeviceItem* device;
541 for (; it.current(); ++it ) { 548 for (; it.current(); ++it ) {
542 item = (BTListItem*) it.current(); 549 item = (BTListItem*) it.current();
543 if ( item->typeId() != BTListItem::Device ) 550 if ( item->typeId() != BTListItem::Device )
544 continue; 551 continue;
545 552
546 device = (BTDeviceItem*)item; 553 device = (BTDeviceItem*)item;
547 if ( rem.equals( device->remoteDevice() ) ) 554 if ( rem.equals( device->remoteDevice() ) )
548 return true; 555 return true;
549 } 556 }
550 return false; // not found 557 return false; // not found
551} 558}