summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/opietooth2/Opietooth.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/opietooth2/Opietooth.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/Opietooth.cpp b/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
index 8323549..fc30bf8 100644
--- a/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
+++ b/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
@@ -163,49 +163,48 @@ void OTSniffing::SLOT_Trace( bool Run ) {
163 this, 163 this,
164 SLOT( SLOT_Show( const QString & ) ) ); 164 SLOT( SLOT_Show( const QString & ) ) );
165 165
166 connect( HciDump, 166 connect( HciDump,
167 SIGNAL(processExited(MyProcess*) ), 167 SIGNAL(processExited(MyProcess*) ),
168 this, 168 this,
169 SLOT( SLOT_ProcessExited(MyProcess*) ) ); 169 SLOT( SLOT_ProcessExited(MyProcess*) ) );
170 170
171 HciDump->process() << SL; 171 HciDump->process() << SL;
172 172
173 if( ! HciDump->process().start( OProcess::DontCare, 173 if( ! HciDump->process().start( OProcess::DontCare,
174 OProcess::AllOutput ) 174 OProcess::AllOutput )
175 ) { 175 ) {
176 QMessageBox::warning(0, 176 QMessageBox::warning(0,
177 tr("Run hcidump"), 177 tr("Run hcidump"),
178 tr("Cannot start %1").arg(SL.join(" ")) 178 tr("Cannot start %1").arg(SL.join(" "))
179 ); 179 );
180 delete HciDump; 180 delete HciDump;
181 HciDump = 0; 181 HciDump = 0;
182 } 182 }
183 183
184} 184}
185 185
186void OTSniffing::SLOT_Show( const QString & S ) { 186void OTSniffing::SLOT_Show( const QString & S ) {
187 printf( "%s\n", S.latin1() );
188 Output_TV->setText( Output_TV->text() + S + "\n" ); 187 Output_TV->setText( Output_TV->text() + S + "\n" );
189 188
190 QScrollBar *scroll = Output_TV->verticalScrollBar(); 189 QScrollBar *scroll = Output_TV->verticalScrollBar();
191 scroll->setValue(scroll->maxValue()); 190 scroll->setValue(scroll->maxValue());
192 //Output_LB->insertItem( S ); 191 //Output_LB->insertItem( S );
193 //Output_LB->setCurrentItem( Output_LB->count()-1 ); 192 //Output_LB->setCurrentItem( Output_LB->count()-1 );
194 //Output_LB->ensureCurrentVisible(); 193 //Output_LB->ensureCurrentVisible();
195} 194}
196 195
197void OTSniffing::SLOT_ProcessExited( MyProcess * ) { 196void OTSniffing::SLOT_ProcessExited( MyProcess * ) {
198 printf( "Exited\n" ); 197 printf( "Exited\n" );
199 delete HciDump; 198 delete HciDump;
200 HciDump = 0; 199 HciDump = 0;
201} 200}
202 201
203void OTSniffing::SLOT_Save( void ) { 202void OTSniffing::SLOT_Save( void ) {
204 QString S = OFileDialog::getSaveFileName( 203 QString S = OFileDialog::getSaveFileName(
205 OFileSelector::Extended, 204 OFileSelector::Extended,
206 QDir::home().path(), 205 QDir::home().path(),
207 QString::null, 206 QString::null,
208 MimeTypes(), 207 MimeTypes(),
209 this ); 208 this );
210 209
211 if( ! S.isEmpty() ) { 210 if( ! S.isEmpty() ) {
@@ -356,48 +355,49 @@ void OTPairing::SLOT_Unpair( ) {
356 tr("Sure ?"), 355 tr("Sure ?"),
357 tr("Yes, break"), 356 tr("Yes, break"),
358 tr("No, don't break") ) == 0 ) { 357 tr("No, don't break") ) == 0 ) {
359 LinkKeyLVI * KPIt = (LinkKeyLVI *)it; 358 LinkKeyLVI * KPIt = (LinkKeyLVI *)it;
360 // break 359 // break
361 OT->removeLinkKey( KPIt->index() ); 360 OT->removeLinkKey( KPIt->index() );
362 delete KPIt; 361 delete KPIt;
363 } 362 }
364 return; 363 return;
365 } 364 }
366 it= it->nextSibling(); 365 it= it->nextSibling();
367 } 366 }
368} 367}
369 368
370// 369//
371// 370//
372// 371//
373// 372//
374// 373//
375 374
376OTScan::OTScan( QWidget * parent, OTIcons * _IC ) : 375OTScan::OTScan( QWidget * parent, OTIcons * _IC ) :
377 OTScanGUI( parent ), Filter() { 376 OTScanGUI( parent ), Filter() {
378 377
379 OT = OTGateway::getOTGateway(); 378 OT = OTGateway::getOTGateway();
379
380 Icons = (_IC ) ? _IC : new OTIcons(); 380 Icons = (_IC ) ? _IC : new OTIcons();
381 MyIcons = (_IC == 0 ); 381 MyIcons = (_IC == 0 );
382 DetectedPeers_LV->header()->hide(); 382 DetectedPeers_LV->header()->hide();
383 Current = 0; 383 Current = 0;
384 SelectedPeer = 0; 384 SelectedPeer = 0;
385 SelectedChannel = 0; 385 SelectedChannel = 0;
386 386
387 StrengthTimer = new QTimer( this ); 387 StrengthTimer = new QTimer( this );
388 connect( StrengthTimer, 388 connect( StrengthTimer,
389 SIGNAL( timeout()), 389 SIGNAL( timeout()),
390 this, 390 this,
391 SLOT( SLOT_UpdateStrength()) 391 SLOT( SLOT_UpdateStrength())
392 ); 392 );
393 393
394 connect( OT, 394 connect( OT,
395 SIGNAL( detectedPeer( OTPeer *, bool )), 395 SIGNAL( detectedPeer( OTPeer *, bool )),
396 this, 396 this,
397 SLOT( SLOT_NewPeer( OTPeer *, bool )) 397 SLOT( SLOT_NewPeer( OTPeer *, bool ))
398 ); 398 );
399 connect( OT, 399 connect( OT,
400 SIGNAL( finishedDetecting()), 400 SIGNAL( finishedDetecting()),
401 this, 401 this,
402 SLOT( SLOT_FinishedDetecting()) 402 SLOT( SLOT_FinishedDetecting())
403 ); 403 );
@@ -423,48 +423,56 @@ OTScan::OTScan( QWidget * parent, OTIcons * _IC ) :
423} 423}
424 424
425OTScan::~OTScan() { 425OTScan::~OTScan() {
426 if( MyIcons ) 426 if( MyIcons )
427 delete Icons; 427 delete Icons;
428 OTGateway::releaseOTGateway(); 428 OTGateway::releaseOTGateway();
429 429
430 // send all peers that we do not care about states 430 // send all peers that we do not care about states
431 QListViewItem * Lit = DetectedPeers_LV->firstChild(); 431 QListViewItem * Lit = DetectedPeers_LV->firstChild();
432 while( Lit ) { 432 while( Lit ) {
433 ((PeerLVI *)Lit)->peer()->stopFindingOutState( ); 433 ((PeerLVI *)Lit)->peer()->stopFindingOutState( );
434 Lit = Lit->nextSibling(); 434 Lit = Lit->nextSibling();
435 } 435 }
436} 436}
437 437
438// static scan dialog function 438// static scan dialog function
439int OTScan::getDevice( OTPeer *& Peer, 439int OTScan::getDevice( OTPeer *& Peer,
440 int & Channel, 440 int & Channel,
441 OTGateway * OT, 441 OTGateway * OT,
442 const UUIDVector & Filter, 442 const UUIDVector & Filter,
443 QWidget* Parent ) { 443 QWidget* Parent ) {
444 bool IsUp = 0; 444 bool IsUp = 0;
445 unsigned int i; 445 unsigned int i;
446 446
447 if( ! OT->isEnabled() ) {
448 QMessageBox::warning( 0,
449 tr("Scanning problem"),
450 tr("Bluetooth not enabled" )
451 );
452 return QDialog::Rejected;
453 }
454
447 // check if bluetooth is up 455 // check if bluetooth is up
448 OTDriverList & DL = OT->getDriverList(); 456 OTDriverList & DL = OT->getDriverList();
449 for( i = 0; 457 for( i = 0;
450 i < DL.count(); 458 i < DL.count();
451 i ++ ) { 459 i ++ ) {
452 if( DL[i]->isUp() ) { 460 if( DL[i]->isUp() ) {
453 // one device that is up found 461 // one device that is up found
454 IsUp = 1; 462 IsUp = 1;
455 break; 463 break;
456 } 464 }
457 } 465 }
458 466
459 // use this driver 467 // use this driver
460 OT->setScanWith( OT->driver(i) ); 468 OT->setScanWith( OT->driver(i) );
461 469
462 // create dialog 470 // create dialog
463 QDialog * Dlg = new QDialog( Parent, 0, TRUE ); 471 QDialog * Dlg = new QDialog( Parent, 0, TRUE );
464 QVBoxLayout * V = new QVBoxLayout( Dlg ); 472 QVBoxLayout * V = new QVBoxLayout( Dlg );
465 OTScan * Scn = new OTScan( Dlg ); 473 OTScan * Scn = new OTScan( Dlg );
466 474
467 connect( Scn, 475 connect( Scn,
468 SIGNAL( selected() ), 476 SIGNAL( selected() ),
469 Dlg, 477 Dlg,
470 SLOT( accept() ) 478 SLOT( accept() )