Diffstat (limited to 'noncore/net/opietooth/manager/scandialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 46 |
1 files changed, 39 insertions, 7 deletions
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 @@ -30,2 +30,3 @@ #include <qprogressbar.h> +#include <qlist.h> @@ -33,3 +34,3 @@ #include <device.h> -#include <remotedevice.h> + @@ -38,2 +39,4 @@ namespace OpieTooth { +#include <remotedevice.h> + /* @@ -65,8 +68,9 @@ namespace OpieTooth { 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); @@ -76,4 +80,4 @@ namespace OpieTooth { - ListView1->addColumn( tr( "Add" ) ); - ListView1->addColumn( tr( "Device Name" ) ); + //ListView1->addColumn( tr( "Add" ) ); + ListView1->addColumn( tr( "Add Device" ) ); //ListView1->addColumn( tr( "Type" ) ); @@ -108,2 +112,5 @@ namespace OpieTooth { + QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); + deviceItem2->setText(1, "BLAH" ); + progressTimer(); @@ -121,3 +128,3 @@ namespace OpieTooth { - QListViewItem * deviceItem; + QCheckListItem * deviceItem; @@ -126,4 +133,28 @@ namespace OpieTooth { - 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 ); } @@ -134,2 +165,3 @@ namespace OpieTooth { ScanDialog::~ScanDialog() { + emitToManager(); delete localDevice; |