Diffstat (limited to 'noncore/net/opietooth/manager/scandialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index 3d6c928..9ce1b6a 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp @@ -67,7 +67,5 @@ namespace OpieTooth { - StartButton = new QPushButton( buttonFrame, "StartButton" ); - StartButton->setText( tr( "Start scan" ) ); + StartStopButton = new QPushButton( buttonFrame, "StartButton" ); + StartStopButton->setText( tr( "Start scan" ) ); - StopButton = new QPushButton( buttonFrame, "StopButton" ); - StopButton->setText( tr( "Cancel scan" ) ); @@ -75,4 +73,4 @@ namespace OpieTooth { - buttonLayout->addWidget(StartButton); - buttonLayout->addWidget(StopButton); + buttonLayout->addWidget(StartStopButton); +// buttonLayout->addWidget(StopButton); @@ -90,4 +88,3 @@ namespace OpieTooth { - connect( StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); - connect( StopButton, SIGNAL( clicked() ), this, SLOT( stopSearch() ) ); + connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); connect( localDevice, SIGNAL( foundDevices( const QString& , RemoteDevice::ValueList ) ), @@ -96,2 +93,3 @@ namespace OpieTooth { progressStat = 0; + m_search = false; } @@ -102,6 +100,6 @@ namespace OpieTooth { progressStat++; - if (progressStat++ < 20) { + if (progressStat++ < 20 && m_search ) { QTimer::singleShot( 2000, this, SLOT(progressTimer() ) ); - } progress->setProgress(progressStat++); + } @@ -116,2 +114,7 @@ namespace OpieTooth { void ScanDialog::startSearch() { + if ( m_search ) { + stopSearch(); + return; + } + m_search = true; progress->setProgress(0); @@ -128,2 +131,4 @@ namespace OpieTooth { // checken ob initialisiert , qcop ans applet. + StartStopButton->setText( tr("Stop scan")); + localDevice->searchDevices(); @@ -133,7 +138,8 @@ namespace OpieTooth { void ScanDialog::stopSearch() { - + m_search = true; } - void ScanDialog::fillList(const QString& device, RemoteDevice::ValueList deviceList) { - + void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { + progress->setProgress(0); + progressStat = 0; qDebug("fill List"); @@ -147,2 +153,4 @@ namespace OpieTooth { } + m_search = false; + StartStopButton->setText(tr ("Start scan") ); } @@ -177,2 +185,3 @@ namespace OpieTooth { ScanDialog::~ScanDialog() { + qWarning("delete scan dialog"); delete localDevice; |