summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/scandialog.cpp
Unidiff
Diffstat (limited to 'noncore/net/opietooth/manager/scandialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp46
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 @@
30#include <qprogressbar.h> 30#include <qprogressbar.h>
31#include <qlist.h>
31 32
@@ -33,3 +34,3 @@
33#include <device.h> 34#include <device.h>
34#include <remotedevice.h> 35
35 36
@@ -38,2 +39,4 @@ namespace OpieTooth {
38 39
40#include <remotedevice.h>
41
39/* 42/*
@@ -65,8 +68,9 @@ namespace OpieTooth {
65 StartButton = new QPushButton( buttonFrame, "StartButton" ); 68 StartButton = new QPushButton( buttonFrame, "StartButton" );
66 StartButton->setText( tr( "Start" ) ); 69 StartButton->setText( tr( "Start scan" ) );
67 70
68 StopButton = new QPushButton( buttonFrame, "StopButton" ); 71 StopButton = new QPushButton( buttonFrame, "StopButton" );
69 StopButton->setText( tr( "Cancel" ) ); 72 StopButton->setText( tr( "Cancel scan" ) );
70 73
71 QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame); 74 QHBoxLayout *buttonLayout = new QHBoxLayout(buttonFrame);
75
72 buttonLayout->addWidget(StartButton); 76 buttonLayout->addWidget(StartButton);
@@ -76,4 +80,4 @@ namespace OpieTooth {
76 80
77 ListView1->addColumn( tr( "Add" ) ); 81 //ListView1->addColumn( tr( "Add" ) );
78 ListView1->addColumn( tr( "Device Name" ) ); 82 ListView1->addColumn( tr( "Add Device" ) );
79 //ListView1->addColumn( tr( "Type" ) ); 83 //ListView1->addColumn( tr( "Type" ) );
@@ -108,2 +112,5 @@ namespace OpieTooth {
108 112
113 QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox );
114 deviceItem2->setText(1, "BLAH" );
115
109 progressTimer(); 116 progressTimer();
@@ -121,3 +128,3 @@ namespace OpieTooth {
121 128
122 QListViewItem * deviceItem; 129 QCheckListItem * deviceItem;
123 130
@@ -126,4 +133,28 @@ namespace OpieTooth {
126 133
127 deviceItem = new QListViewItem( ListView1, (*it).name() ); 134 deviceItem = new QCheckListItem( ListView1, (*it).name() );
135 deviceItem->setText(1, (*it).mac() );
136 }
137
138 }
139
140/*
141 * Iterates trough the items, and collects the checked items.
142 * Then it emits it, so the manager can connect to the signal to fill the listing.
143 */
144 void ScanDialog::emitToManager() {
145
146 if (!ListView1) {
147 return;
148 }
149
150 QList<RemoteDevices> *deviceList = new QList<RemoteDevices>;
151
152 QListViewItemIterator it( ListView1 );
153 for ( ; it.current(); ++it ) {
154 if ( it.current()->isSelected() ) {
155 RemoteDevices* device = new RemoteDevices( it.current()->text(1), it.current()->text(0));
156 deviceList->append( device );
157 }
128 } 158 }
159 emit selectedDevices( *deviceList );
129 } 160 }
@@ -134,2 +165,3 @@ namespace OpieTooth {
134 ScanDialog::~ScanDialog() { 165 ScanDialog::~ScanDialog() {
166 emitToManager();
135 delete localDevice; 167 delete localDevice;