summaryrefslogtreecommitdiff
authorzecke <zecke>2002-07-09 18:28:19 (UTC)
committer zecke <zecke>2002-07-09 18:28:19 (UTC)
commit411ac6f9199b1aae2b6a40e7a8cf6bfea260acba (patch) (unidiff)
tree218836d6509d2dcaba3c6306f9f488b759169b1a
parent5f549398401acc5591ffcb67459dbf55ea323b91 (diff)
downloadopie-411ac6f9199b1aae2b6a40e7a8cf6bfea260acba.zip
opie-411ac6f9199b1aae2b6a40e7a8cf6bfea260acba.tar.gz
opie-411ac6f9199b1aae2b6a40e7a8cf6bfea260acba.tar.bz2
Add a generic class for the sensitive QPopupMenu
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp6
-rw-r--r--noncore/net/opietooth/manager/bluebase.h2
-rw-r--r--noncore/net/opietooth/manager/manager.pro4
-rw-r--r--noncore/net/opietooth/manager/popuphelper.cpp25
-rw-r--r--noncore/net/opietooth/manager/popuphelper.h25
-rw-r--r--noncore/net/opietooth/manager/scandialog.h2
6 files changed, 57 insertions, 7 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index c29eb1a..85c6717 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -151,308 +151,308 @@ using namespace OpieTooth;
151 /** 151 /**
152 * Read the list of allready known devices 152 * Read the list of allready known devices
153 * 153 *
154 */ 154 */
155 void BlueBase::readSavedDevices() { 155 void BlueBase::readSavedDevices() {
156 156
157 QValueList<RemoteDevice> loadedDevices; 157 QValueList<RemoteDevice> loadedDevices;
158 158
159 QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/"); 159 QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/");
160 // list of .conf files 160 // list of .conf files
161 QStringList devicesFileList = deviceListSave.entryList(); 161 QStringList devicesFileList = deviceListSave.entryList();
162 162
163 // cut .conf of to get the mac and also read the name entry in it. 163 // cut .conf of to get the mac and also read the name entry in it.
164 164
165 for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { 165 for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) {
166 166
167 QString name; 167 QString name;
168 QString mac; 168 QString mac;
169 qDebug((*it).latin1() ); 169 qDebug((*it).latin1() );
170 Config conf((*it)); 170 Config conf((*it));
171 conf.setGroup("Info"); 171 conf.setGroup("Info");
172 name = conf.readEntry("name", "Error"); 172 name = conf.readEntry("name", "Error");
173 qDebug("MAC: " + mac); 173 qDebug("MAC: " + mac);
174 qDebug("NAME: " + name); 174 qDebug("NAME: " + name);
175 RemoteDevice currentDevice( mac , name ); 175 RemoteDevice currentDevice( mac , name );
176 loadedDevices.append( currentDevice ); 176 loadedDevices.append( currentDevice );
177 } 177 }
178 addSearchedDevices( loadedDevices ); 178 addSearchedDevices( loadedDevices );
179 } 179 }
180 180
181 /** 181 /**
182 * Write the list of allready known devices 182 * Write the list of allready known devices
183 * 183 *
184 */ 184 */
185 void BlueBase::writeSavedDevices() { 185 void BlueBase::writeSavedDevices() {
186 QListViewItemIterator it( ListView2 ); 186 QListViewItemIterator it( ListView2 );
187 187
188 for ( ; it.current(); ++it ) { 188 for ( ; it.current(); ++it ) {
189 // seperate config file for each device, to store more information in future. 189 // seperate config file for each device, to store more information in future.
190 qDebug( "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf"); 190 qDebug( "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf");
191 Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf", Config::File ); 191 Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (((BTListItem*)it.current())->mac()) + ".conf", Config::File );
192 conf.setGroup( "Info" ); 192 conf.setGroup( "Info" );
193 conf.writeEntry( "name", ((BTListItem*)it.current())->name() ); 193 conf.writeEntry( "name", ((BTListItem*)it.current())->name() );
194 } 194 }
195 } 195 }
196 196
197 197
198 /** 198 /**
199 * Set up the gui 199 * Set up the gui
200 */ 200 */
201 void BlueBase::initGui() { 201 void BlueBase::initGui() {
202 StatusLabel->setText( status() ); // maybe move it to getStatus() 202 StatusLabel->setText( status() ); // maybe move it to getStatus()
203 cryptCheckBox->setChecked( m_useEncryption ); 203 cryptCheckBox->setChecked( m_useEncryption );
204 authCheckBox->setChecked( m_enableAuthentification ); 204 authCheckBox->setChecked( m_enableAuthentification );
205 pagescanCheckBox->setChecked( m_enablePagescan ); 205 pagescanCheckBox->setChecked( m_enablePagescan );
206 inquiryscanCheckBox->setChecked( m_enableInquiryscan ); 206 inquiryscanCheckBox->setChecked( m_enableInquiryscan );
207 deviceNameLine->setText( m_deviceName ); 207 deviceNameLine->setText( m_deviceName );
208 passkeyLine->setText( m_defaultPasskey ); 208 passkeyLine->setText( m_defaultPasskey );
209 // set info tab 209 // set info tab
210 setInfo(); 210 setInfo();
211 } 211 }
212 212
213 213
214 /** 214 /**
215 * Get the status informations and returns it 215 * Get the status informations and returns it
216 * @return QString the status informations gathered 216 * @return QString the status informations gathered
217 */ 217 */
218 QString BlueBase::status()const{ 218 QString BlueBase::status()const{
219 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 219 QString infoString = tr( "<b>Device name : </b> Ipaq" );
220 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 220 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
221 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 221 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
222 222
223 return (infoString); 223 return (infoString);
224 } 224 }
225 225
226 226
227 /** 227 /**
228 * Read the current values from the gui and invoke writeConfig() 228 * Read the current values from the gui and invoke writeConfig()
229 */ 229 */
230 void BlueBase::applyConfigChanges() { 230 void BlueBase::applyConfigChanges() {
231 m_deviceName = deviceNameLine->text(); 231 m_deviceName = deviceNameLine->text();
232 m_defaultPasskey = passkeyLine->text(); 232 m_defaultPasskey = passkeyLine->text();
233 m_useEncryption = cryptCheckBox->isChecked(); 233 m_useEncryption = cryptCheckBox->isChecked();
234 m_enableAuthentification = authCheckBox->isChecked(); 234 m_enableAuthentification = authCheckBox->isChecked();
235 m_enablePagescan = pagescanCheckBox->isChecked(); 235 m_enablePagescan = pagescanCheckBox->isChecked();
236 m_enableInquiryscan = inquiryscanCheckBox->isChecked(); 236 m_enableInquiryscan = inquiryscanCheckBox->isChecked();
237 237
238 writeConfig(); 238 writeConfig();
239 239
240 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); 240 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
241 } 241 }
242 242
243 /** 243 /**
244 * Add fresh found devices from scan dialog to the listing 244 * Add fresh found devices from scan dialog to the listing
245 * 245 *
246 */ 246 */
247 void BlueBase::addSearchedDevices( QValueList<RemoteDevice> &newDevices ) { 247 void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) {
248 BTListItem * deviceItem; 248 BTListItem * deviceItem;
249 QValueList<RemoteDevice>::ConstIterator it; 249 QValueList<RemoteDevice>::ConstIterator it;
250 250
251 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { 251 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) {
252 deviceItem = new BTListItem( ListView2 , (*it).name(), (*it).mac(), "device" ); 252 deviceItem = new BTListItem( ListView2 , (*it).name(), (*it).mac(), "device" );
253 deviceItem->setExpandable ( true ); 253 deviceItem->setExpandable ( true );
254 254
255 // look if device is avail. atm, async 255 // look if device is avail. atm, async
256 deviceActive( (*it) ); 256 deviceActive( (*it) );
257 257
258 // ggf auch hier? 258 // ggf auch hier?
259 addServicesToDevice( deviceItem ); 259 addServicesToDevice( deviceItem );
260 } 260 }
261 } 261 }
262 262
263 263
264 /** 264 /**
265 * Action that is toggled on entrys on click 265 * Action that is toggled on entrys on click
266 */ 266 */
267void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { 267void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) {
268} 268}
269 269
270 /** 270 /**
271 * Action that are toggled on hold (mostly QPopups i guess) 271 * Action that are toggled on hold (mostly QPopups i guess)
272 */ 272 */
273void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { 273void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) {
274 274
275 QPopupMenu *menu = new QPopupMenu(); 275 QPopupMenu *menu = new QPopupMenu();
276 int ret=0; 276 int ret=0;
277 277
278 if ( ((BTListItem*)item)->type() == "device") { 278 if ( ((BTListItem*)item)->type() == "device") {
279 279
280 QPopupMenu *groups = new QPopupMenu(); 280 QPopupMenu *groups = new QPopupMenu();
281 281
282 menu->insertItem( tr("rescan sevices:"), 0); 282 menu->insertItem( tr("rescan sevices:"), 0);
283 menu->insertItem( tr("to group"), groups , 1); 283 menu->insertItem( tr("to group"), groups , 1);
284 menu->insertItem( tr("bound device"), 2); 284 menu->insertItem( tr("bound device"), 2);
285 menu->insertItem( tr("delete"), 3); 285 menu->insertItem( tr("delete"), 3);
286 286
287 ret = menu->exec( point , 0); 287 ret = menu->exec( point , 0);
288 288
289 switch(ret) { 289 switch(ret) {
290 case 0: 290 case 0:
291 break; 291 break;
292 case 1: 292 case 1:
293 break; 293 break;
294 case 2: 294 case 2:
295 // make connection 295 // make connection
296 break; 296 break;
297 case 3: 297 case 3:
298 // delete childs too 298 // delete childs too
299 delete item; 299 delete item;
300 break; 300 break;
301 } 301 }
302 delete groups; 302 delete groups;
303 303
304 } else if ( ((BTListItem*)item)->type() == "service") { 304 } else if ( ((BTListItem*)item)->type() == "service") {
305 menu->insertItem( tr("Test1:"), 0); 305 menu->insertItem( tr("Test1:"), 0);
306 menu->insertItem( tr("connect"), 1); 306 menu->insertItem( tr("connect"), 1);
307 menu->insertItem( tr("delete"), 2); 307 menu->insertItem( tr("delete"), 2);
308 308
309 ret = menu->exec( point , 0); 309 ret = menu->exec( point , 0);
310 310
311 switch(ret) { 311 switch(ret) {
312 case 0: 312 case 0:
313 break; 313 break;
314 case 1: 314 case 1:
315 break; 315 break;
316 case 2: 316 case 2:
317 // delete childs too 317 // delete childs too
318 delete item; 318 delete item;
319 break; 319 break;
320 } 320 }
321 } 321 }
322 delete menu; 322 delete menu;
323} 323}
324 324
325 /** 325 /**
326 * Search and display avail. services for a device (on expand from device listing) 326 * Search and display avail. services for a device (on expand from device listing)
327 * 327 *
328 */ 328 */
329 void BlueBase::addServicesToDevice( BTListItem * item ) { 329 void BlueBase::addServicesToDevice( BTListItem * item ) {
330 qDebug("addServicesToDevice"); 330 qDebug("addServicesToDevice");
331 // row of mac adress text(3) 331 // row of mac adress text(3)
332 RemoteDevice device( item->mac(), item->name() ); 332 RemoteDevice device( item->mac(), item->name() );
333 m_deviceList.insert( item->mac() , item ); 333 m_deviceList.insert( item->mac() , item );
334 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 334 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
335 m_localDevice->searchServices( device ); 335 m_localDevice->searchServices( device );
336 } 336 }
337 337
338 338
339 /** 339 /**
340 * Overloaded. This one it the one that is connected to the foundServices signal 340 * Overloaded. This one it the one that is connected to the foundServices signal
341 * @param device the mac address of the remote device 341 * @param device the mac address of the remote device
342 * @param servicesList the list with the service the device has. 342 * @param servicesList the list with the service the device has.
343 */ 343 */
344 void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { 344 void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) {
345 qDebug("fill services list"); 345 qDebug("fill services list");
346 346
347 QMap<QString,BTListItem*>::Iterator it; 347 QMap<QString,BTListItem*>::Iterator it;
348 BTListItem* deviceItem = 0; 348 BTListItem* deviceItem = 0;
349 349
350 // get the right devices which requested the search 350 // get the right devices which requested the search
351 for( it = m_deviceList.begin(); it != m_deviceList.end(); ++it ) { 351 for( it = m_deviceList.begin(); it != m_deviceList.end(); ++it ) {
352 if ( it.key() == device ) { 352 if ( it.key() == device ) {
353 deviceItem = it.data(); 353 deviceItem = it.data();
354 } 354 }
355 } 355 }
356 356
357 QValueList<OpieTooth::Services>::Iterator it2; 357 QValueList<OpieTooth::Services>::Iterator it2;
358 BTListItem * serviceItem; 358 BTListItem * serviceItem;
359 359
360 if (!servicesList.isEmpty() ) { 360 if (!servicesList.isEmpty() ) {
361 // add services 361 // add services
362 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 362 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
363 serviceItem = new BTListItem( deviceItem , (*it2).serviceName() , "" , "service" ); 363 serviceItem = new BTListItem( deviceItem , (*it2).serviceName() , "" , "service" );
364 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( (*it2).classIdList() ) ); 364 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( (*it2).classIdList() ) );
365 } 365 }
366 } else { 366 } else {
367 serviceItem = new BTListItem( deviceItem , tr("no services found"), "" , "service" ); 367 serviceItem = new BTListItem( deviceItem , tr("no services found"), "" , "service" );
368 } 368 }
369 } 369 }
370 370
371 371
372 /** 372 /**
373 * Add the existing connections (pairs) to the connections tab. 373 * Add the existing connections (pairs) to the connections tab.
374 * This one triggers the search 374 * This one triggers the search
375 */ 375 */
376 void BlueBase::addConnectedDevices() { 376 void BlueBase::addConnectedDevices() {
377 m_localDevice->searchConnections(); 377 m_localDevice->searchConnections();
378 } 378 }
379 379
380 380
381 void BlueBase::addConnectedDevices( Connection::ValueList connectionList ) { 381 void BlueBase::addConnectedDevices( Connection::ValueList connectionList ) {
382 QValueList<OpieTooth::Connection>::Iterator it; 382 QValueList<OpieTooth::Connection>::Iterator it;
383 BTListItem * connectionItem; 383 BTListItem * connectionItem;
384 384
385 if ( !connectionList.isEmpty() ) { 385 if ( !connectionList.isEmpty() ) {
386 386
387 for (it = connectionList.begin(); it != connectionList.end(); ++it) { 387 for (it = connectionList.begin(); it != connectionList.end(); ++it) {
388 connectionItem = new BTListItem( ListView4 , (*it).mac() , (*it).mac() , "connection" ); 388 connectionItem = new BTListItem( ListView4 , (*it).mac() , (*it).mac() , "connection" );
389 } 389 }
390 } else { 390 } else {
391 connectionItem = new BTListItem( ListView4 , tr("No connections found"), "", "connection" ); 391 connectionItem = new BTListItem( ListView4 , tr("No connections found"), "", "connection" );
392 } 392 }
393 393
394 // recall connection search after some time 394 // recall connection search after some time
395 QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) ); 395 QTimer::singleShot( 20000, this, SLOT( addConnectedDevices() ) );
396 } 396 }
397 397
398 /** 398 /**
399 * Find out if a device can currently be reached 399 * Find out if a device can currently be reached
400 */ 400 */
401 void BlueBase::deviceActive( const RemoteDevice &device ) { 401 void BlueBase::deviceActive( const RemoteDevice &device ) {
402 // search by mac, async, gets a signal back 402 // search by mac, async, gets a signal back
403 m_localDevice->isAvailable( device.mac() ); 403 m_localDevice->isAvailable( device.mac() );
404 } 404 }
405 405
406 /** 406 /**
407 * The signal catcher. Set the avail. status on device. 407 * The signal catcher. Set the avail. status on device.
408 * @param device - the mac address 408 * @param device - the mac address
409 * @param connected - if it is avail. or not 409 * @param connected - if it is avail. or not
410 */ 410 */
411 void BlueBase::deviceActive( const QString& device, bool connected ) { 411 void BlueBase::deviceActive( const QString& device, bool connected ) {
412 qDebug("deviceActive slot"); 412 qDebug("deviceActive slot");
413 413
414 QMap<QString,BTListItem*>::Iterator it; 414 QMap<QString,BTListItem*>::Iterator it;
415 BTListItem* deviceItem = 0; 415 BTListItem* deviceItem = 0;
416 416
417 // get the right devices which requested the search 417 // get the right devices which requested the search
418 for( it = m_deviceList.begin(); it != m_deviceList.end(); ++it ) { 418 for( it = m_deviceList.begin(); it != m_deviceList.end(); ++it ) {
419 if ( it.key() == device ) { 419 if ( it.key() == device ) {
420 deviceItem = it.data(); 420 deviceItem = it.data();
421 } 421 }
422 } 422 }
423 423
424 if ( connected ) { 424 if ( connected ) {
425 deviceItem->setPixmap( 1, m_onPix ); 425 deviceItem->setPixmap( 1, m_onPix );
426 } else { 426 } else {
427 deviceItem->setPixmap( 1, m_offPix ); 427 deviceItem->setPixmap( 1, m_offPix );
428 } 428 }
429 } 429 }
430 430
431 /** 431 /**
432 * Open the "scan for devices" dialog 432 * Open the "scan for devices" dialog
433 */ 433 */
434 void BlueBase::startScan() { 434 void BlueBase::startScan() {
435 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 435 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
436 true, WDestructiveClose ); 436 true, WDestructiveClose );
437 QObject::connect( scan, SIGNAL( selectedDevices( QValueList<RemoteDevice>& ) ), 437 QObject::connect( scan, SIGNAL( selectedDevices( const QValueList<RemoteDevice>& ) ),
438 this, SLOT( addSearchedDevices( QValueList<RemoteDevice>& ) ) ); 438 this, SLOT( addSearchedDevices( const QValueList<RemoteDevice>& ) ) );
439 439
440 scan->showMaximized(); 440 scan->showMaximized();
441 } 441 }
442 442
443 443
444 /** 444 /**
445 * Set the informations about the local device in information Tab 445 * Set the informations about the local device in information Tab
446 */ 446 */
447 void BlueBase::setInfo() { 447 void BlueBase::setInfo() {
448 StatusLabel->setText( status() ); 448 StatusLabel->setText( status() );
449 } 449 }
450 450
451 /** 451 /**
452 * Decontructor 452 * Decontructor
453 */ 453 */
454 BlueBase::~BlueBase() { 454 BlueBase::~BlueBase() {
455 writeSavedDevices(); 455 writeSavedDevices();
456 delete m_iconLoader; 456 delete m_iconLoader;
457 } 457 }
458 458
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index 97ce8c3..73fac97 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -1,85 +1,85 @@
1 1
2#ifndef BLUEBASE_H 2#ifndef BLUEBASE_H
3#define BLUEBASE_H 3#define BLUEBASE_H
4 4
5#include <qvariant.h> 5#include <qvariant.h>
6#include <qwidget.h> 6#include <qwidget.h>
7#include <qscrollview.h> 7#include <qscrollview.h>
8#include <qsplitter.h> 8#include <qsplitter.h>
9#include <qlist.h> 9#include <qlist.h>
10#include <qpixmap.h> 10#include <qpixmap.h>
11 11
12#include "bluetoothbase.h" 12#include "bluetoothbase.h"
13#include "btlistitem.h" 13#include "btlistitem.h"
14#include "bticonloader.h" 14#include "bticonloader.h"
15 15
16#include <remotedevice.h> 16#include <remotedevice.h>
17#include <manager.h> 17#include <manager.h>
18 18
19class QVBox; 19class QVBox;
20class QHBoxLayout; 20class QHBoxLayout;
21class QGridLayout; 21class QGridLayout;
22class QFrame; 22class QFrame;
23class QLabel; 23class QLabel;
24class QPushButton; 24class QPushButton;
25class QTabWidget; 25class QTabWidget;
26class QCheckBox; 26class QCheckBox;
27 27
28 28
29namespace OpieTooth { 29namespace OpieTooth {
30 30
31 class BlueBase : public BluetoothBase { 31 class BlueBase : public BluetoothBase {
32 Q_OBJECT 32 Q_OBJECT
33 33
34 public: 34 public:
35 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 35 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
36 ~BlueBase(); 36 ~BlueBase();
37 37
38 protected: 38 protected:
39 39
40 40
41 private slots: 41 private slots:
42 void startScan(); 42 void startScan();
43 43
44 private: 44 private:
45 void readConfig(); 45 void readConfig();
46 void writeConfig(); 46 void writeConfig();
47 void readSavedDevices(); 47 void readSavedDevices();
48 void writeSavedDevices(); 48 void writeSavedDevices();
49 void writeToHciConfig(); 49 void writeToHciConfig();
50 QString status()const; 50 QString status()const;
51 void initGui(); 51 void initGui();
52 void setInfo(); 52 void setInfo();
53 Manager *m_localDevice; 53 Manager *m_localDevice;
54 QMap<QString,BTListItem*> m_deviceList; 54 QMap<QString,BTListItem*> m_deviceList;
55 55
56 void deviceActive( const RemoteDevice &device ); 56 void deviceActive( const RemoteDevice &device );
57 57
58 QString m_deviceName; 58 QString m_deviceName;
59 QString m_defaultPasskey; 59 QString m_defaultPasskey;
60 bool m_useEncryption; 60 bool m_useEncryption;
61 bool m_enableAuthentification; 61 bool m_enableAuthentification;
62 bool m_enablePagescan; 62 bool m_enablePagescan;
63 bool m_enableInquiryscan; 63 bool m_enableInquiryscan;
64 64
65 QPixmap m_offPix; 65 QPixmap m_offPix;
66 QPixmap m_onPix; 66 QPixmap m_onPix;
67 67
68 BTIconLoader *m_iconLoader; 68 BTIconLoader *m_iconLoader;
69 69
70 private slots: 70 private slots:
71 void addSearchedDevices( QValueList<RemoteDevice> &newDevices ); 71 void addSearchedDevices( const QValueList<RemoteDevice> &newDevices );
72 void addServicesToDevice( BTListItem *item ); 72 void addServicesToDevice( BTListItem *item );
73 void addServicesToDevice( const QString& device, Services::ValueList ); 73 void addServicesToDevice( const QString& device, Services::ValueList );
74 void addConnectedDevices(); 74 void addConnectedDevices();
75 void addConnectedDevices( Connection::ValueList ); 75 void addConnectedDevices( Connection::ValueList );
76 void startServiceActionClicked( QListViewItem *item ); 76 void startServiceActionClicked( QListViewItem *item );
77 void startServiceActionHold( QListViewItem *, const QPoint &, int ); 77 void startServiceActionHold( QListViewItem *, const QPoint &, int );
78 void deviceActive( const QString& mac, bool connected ); 78 void deviceActive( const QString& mac, bool connected );
79 void applyConfigChanges(); 79 void applyConfigChanges();
80 80
81 }; 81 };
82 82
83} 83}
84 84
85#endif 85#endif
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index 55f2fd2..4f0ea60 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -1,27 +1,27 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on debug 2CONFIG = qt warn_on debug
3#CONFIG = qt warn_on release 3#CONFIG = qt warn_on release
4HEADERS = bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h 4HEADERS = popuphelper.h bluebase.h scandialog.h btlistitem.h hciconfwrapper.h bticonloader.h
5SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp bticonloader.cpp 5SOURCES = popuphelper.cpp main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp bticonloader.cpp
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
7INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib 7INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lopietooth -lopie 9LIBS += -lqpe -lopietooth -lopie
10INTERFACES = bluetoothbase.ui devicedialog.ui 10INTERFACES = bluetoothbase.ui devicedialog.ui
11DESTDIR = $(OPIEDIR)/bin 11DESTDIR = $(OPIEDIR)/bin
12TARGET = bluetooth-manager 12TARGET = bluetooth-manager
13 13
14TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ 14TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \
15 ../../../../i18n/en/bluetooth-manager.ts \ 15 ../../../../i18n/en/bluetooth-manager.ts \
16 ../../../../i18n/es/bluetooth-manager.ts \ 16 ../../../../i18n/es/bluetooth-manager.ts \
17 ../../../../i18n/fr/bluetooth-manager.ts \ 17 ../../../../i18n/fr/bluetooth-manager.ts \
18 ../../../../i18n/hu/bluetooth-manager.ts \ 18 ../../../../i18n/hu/bluetooth-manager.ts \
19 ../../../../i18n/ja/bluetooth-manager.ts \ 19 ../../../../i18n/ja/bluetooth-manager.ts \
20 ../../../../i18n/ko/bluetooth-manager.ts \ 20 ../../../../i18n/ko/bluetooth-manager.ts \
21 ../../../../i18n/no/bluetooth-manager.ts \ 21 ../../../../i18n/no/bluetooth-manager.ts \
22 ../../../../i18n/pl/bluetooth-manager.ts \ 22 ../../../../i18n/pl/bluetooth-manager.ts \
23 ../../../../i18n/pt/bluetooth-manager.ts \ 23 ../../../../i18n/pt/bluetooth-manager.ts \
24 ../../../../i18n/pt_BR/bluetooth-manager.ts \ 24 ../../../../i18n/pt_BR/bluetooth-manager.ts \
25 ../../../../i18n/sl/bluetooth-manager.ts \ 25 ../../../../i18n/sl/bluetooth-manager.ts \
26 ../../../../i18n/zh_CN/bluetooth-manager.ts \ 26 ../../../../i18n/zh_CN/bluetooth-manager.ts \
27 ../../../../i18n/zh_TW/bluetooth-manager.ts 27 ../../../../i18n/zh_TW/bluetooth-manager.ts
diff --git a/noncore/net/opietooth/manager/popuphelper.cpp b/noncore/net/opietooth/manager/popuphelper.cpp
new file mode 100644
index 0000000..2a6dad0
--- a/dev/null
+++ b/noncore/net/opietooth/manager/popuphelper.cpp
@@ -0,0 +1,25 @@
1
2#include "popuphelper.h"
3
4using namespace OpieTooth;
5
6PopupHelper::PopupHelper() {
7 init();
8}
9PopupHelper::~PopupHelper() {
10
11}
12void PopupHelper::insert( int id, popupFactory fact ) {
13 m_map.insert(id, fact );
14}
15QPopupMenu* PopupHelper::find( int id ) {
16 FactoryMap::Iterator it = m_map.find(id );
17 if ( it != m_map.end() ) {
18 popupFactory fact = it.data();
19 return (*fact)();
20 }
21 return 0l;
22}
23void PopupHelper::init() {
24
25}
diff --git a/noncore/net/opietooth/manager/popuphelper.h b/noncore/net/opietooth/manager/popuphelper.h
new file mode 100644
index 0000000..7485f71
--- a/dev/null
+++ b/noncore/net/opietooth/manager/popuphelper.h
@@ -0,0 +1,25 @@
1
2#ifndef OPIE_TOOTH_POPUP_HELPER
3#define OPIE_TOOTH_POPUP_HELPER
4
5#include <qpopupmenu.h>
6#include <qmap.h>
7
8
9namespace OpieTooth {
10 typedef QPopupMenu* (*popupFactory)(void);
11 typedef QMap<int, popupFactory> FactoryMap;
12 class PopupHelper {
13 public:
14 PopupHelper();
15 ~PopupHelper();
16 void insert( int id, popupFactory fact );
17 QPopupMenu* find( int id );
18 private:
19 void init();
20 FactoryMap m_map;
21
22 };
23};
24
25#endif
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h
index cc890f3..f18784d 100644
--- a/noncore/net/opietooth/manager/scandialog.h
+++ b/noncore/net/opietooth/manager/scandialog.h
@@ -1,79 +1,79 @@
1/* main.cpp 1/* main.cpp
2 * 2 *
3 * copyright : (c) 2002 by Maximilian Reiß 3 * copyright : (c) 2002 by Maximilian Reiß
4 * email : max.reiss@gmx.de 4 * email : max.reiss@gmx.de
5 * 5 *
6 */ 6 */
7/*************************************************************************** 7/***************************************************************************
8 * * 8 * *
9 * This program is free software; you can redistribute it and/or modify * 9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by * 10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or * 11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. * 12 * (at your option) any later version. *
13 * * 13 * *
14 ***************************************************************************/ 14 ***************************************************************************/
15 15
16 16
17#ifndef SCANDIALOG_H 17#ifndef SCANDIALOG_H
18#define SCANDIALOG_H 18#define SCANDIALOG_H
19 19
20#include <qvariant.h> 20#include <qvariant.h>
21#include <qdialog.h> 21#include <qdialog.h>
22#include <qlist.h> 22#include <qlist.h>
23 23
24#include <remotedevice.h> 24#include <remotedevice.h>
25class QVBoxLayout; 25class QVBoxLayout;
26class QHBoxLayout; 26class QHBoxLayout;
27class QGridLayout; 27class QGridLayout;
28class QFrame; 28class QFrame;
29class QLabel; 29class QLabel;
30class QListView; 30class QListView;
31class QListViewItem; 31class QListViewItem;
32class QPushButton; 32class QPushButton;
33class QProgressBar; 33class QProgressBar;
34 34
35 35
36namespace OpieTooth { 36namespace OpieTooth {
37 37
38 38
39class Manager; 39class Manager;
40class Device; 40class Device;
41 41
42 class ScanDialog : public QDialog { 42 class ScanDialog : public QDialog {
43 Q_OBJECT 43 Q_OBJECT
44 44
45 public: 45 public:
46 ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 46 ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
47 ~ScanDialog(); 47 ~ScanDialog();
48 48
49 QFrame* Frame7; 49 QFrame* Frame7;
50 QProgressBar* progress; 50 QProgressBar* progress;
51 QPushButton* StartButton; 51 QPushButton* StartButton;
52 QPushButton* StopButton; 52 QPushButton* StopButton;
53 QListView* ListView1; 53 QListView* ListView1;
54 54
55public slots: 55public slots:
56 void accept(); 56 void accept();
57 57
58 protected: 58 protected:
59 QVBoxLayout* Layout11; 59 QVBoxLayout* Layout11;
60 60
61 private slots: 61 private slots:
62 void stopSearch(); 62 void stopSearch();
63 void startSearch(); 63 void startSearch();
64 void progressTimer(); 64 void progressTimer();
65 void fillList(const QString& device, RemoteDevice::ValueList list); 65 void fillList(const QString& device, RemoteDevice::ValueList list);
66 66
67 private: 67 private:
68 void emitToManager(); 68 void emitToManager();
69 Manager *localDevice; 69 Manager *localDevice;
70 int progressStat; 70 int progressStat;
71 71
72 signals: 72 signals:
73 void selectedDevices(QValueList<RemoteDevice>&); 73 void selectedDevices(const QValueList<RemoteDevice>&);
74 }; 74 };
75 75
76 76
77} 77}
78 78
79#endif // SCANDIALOG_H 79#endif // SCANDIALOG_H