summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/bluebase.cpp
Unidiff
Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index b5a09e5..04fa117 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -240,193 +240,193 @@ void BlueBase::applyConfigChanges() {
240 m_enableInquiryscan = inquiryscanCheckBox->isChecked(); 240 m_enableInquiryscan = inquiryscanCheckBox->isChecked();
241 241
242 writeConfig(); 242 writeConfig();
243 243
244 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); 244 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
245} 245}
246 246
247/** 247/**
248 * Add fresh found devices from scan dialog to the listing 248 * Add fresh found devices from scan dialog to the listing
249 * 249 *
250 */ 250 */
251void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { 251void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) {
252 BTDeviceItem * deviceItem; 252 BTDeviceItem * deviceItem;
253 QValueList<RemoteDevice>::ConstIterator it; 253 QValueList<RemoteDevice>::ConstIterator it;
254 254
255 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { 255 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) {
256 256
257 if (find( (*it) )) // is already inserted 257 if (find( (*it) )) // is already inserted
258 continue; 258 continue;
259 259
260 deviceItem = new BTDeviceItem( ListView2 , (*it) ); 260 deviceItem = new BTDeviceItem( ListView2 , (*it) );
261 deviceItem->setPixmap( 1, m_findPix ); 261 deviceItem->setPixmap( 1, m_findPix );
262 deviceItem->setExpandable ( true ); 262 deviceItem->setExpandable ( true );
263 263
264 // look if device is avail. atm, async 264 // look if device is avail. atm, async
265 deviceActive( (*it) ); 265 deviceActive( (*it) );
266 266
267 // ggf auch hier? 267 // ggf auch hier?
268 addServicesToDevice( deviceItem ); 268 addServicesToDevice( deviceItem );
269 } 269 }
270} 270}
271 271
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( it.key() /*1*/, 336 popup = m_popHelper.find( 4358,
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();
401 } 401 }
402 tempList.clear(); 402 tempList.clear();
403 403
404 QValueList<OpieTooth::Services>::Iterator it2; 404 QValueList<OpieTooth::Services>::Iterator it2;
405 BTServiceItem* serviceItem; 405 BTServiceItem* serviceItem;
406 406
407 407
408 if (!servicesList.isEmpty() ) { 408 if (!servicesList.isEmpty() ) {
409 // add services 409 // add services
410 QMap<int, QString> list; 410 QMap<int, QString> list;
411 QMap<int, QString>::Iterator classIt; 411 QMap<int, QString>::Iterator classIt;
412 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 412 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
413 serviceItem = new BTServiceItem( deviceItem, (*it2) ); 413 serviceItem = new BTServiceItem( deviceItem, (*it2) );
414 list = (*it2).classIdList(); 414 list = (*it2).classIdList();
415 classIt = list.begin(); 415 classIt = list.begin();
416 int classId=0; 416 int classId=0;
417 if ( classIt != list.end() ) { 417 if ( classIt != list.end() ) {
418 classId = classIt.key(); 418 classId = classIt.key();
419 } 419 }
420 420
421 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); 421 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
422 } 422 }
423 } else { 423 } else {
424 Services s1; 424 Services s1;
425 s1.setServiceName( tr("no services found") ); 425 s1.setServiceName( tr("no services found") );
426 serviceItem = new BTServiceItem( deviceItem, s1 ); 426 serviceItem = new BTServiceItem( deviceItem, s1 );
427 } 427 }
428 // now remove them from the list 428 // now remove them from the list
429 m_deviceList.remove( it ); 429 m_deviceList.remove( it );
430} 430}
431 431
432 432