summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-16 19:26:43 (UTC)
committer harlekin <harlekin>2002-06-16 19:26:43 (UTC)
commit8dde6abcd14717bd362248c365fe140efe0f0386 (patch) (side-by-side diff)
treef9e97c987e5197d4cbb3d0a0d5afe99fe12b1eba
parent1eca76c99326afc111efeb2bf55a306a4f37eb1e (diff)
downloadopie-8dde6abcd14717bd362248c365fe140efe0f0386.zip
opie-8dde6abcd14717bd362248c365fe140efe0f0386.tar.gz
opie-8dde6abcd14717bd362248c365fe140efe0f0386.tar.bz2
update
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp14
-rw-r--r--noncore/net/opietooth/manager/bluebase.h5
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp46
-rw-r--r--noncore/net/opietooth/manager/scandialog.h10
4 files changed, 64 insertions, 11 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index e3b9e53..71da82e 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -38,20 +38,24 @@
#include <qpe/resource.h>
#include <qpe/config.h>
namespace OpieTooth {
+ class RemoteDevices;
BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
: BluetoothBase( parent, name, fl ) {
QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan()));
QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges()));
+
+
+
QPalette pal = this->palette();
QColor col = pal.color(QPalette::Active, QColorGroup::Background);
pal.setColor(QPalette::Active, QColorGroup::Button, col);
pal.setColor(QPalette::Inactive, QColorGroup::Button, col);
pal.setColor(QPalette::Normal, QColorGroup::Button, col);
pal.setColor(QPalette::Disabled, QColorGroup::Button, col);
@@ -146,17 +150,27 @@ namespace OpieTooth {
box->show();
// falls nötig hcid killhupen - die funktionalität adden
}
+ void BlueBase::addSearchedDevices( QList<RemoteDevices> &newDevices ) {
+
+
+
+ }
+
+
/**
* Open the "scan for devices" dialog
*/
void BlueBase::startScan() {
ScanDialog *scan = new ScanDialog( this, "", true);
+ QObject::connect((QObject*)scan, SIGNAL( selectedDevices(QList<RemoteDevices>&) ),
+ this, SLOT( addSearchedDevices(QList<RemoteDevices>& ) ));
+
scan->showMaximized();
}
/**
* Decontructor
*/
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index 023af7a..ae5ce67 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -3,12 +3,13 @@
#define BLUEBASE_H
#include <qvariant.h>
#include <qwidget.h>
#include <qscrollview.h>
#include <qsplitter.h>
+#include <qlist.h>
#include "bluetoothbase.h"
class QVBox;
class QHBoxLayout;
class QGridLayout;
@@ -17,12 +18,14 @@ class QLabel;
class QPushButton;
class QTabWidget;
class QCheckBox;
namespace OpieTooth {
+
+
class BlueBase : public BluetoothBase {
Q_OBJECT
public:
BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~BlueBase();
@@ -45,13 +48,13 @@ namespace OpieTooth {
int useEncryption;
int enableAuthentification;
int enablePagescan;
int enableInquiryscan;
private slots:
-
+ void addSearchedDevices( QList<RemoteDevices> &newDevices );
void applyConfigChanges();
};
}
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
index 63c5472..70ea77a 100644
--- a/noncore/net/opietooth/manager/scandialog.cpp
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -25,20 +25,23 @@
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qprogressbar.h>
+#include <qlist.h>
#include <manager.h>
#include <device.h>
-#include <remotedevice.h>
+
namespace OpieTooth {
+#include <remotedevice.h>
+
/*
*/
ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl ) {
if ( !name )
@@ -60,25 +63,26 @@ namespace OpieTooth {
progress = new QProgressBar(privateLayoutWidget, "progbar");
progress->setTotalSteps(20);
QFrame *buttonFrame = new QFrame(Frame7, "");
StartButton = new QPushButton( buttonFrame, "StartButton" );
- StartButton->setText( tr( "Start" ) );
+ StartButton->setText( tr( "Start scan" ) );
StopButton = new QPushButton( buttonFrame, "StopButton" );
- StopButton->setText( tr( "Cancel" ) );
+ StopButton->setText( tr( "Cancel scan" ) );
QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame);
+
buttonLayout->addWidget(StartButton);
buttonLayout->addWidget(StopButton);
ListView1 = new QListView( privateLayoutWidget, "ListView1" );
- ListView1->addColumn( tr( "Add" ) );
- ListView1->addColumn( tr( "Device Name" ) );
+ //ListView1->addColumn( tr( "Add" ) );
+ ListView1->addColumn( tr( "Add Device" ) );
//ListView1->addColumn( tr( "Type" ) );
Layout11->addWidget( ListView1);
Layout11->addWidget(progress);
Layout11->addWidget( buttonFrame);
@@ -103,12 +107,15 @@ namespace OpieTooth {
}
void ScanDialog::startSearch() {
progress->setProgress(0);
progressStat = 0;
+ QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox );
+ deviceItem2->setText(1, "BLAH" );
+
progressTimer();
// when finished, it emmite foundDevices()
// checken ob initialisiert , qcop ans applet.
localDevice->searchDevices();
}
@@ -116,23 +123,48 @@ namespace OpieTooth {
void ScanDialog::stopSearch() {
}
void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) {
- QListViewItem * deviceItem;
+ QCheckListItem * deviceItem;
RemoteDevices::ValueList::Iterator it;
for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
- deviceItem = new QListViewItem( ListView1, (*it).name() );
+ deviceItem = new QCheckListItem( ListView1, (*it).name() );
+ deviceItem->setText(1, (*it).mac() );
+ }
+
+ }
+
+/*
+ * Iterates trough the items, and collects the checked items.
+ * Then it emits it, so the manager can connect to the signal to fill the listing.
+ */
+ void ScanDialog::emitToManager() {
+
+ if (!ListView1) {
+ return;
+ }
+
+ QList<RemoteDevices> *deviceList = new QList<RemoteDevices>;
+
+ QListViewItemIterator it( ListView1 );
+ for ( ; it.current(); ++it ) {
+ if ( it.current()->isSelected() ) {
+ RemoteDevices* device = new RemoteDevices( it.current()->text(1), it.current()->text(0));
+ deviceList->append( device );
+ }
}
+ emit selectedDevices( *deviceList );
}
/*
* Cleanup
*/
ScanDialog::~ScanDialog() {
+ emitToManager();
delete localDevice;
}
}
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h
index fcaee6e..4785a62 100644
--- a/noncore/net/opietooth/manager/scandialog.h
+++ b/noncore/net/opietooth/manager/scandialog.h
@@ -16,16 +16,15 @@
#ifndef SCANDIALOG_H
#define SCANDIALOG_H
#include <qvariant.h>
#include <qdialog.h>
+#include <qlist.h>
-#include <remotedevice.h>
-
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QFrame;
class QLabel;
class QListView;
@@ -33,13 +32,13 @@ class QListViewItem;
class QPushButton;
class QProgressBar;
namespace OpieTooth {
-
+#include <remotedevices.h>
class Manager;
class Device;
class ScanDialog : public QDialog {
Q_OBJECT
@@ -61,13 +60,18 @@ class Device;
void stopSearch();
void startSearch();
void progressTimer();
void fillList(const QString& device, RemoteDevices::ValueList list);
private:
+ void emitToManager();
Manager *localDevice;
int progressStat;
+
+ signals:
+ void selectedDevices(QList<RemoteDevices>&);
};
+
}
#endif // SCANDIALOG_H