summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/opietooth2/Opietooth.cpp
Side-by-side diff
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 ) {
this,
SLOT( SLOT_Show( const QString & ) ) );
connect( HciDump,
SIGNAL(processExited(MyProcess*) ),
this,
SLOT( SLOT_ProcessExited(MyProcess*) ) );
HciDump->process() << SL;
if( ! HciDump->process().start( OProcess::DontCare,
OProcess::AllOutput )
) {
QMessageBox::warning(0,
tr("Run hcidump"),
tr("Cannot start %1").arg(SL.join(" "))
);
delete HciDump;
HciDump = 0;
}
}
void OTSniffing::SLOT_Show( const QString & S ) {
- printf( "%s\n", S.latin1() );
Output_TV->setText( Output_TV->text() + S + "\n" );
QScrollBar *scroll = Output_TV->verticalScrollBar();
scroll->setValue(scroll->maxValue());
//Output_LB->insertItem( S );
//Output_LB->setCurrentItem( Output_LB->count()-1 );
//Output_LB->ensureCurrentVisible();
}
void OTSniffing::SLOT_ProcessExited( MyProcess * ) {
printf( "Exited\n" );
delete HciDump;
HciDump = 0;
}
void OTSniffing::SLOT_Save( void ) {
QString S = OFileDialog::getSaveFileName(
OFileSelector::Extended,
QDir::home().path(),
QString::null,
MimeTypes(),
this );
if( ! S.isEmpty() ) {
@@ -356,48 +355,49 @@ void OTPairing::SLOT_Unpair( ) {
tr("Sure ?"),
tr("Yes, break"),
tr("No, don't break") ) == 0 ) {
LinkKeyLVI * KPIt = (LinkKeyLVI *)it;
// break
OT->removeLinkKey( KPIt->index() );
delete KPIt;
}
return;
}
it= it->nextSibling();
}
}
//
//
//
//
//
OTScan::OTScan( QWidget * parent, OTIcons * _IC ) :
OTScanGUI( parent ), Filter() {
OT = OTGateway::getOTGateway();
+
Icons = (_IC ) ? _IC : new OTIcons();
MyIcons = (_IC == 0 );
DetectedPeers_LV->header()->hide();
Current = 0;
SelectedPeer = 0;
SelectedChannel = 0;
StrengthTimer = new QTimer( this );
connect( StrengthTimer,
SIGNAL( timeout()),
this,
SLOT( SLOT_UpdateStrength())
);
connect( OT,
SIGNAL( detectedPeer( OTPeer *, bool )),
this,
SLOT( SLOT_NewPeer( OTPeer *, bool ))
);
connect( OT,
SIGNAL( finishedDetecting()),
this,
SLOT( SLOT_FinishedDetecting())
);
@@ -423,48 +423,56 @@ OTScan::OTScan( QWidget * parent, OTIcons * _IC ) :
}
OTScan::~OTScan() {
if( MyIcons )
delete Icons;
OTGateway::releaseOTGateway();
// send all peers that we do not care about states
QListViewItem * Lit = DetectedPeers_LV->firstChild();
while( Lit ) {
((PeerLVI *)Lit)->peer()->stopFindingOutState( );
Lit = Lit->nextSibling();
}
}
// static scan dialog function
int OTScan::getDevice( OTPeer *& Peer,
int & Channel,
OTGateway * OT,
const UUIDVector & Filter,
QWidget* Parent ) {
bool IsUp = 0;
unsigned int i;
+ if( ! OT->isEnabled() ) {
+ QMessageBox::warning( 0,
+ tr("Scanning problem"),
+ tr("Bluetooth not enabled" )
+ );
+ return QDialog::Rejected;
+ }
+
// check if bluetooth is up
OTDriverList & DL = OT->getDriverList();
for( i = 0;
i < DL.count();
i ++ ) {
if( DL[i]->isUp() ) {
// one device that is up found
IsUp = 1;
break;
}
}
// use this driver
OT->setScanWith( OT->driver(i) );
// create dialog
QDialog * Dlg = new QDialog( Parent, 0, TRUE );
QVBoxLayout * V = new QVBoxLayout( Dlg );
OTScan * Scn = new OTScan( Dlg );
connect( Scn,
SIGNAL( selected() ),
Dlg,
SLOT( accept() )