From 8dde6abcd14717bd362248c365fe140efe0f0386 Mon Sep 17 00:00:00 2001 From: harlekin Date: Sun, 16 Jun 2002 19:26:43 +0000 Subject: update --- (limited to 'noncore/net/opietooth/manager') 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 @@ -41,6 +41,7 @@ namespace OpieTooth { + class RemoteDevices; BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) : BluetoothBase( parent, name, fl ) { @@ -49,6 +50,9 @@ namespace OpieTooth { 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); @@ -149,11 +153,21 @@ namespace OpieTooth { } + void BlueBase::addSearchedDevices( QList &newDevices ) { + + + + } + + /** * Open the "scan for devices" dialog */ void BlueBase::startScan() { ScanDialog *scan = new ScanDialog( this, "", true); + QObject::connect((QObject*)scan, SIGNAL( selectedDevices(QList&) ), + this, SLOT( addSearchedDevices(QList& ) )); + scan->showMaximized(); } 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 @@ -6,6 +6,7 @@ #include #include #include +#include #include "bluetoothbase.h" @@ -20,6 +21,8 @@ class QCheckBox; namespace OpieTooth { + + class BlueBase : public BluetoothBase { Q_OBJECT @@ -48,7 +51,7 @@ namespace OpieTooth { int enableInquiryscan; private slots: - + void addSearchedDevices( QList &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 @@ -28,14 +28,17 @@ #include #include #include +#include #include #include -#include + namespace OpieTooth { +#include + /* */ ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) @@ -63,19 +66,20 @@ namespace OpieTooth { 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); @@ -106,6 +110,9 @@ namespace OpieTooth { 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. @@ -119,19 +126,44 @@ namespace OpieTooth { 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 *deviceList = new QList; + + 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 @@ -19,10 +19,9 @@ #include #include +#include -#include - class QVBoxLayout; class QHBoxLayout; class QGridLayout; @@ -36,7 +35,7 @@ class QProgressBar; namespace OpieTooth { - +#include class Manager; class Device; @@ -64,10 +63,15 @@ class Device; void fillList(const QString& device, RemoteDevices::ValueList list); private: + void emitToManager(); Manager *localDevice; int progressStat; + + signals: + void selectedDevices(QList&); }; + } #endif // SCANDIALOG_H -- cgit v0.9.0.2