summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/scandialog.cpp
authorzecke <zecke>2002-07-14 18:04:14 (UTC)
committer zecke <zecke>2002-07-14 18:04:14 (UTC)
commit26c7e63572e729b4846e4f7551bb041aa6d4bd83 (patch) (side-by-side diff)
tree5c3bc09142bd19e84fbebb88f2e37b02e6d603cd /noncore/net/opietooth/manager/scandialog.cpp
parent31e233a6cf72bc853137ea05285f4d0f41665365 (diff)
downloadopie-26c7e63572e729b4846e4f7551bb041aa6d4bd83.zip
opie-26c7e63572e729b4846e4f7551bb041aa6d4bd83.tar.gz
opie-26c7e63572e729b4846e4f7551bb041aa6d4bd83.tar.bz2
- able to configure HCID
- able to save and restore known devices - able to scan servivces and shows the right pixmap too - able to do some more - scan dialog clean up ( tiny )
Diffstat (limited to 'noncore/net/opietooth/manager/scandialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp37
1 files changed, 23 insertions, 14 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
@@ -65,16 +65,14 @@ namespace OpieTooth {
QFrame *buttonFrame = new QFrame(Frame7, "");
- 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" ) );
QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame);
- buttonLayout->addWidget(StartButton);
- buttonLayout->addWidget(StopButton);
+ buttonLayout->addWidget(StartStopButton);
+// buttonLayout->addWidget(StopButton);
ListView1 = new QListView( privateLayoutWidget, "ListView1" );
@@ -88,22 +86,22 @@ namespace OpieTooth {
localDevice = new Manager( "hci0" );
- 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 ) ),
this, SLOT(fillList(const QString& , RemoteDevice::ValueList ) ) ) ;
// connect( this, SIGNAL( accept() ), this, SLOT( emitToManager() ));
progressStat = 0;
+ m_search = false;
}
// hack, make cleaner later
void ScanDialog::progressTimer() {
progressStat++;
- if (progressStat++ < 20) {
- QTimer::singleShot( 2000, this, SLOT(progressTimer() ) );
- }
+ if (progressStat++ < 20 && m_search ) {
+ QTimer::singleShot( 2000, this, SLOT(progressTimer() ) );
progress->setProgress(progressStat++);
+ }
}
@@ -114,6 +112,11 @@ namespace OpieTooth {
void ScanDialog::startSearch() {
+ if ( m_search ) {
+ stopSearch();
+ return;
+ }
+ m_search = true;
progress->setProgress(0);
progressStat = 0;
@@ -126,16 +129,19 @@ namespace OpieTooth {
progressTimer();
// when finished, it emmite foundDevices()
// checken ob initialisiert , qcop ans applet.
+ StartStopButton->setText( tr("Stop scan"));
+
localDevice->searchDevices();
}
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");
QCheckListItem * deviceItem;
@@ -145,6 +151,8 @@ namespace OpieTooth {
deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox );
deviceItem->setText(1, (*it).mac() );
}
+ m_search = false;
+ StartStopButton->setText(tr ("Start scan") );
}
/*
@@ -175,6 +183,7 @@ namespace OpieTooth {
* Cleanup
*/
ScanDialog::~ScanDialog() {
+ qWarning("delete scan dialog");
delete localDevice;
}