-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 3 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 4d476ac..22b16d2 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -1,53 +1,52 @@ | |||
1 | /* | 1 | /* |
2 | * bluebase.cpp * | 2 | * bluebase.cpp * |
3 | * --------------------- | 3 | * --------------------- |
4 | * | 4 | * |
5 | * begin : Sun 10 17:20:00 CEST 2002 | ||
6 | * copyright : (c) 2002 by Maximilian Reiß | 5 | * copyright : (c) 2002 by Maximilian Reiß |
7 | * email : max.reiss@gmx.de | 6 | * email : max.reiss@gmx.de |
8 | * | 7 | * |
9 | */ | 8 | */ |
10 | /*************************************************************************** | 9 | /*************************************************************************** |
11 | * * | 10 | * * |
12 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
13 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
14 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
15 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
16 | * * | 15 | * * |
17 | ***************************************************************************/ | 16 | ***************************************************************************/ |
18 | 17 | ||
19 | #include "bluebase.h" | 18 | #include "bluebase.h" |
20 | #include "scandialog.h" | 19 | #include "scandialog.h" |
21 | 20 | ||
22 | #include <qframe.h> | 21 | #include <qframe.h> |
23 | #include <qlabel.h> | 22 | #include <qlabel.h> |
24 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
25 | #include <qlayout.h> | 24 | #include <qlayout.h> |
26 | #include <qvariant.h> | 25 | #include <qvariant.h> |
27 | #include <qwhatsthis.h> | 26 | #include <qwhatsthis.h> |
28 | #include <qimage.h> | 27 | #include <qimage.h> |
29 | #include <qpixmap.h> | 28 | #include <qpixmap.h> |
30 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
31 | #include <qscrollview.h> | 30 | #include <qscrollview.h> |
32 | #include <qvbox.h> | 31 | #include <qvbox.h> |
33 | #include <qmessagebox.h> | 32 | #include <qmessagebox.h> |
34 | #include <qapplication.h> | 33 | #include <qapplication.h> |
35 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
36 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
37 | #include <qlistview.h> | 36 | #include <qlistview.h> |
38 | #include <qdir.h> | 37 | #include <qdir.h> |
39 | 38 | ||
40 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
41 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
42 | 41 | ||
43 | #include <remotedevice.h> | 42 | #include <remotedevice.h> |
44 | 43 | ||
45 | 44 | ||
46 | namespace OpieTooth { | 45 | namespace OpieTooth { |
47 | 46 | ||
48 | 47 | ||
49 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 48 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
50 | : BluetoothBase( parent, name, fl ) { | 49 | : BluetoothBase( parent, name, fl ) { |
51 | 50 | ||
52 | 51 | ||
53 | QObject::connect( (QObject*)PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); | 52 | QObject::connect( (QObject*)PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); |
@@ -256,68 +255,68 @@ namespace OpieTooth { | |||
256 | deviceItem->setText(1, dev->mac() ); | 255 | deviceItem->setText(1, dev->mac() ); |
257 | } | 256 | } |
258 | } | 257 | } |
259 | 258 | ||
260 | 259 | ||
261 | /* | 260 | /* |
262 | * Action that is toggled on entrys on click | 261 | * Action that is toggled on entrys on click |
263 | */ | 262 | */ |
264 | void BlueBase::startServiceActionClicked( QListViewItem * item ) { | 263 | void BlueBase::startServiceActionClicked( QListViewItem * item ) { |
265 | 264 | ||
266 | 265 | ||
267 | } | 266 | } |
268 | 267 | ||
269 | /* | 268 | /* |
270 | * Action that are toggled on hold (mostly QPopups i guess) | 269 | * Action that are toggled on hold (mostly QPopups i guess) |
271 | */ | 270 | */ |
272 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column) { | 271 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column) { |
273 | 272 | ||
274 | 273 | ||
275 | } | 274 | } |
276 | 275 | ||
277 | /* | 276 | /* |
278 | * Search and display avail. services for a device (on expand from device listing) | 277 | * Search and display avail. services for a device (on expand from device listing) |
279 | * | 278 | * |
280 | */ | 279 | */ |
281 | void BlueBase::addServicesToDevice( QListViewItem * item ) { | 280 | void BlueBase::addServicesToDevice( QListViewItem * item ) { |
282 | // row of mac adress | 281 | // row of mac adress |
283 | RemoteDevice *device = new RemoteDevice(item->text(1), item->text(0)); | 282 | RemoteDevice *device = new RemoteDevice(item->text(1), item->text(0)); |
284 | //dann nen manager und darauf dann searchServises, das liefert nen signal, das wieder connected | 283 | //dann nen manager und darauf dann searchServises, das liefert nen signal, das wieder connected |
285 | // werden muss. | 284 | // werden muss. |
286 | 285 | ||
287 | // delete | 286 | // delete |
288 | } | 287 | } |
289 | 288 | ||
290 | /* | 289 | /* |
291 | * Find out if a device can currently be reached | 290 | * Find out if a device can currently be reached |
292 | */ | 291 | */ |
293 | bool BlueBase::deviceActive( RemoteDevice *device ) { | 292 | bool BlueBase::deviceActive( RemoteDevice *device ) { |
294 | 293 | ||
295 | return true; | 294 | return true; |
296 | } | 295 | } |
297 | 296 | ||
298 | /** | 297 | /** |
299 | * Open the "scan for devices" dialog | 298 | * Open the "scan for devices" dialog |
300 | */ | 299 | */ |
301 | void BlueBase::startScan() { | 300 | void BlueBase::startScan() { |
302 | 301 | ||
303 | ScanDialog *scan = new ScanDialog( this, "", true); | 302 | ScanDialog *scan = new ScanDialog( this, "", true); |
304 | QObject::connect((QObject*)scan, SIGNAL( selectedDevices(QList<RemoteDevice>&) ), | 303 | QObject::connect( scan, SIGNAL( selectedDevices(QList<RemoteDevice>&) ), |
305 | this, SLOT( addSearchedDevices(QList<RemoteDevice>& ) )); | 304 | this, SLOT( addSearchedDevices(QList<RemoteDevice>& ) )); |
306 | 305 | ||
307 | scan->showMaximized(); | 306 | scan->showMaximized(); |
308 | } | 307 | } |
309 | 308 | ||
310 | 309 | ||
311 | void BlueBase::setInfo() { | 310 | void BlueBase::setInfo() { |
312 | StatusLabel->setText(getStatus()); | 311 | StatusLabel->setText(getStatus()); |
313 | } | 312 | } |
314 | 313 | ||
315 | /** | 314 | /** |
316 | * Decontructor | 315 | * Decontructor |
317 | */ | 316 | */ |
318 | BlueBase::~BlueBase(){ | 317 | BlueBase::~BlueBase(){ |
319 | writeSavedDevices(); | 318 | writeSavedDevices(); |
320 | } | 319 | } |
321 | 320 | ||
322 | } | 321 | } |
323 | 322 | ||
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index bd7d23c..f8f7b15 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp | |||
@@ -102,68 +102,70 @@ namespace OpieTooth { | |||
102 | if (progressStat++ < 20) { | 102 | if (progressStat++ < 20) { |
103 | QTimer::singleShot( 1000, this, SLOT(progressTimer() ) ); | 103 | QTimer::singleShot( 1000, this, SLOT(progressTimer() ) ); |
104 | } | 104 | } |
105 | progress->setProgress(progressStat++); | 105 | progress->setProgress(progressStat++); |
106 | 106 | ||
107 | } | 107 | } |
108 | 108 | ||
109 | void ScanDialog::startSearch() { | 109 | void ScanDialog::startSearch() { |
110 | progress->setProgress(0); | 110 | progress->setProgress(0); |
111 | progressStat = 0; | 111 | progressStat = 0; |
112 | 112 | ||
113 | QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); | 113 | QCheckListItem *deviceItem2 = new QCheckListItem( ListView1, "Test1", QCheckListItem::CheckBox ); |
114 | deviceItem2->setText(1, "BLAH" ); | 114 | deviceItem2->setText(1, "BLAH" ); |
115 | 115 | ||
116 | progressTimer(); | 116 | progressTimer(); |
117 | // when finished, it emmite foundDevices() | 117 | // when finished, it emmite foundDevices() |
118 | // checken ob initialisiert , qcop ans applet. | 118 | // checken ob initialisiert , qcop ans applet. |
119 | localDevice->searchDevices(); | 119 | localDevice->searchDevices(); |
120 | 120 | ||
121 | } | 121 | } |
122 | 122 | ||
123 | void ScanDialog::stopSearch() { | 123 | void ScanDialog::stopSearch() { |
124 | 124 | ||
125 | } | 125 | } |
126 | 126 | ||
127 | void ScanDialog::fillList(const QString& device, RemoteDevice::ValueList deviceList) { | 127 | void ScanDialog::fillList(const QString& device, RemoteDevice::ValueList deviceList) { |
128 | 128 | ||
129 | QCheckListItem * deviceItem; | 129 | QCheckListItem * deviceItem; |
130 | 130 | ||
131 | RemoteDevice::ValueList::Iterator it; | 131 | RemoteDevice::ValueList::Iterator it; |
132 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { | 132 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { |
133 | 133 | ||
134 | deviceItem = new QCheckListItem( ListView1, (*it).name() ); | 134 | deviceItem = new QCheckListItem( ListView1, (*it).name() ); |
135 | deviceItem->setText(1, (*it).mac() ); | 135 | deviceItem->setText(1, (*it).mac() ); |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | /* | 139 | /* |
140 | * Iterates trough the items, and collects the checked items. | 140 | * Iterates trough the items, and collects the checked items. |
141 | * Then it emits it, so the manager can connect to the signal to fill the listing. | 141 | * Then it emits it, so the manager can connect to the signal to fill the listing. |
142 | */ | 142 | */ |
143 | void ScanDialog::emitToManager() { | 143 | void ScanDialog::emitToManager() { |
144 | 144 | ||
145 | if (!ListView1) { | 145 | if (!ListView1) { |
146 | return; | 146 | return; |
147 | } | 147 | } |
148 | 148 | ||
149 | QList<RemoteDevice> *deviceList = new QList<RemoteDevice>; | 149 | QList<RemoteDevice> *deviceList = new QList<RemoteDevice>; |
150 | deviceList->setAutoDelete(true); | ||
150 | 151 | ||
151 | QListViewItemIterator it( ListView1 ); | 152 | QListViewItemIterator it( ListView1 ); |
152 | for ( ; it.current(); ++it ) { | 153 | for ( ; it.current(); ++it ) { |
153 | if ( ((QCheckListItem*)it.current())->isOn() ) { | 154 | if ( ((QCheckListItem*)it.current())->isOn() ) { |
154 | RemoteDevice * device = new RemoteDevice( it.current()->text(1), it.current()->text(0)); | 155 | RemoteDevice * device = new RemoteDevice( it.current()->text(1), it.current()->text(0)); |
155 | deviceList->append( device ); | 156 | deviceList->append( device ); |
156 | } | 157 | } |
157 | } | 158 | } |
158 | emit selectedDevices( *deviceList ); | 159 | emit selectedDevices( *deviceList ); |
160 | delete deviceList; | ||
159 | } | 161 | } |
160 | 162 | ||
161 | /* | 163 | /* |
162 | * Cleanup | 164 | * Cleanup |
163 | */ | 165 | */ |
164 | ScanDialog::~ScanDialog() { | 166 | ScanDialog::~ScanDialog() { |
165 | emitToManager(); | 167 | emitToManager(); |
166 | delete localDevice; | 168 | delete localDevice; |
167 | } | 169 | } |
168 | 170 | ||
169 | } | 171 | } |