summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-23 20:07:29 (UTC)
committer harlekin <harlekin>2002-06-23 20:07:29 (UTC)
commit7b861d2f14bdb50558863354522dee7c7a9ef34d (patch) (unidiff)
treebb7633ab55e6564f47e9fd16321fa5841c055671
parented7e4fe3f0f838957c0830b8357d2252327dc938 (diff)
downloadopie-7b861d2f14bdb50558863354522dee7c7a9ef34d.zip
opie-7b861d2f14bdb50558863354522dee7c7a9ef34d.tar.gz
opie-7b861d2f14bdb50558863354522dee7c7a9ef34d.tar.bz2
update
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp8
-rw-r--r--noncore/net/opietooth/manager/bluebase.h2
-rw-r--r--noncore/net/opietooth/manager/btlistitem.cpp11
-rw-r--r--noncore/net/opietooth/manager/btlistitem.h6
-rw-r--r--noncore/net/opietooth/manager/manager.pro4
5 files changed, 17 insertions, 14 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 772dbd1..77eb62b 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -16,98 +16,99 @@
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "bluebase.h" 18#include "bluebase.h"
19#include "scandialog.h" 19#include "scandialog.h"
20 20
21#include <qframe.h> 21#include <qframe.h>
22#include <qlabel.h> 22#include <qlabel.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qvariant.h> 25#include <qvariant.h>
26#include <qwhatsthis.h> 26#include <qwhatsthis.h>
27#include <qimage.h> 27#include <qimage.h>
28#include <qpixmap.h> 28#include <qpixmap.h>
29#include <qtabwidget.h> 29#include <qtabwidget.h>
30#include <qscrollview.h> 30#include <qscrollview.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmessagebox.h> 32#include <qmessagebox.h>
33#include <qapplication.h> 33#include <qapplication.h>
34#include <qcheckbox.h> 34#include <qcheckbox.h>
35#include <qlineedit.h> 35#include <qlineedit.h>
36#include <qlistview.h> 36#include <qlistview.h>
37#include <qdir.h> 37#include <qdir.h>
38#include <qpopupmenu.h> 38#include <qpopupmenu.h>
39 39
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41#include <qpe/config.h> 41#include <qpe/config.h>
42 42
43#include <remotedevice.h> 43#include <remotedevice.h>
44 44
45 45
46namespace OpieTooth { 46namespace OpieTooth {
47 47
48 48
49 BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 49 BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
50 : BluetoothBase( parent, name, fl ) { 50 : BluetoothBase( parent, name, fl ) {
51 51
52 localDevice = new Manager( "hci0" ); 52 localDevice = new Manager( "hci0" );
53 53
54 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 54 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
55 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 55 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
56 // not good since lib is async 56 // not good since lib is async
57 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), 57 // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ),
58 // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); 58 // this, SLOT( addServicesToDevice( QListViewItem * ) ) );
59 connect( ListView2, SIGNAL( clicked( QListViewItem* )), 59 connect( ListView2, SIGNAL( clicked( QListViewItem* )),
60 this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); 60 this, SLOT( startServiceActionClicked( QListViewItem* ) ) );
61 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), 61 connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ),
62 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); 62 this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) );
63 connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), 63 connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ),
64 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); 64 this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) );
65 65 // connect( localDevice, SIGNAL( available( const QString& device, bool connected ) ),
66 // this, SLOT() );
66 67
67 //Load all icons needed 68 //Load all icons needed
68 69
69 offPix = Resource::loadPixmap( "editdelete" ); 70 offPix = Resource::loadPixmap( "editdelete" );
70 onPix = Resource::loadPixmap( "installed" ); 71 onPix = Resource::loadPixmap( "installed" );
71 72
72 QPalette pal = this->palette(); 73 QPalette pal = this->palette();
73 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 74 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
74 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 75 pal.setColor( QPalette::Active, QColorGroup::Button, col );
75 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 76 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
76 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 77 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
77 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 78 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
78 this->setPalette( pal ); 79 this->setPalette( pal );
79 80
80 setCaption( tr( "Bluetooth Manager" ) ); 81 setCaption( tr( "Bluetooth Manager" ) );
81 82
82 readConfig(); 83 readConfig();
83 initGui(); 84 initGui();
84 85
85 //TESTING 86 //TESTING
86 ListView2->setRootIsDecorated(true); 87 ListView2->setRootIsDecorated(true);
87 88
88 QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" ); 89 QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" );
89 topLV2->setPixmap( 1, onPix ); 90 topLV2->setPixmap( 1, onPix );
90 topLV2->setText(4, "device" ); 91 topLV2->setText(4, "device" );
91 (void) new QListViewItem( topLV2, "Serial" ); 92 (void) new QListViewItem( topLV2, "Serial" );
92 (void) new QListViewItem( topLV2, "BlueNiC" ); 93 (void) new QListViewItem( topLV2, "BlueNiC" );
93 } 94 }
94 95
95 96
96 /** 97 /**
97 * Reads all options from the config file 98 * Reads all options from the config file
98 */ 99 */
99 void BlueBase::readConfig() { 100 void BlueBase::readConfig() {
100 101
101 Config cfg( "bluetoothmanager" ); 102 Config cfg( "bluetoothmanager" );
102 cfg.setGroup( "bluezsettings" ); 103 cfg.setGroup( "bluezsettings" );
103 104
104 105
105 deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 106 deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
106 defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 107 defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
107 useEncryption = cfg.readNumEntry( "useEncryption" , 1 ); 108 useEncryption = cfg.readNumEntry( "useEncryption" , 1 );
108 enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 ); 109 enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 );
109 enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 ); 110 enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 );
110 enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 ); 111 enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 );
111 112
112 } 113 }
113 114
@@ -355,76 +356,79 @@ namespace OpieTooth {
355 // QListViewItem * myChild = deviceItem->firstChild(); 356 // QListViewItem * myChild = deviceItem->firstChild();
356 //QList<QListViewItem*> tmpList; 357 //QList<QListViewItem*> tmpList;
357 //while( myChild ) { 358 //while( myChild ) {
358 // tmpList.append(myChild); 359 // tmpList.append(myChild);
359 // myChild = myChild->nextSibling(); 360 // myChild = myChild->nextSibling();
360 // } 361 // }
361 362
362 363
363 QValueList<OpieTooth::Services>::Iterator it2; 364 QValueList<OpieTooth::Services>::Iterator it2;
364 365
365 QListViewItem * serviceItem; 366 QListViewItem * serviceItem;
366 367
367 if (!servicesList.isEmpty() ) { 368 if (!servicesList.isEmpty() ) {
368 // add services 369 // add services
369 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { 370 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) {
370 serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() ); 371 serviceItem = new QListViewItem( deviceItem , (*it2).serviceName() );
371 serviceItem->setText(4, "service"); 372 serviceItem->setText(4, "service");
372 } 373 }
373 } else { 374 } else {
374 serviceItem = new QListViewItem( deviceItem , tr("no services found") ); 375 serviceItem = new QListViewItem( deviceItem , tr("no services found") );
375 serviceItem->setText(4, "service"); 376 serviceItem->setText(4, "service");
376 } 377 }
377 } 378 }
378 379
379 380
380 /** 381 /**
381 * Add the existing connections (pairs) to the connections tab. 382 * Add the existing connections (pairs) to the connections tab.
382 * 383 *
383 */ 384 */
384 void BlueBase::addConnectedDevices() { 385 void BlueBase::addConnectedDevices() {
385 386
386 387
387 //mac address 388 //mac address
388 389
389 } 390 }
390 391
391 /** 392 /**
392 * Find out if a device can currently be reached 393 * Find out if a device can currently be reached
393 */ 394 */
394 bool BlueBase::deviceActive( RemoteDevice *device ) { 395 bool BlueBase::deviceActive( RemoteDevice *device ) {
395 396
396 // search by mac 397 // search by mac
397 localDevice->isAvailable( device->mac() ); 398 localDevice->isAvailable( device->mac() );
398 399
399 return true; 400 return true;
400 } 401 }
401 402
402 403
404
405
406
403 /** 407 /**
404 * Open the "scan for devices" dialog 408 * Open the "scan for devices" dialog
405 */ 409 */
406 void BlueBase::startScan() { 410 void BlueBase::startScan() {
407 411
408 ScanDialog *scan = new ScanDialog( this, "", true); 412 ScanDialog *scan = new ScanDialog( this, "", true);
409 QObject::connect( scan, SIGNAL( selectedDevices( QList<RemoteDevice>& ) ), 413 QObject::connect( scan, SIGNAL( selectedDevices( QList<RemoteDevice>& ) ),
410 this, SLOT( addSearchedDevices( QList<RemoteDevice>& ) ) ); 414 this, SLOT( addSearchedDevices( QList<RemoteDevice>& ) ) );
411 415
412 scan->showMaximized(); 416 scan->showMaximized();
413 } 417 }
414 418
415 419
416 /** 420 /**
417 * Set the informations about the local device in information Tab 421 * Set the informations about the local device in information Tab
418 */ 422 */
419 void BlueBase::setInfo() { 423 void BlueBase::setInfo() {
420 StatusLabel->setText( getStatus() ); 424 StatusLabel->setText( getStatus() );
421 } 425 }
422 426
423 /** 427 /**
424 * Decontructor 428 * Decontructor
425 */ 429 */
426 BlueBase::~BlueBase() { 430 BlueBase::~BlueBase() {
427 writeSavedDevices(); 431 writeSavedDevices();
428 } 432 }
429} 433}
430 434
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index bc48bb3..dee721d 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -1,79 +1,77 @@
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 13
14 14
15#include <remotedevice.h> 15#include <remotedevice.h>
16#include <manager.h> 16#include <manager.h>
17 17
18class QVBox; 18class QVBox;
19class QHBoxLayout; 19class QHBoxLayout;
20class QGridLayout; 20class QGridLayout;
21class QFrame; 21class QFrame;
22class QLabel; 22class QLabel;
23class QPushButton; 23class QPushButton;
24class QTabWidget; 24class QTabWidget;
25class QCheckBox; 25class QCheckBox;
26 26
27 27
28namespace OpieTooth { 28namespace OpieTooth {
29 29
30
31
32 class BlueBase : public BluetoothBase { 30 class BlueBase : public BluetoothBase {
33 Q_OBJECT 31 Q_OBJECT
34 32
35 public: 33 public:
36 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 34 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
37 ~BlueBase(); 35 ~BlueBase();
38 36
39 protected: 37 protected:
40 38
41 39
42 private slots: 40 private slots:
43 void startScan(); 41 void startScan();
44 42
45 private: 43 private:
46 void readConfig(); 44 void readConfig();
47 void writeConfig(); 45 void writeConfig();
48 void readSavedDevices(); 46 void readSavedDevices();
49 void writeSavedDevices(); 47 void writeSavedDevices();
50 QString getStatus(); 48 QString getStatus();
51 void initGui(); 49 void initGui();
52 void setInfo(); 50 void setInfo();
53 Manager *localDevice; 51 Manager *localDevice;
54 QMap<QString,QListViewItem*> deviceList; 52 QMap<QString,QListViewItem*> deviceList;
55 53
56 bool deviceActive( RemoteDevice *device ); 54 bool deviceActive( RemoteDevice *device );
57 55
58 QString deviceName; 56 QString deviceName;
59 QString defaultPasskey; 57 QString defaultPasskey;
60 int useEncryption; 58 int useEncryption;
61 int enableAuthentification; 59 int enableAuthentification;
62 int enablePagescan; 60 int enablePagescan;
63 int enableInquiryscan; 61 int enableInquiryscan;
64 62
65 QPixmap offPix; 63 QPixmap offPix;
66 QPixmap onPix; 64 QPixmap onPix;
67 65
68 private slots: 66 private slots:
69 void addSearchedDevices( QList<RemoteDevice> &newDevices ); 67 void addSearchedDevices( QList<RemoteDevice> &newDevices );
70 void addServicesToDevice( QListViewItem *item ); 68 void addServicesToDevice( QListViewItem *item );
71 void addServicesToDevice( const QString& device, Services::ValueList ); 69 void addServicesToDevice( const QString& device, Services::ValueList );
72 void addConnectedDevices(); 70 void addConnectedDevices();
73 void startServiceActionClicked( QListViewItem *item ); 71 void startServiceActionClicked( QListViewItem *item );
74 void startServiceActionHold( QListViewItem *, const QPoint &, int ); 72 void startServiceActionHold( QListViewItem *, const QPoint &, int );
75 void applyConfigChanges(); 73 void applyConfigChanges();
76 74
77 }; 75 };
78 76
79} 77}
diff --git a/noncore/net/opietooth/manager/btlistitem.cpp b/noncore/net/opietooth/manager/btlistitem.cpp
index 4901710..19d1057 100644
--- a/noncore/net/opietooth/manager/btlistitem.cpp
+++ b/noncore/net/opietooth/manager/btlistitem.cpp
@@ -1,30 +1,33 @@
1 1
2#include "btlistitem.h" 2#include "btlistitem.h"
3 3
4namespace OpieTooth { 4namespace OpieTooth {
5 5
6 6
7 BTListItem::BTListItem( QListView * parent ) : QListViewItem( parent ) { 7 BTListItem::BTListItem( QListView * parent ) : QListViewItem( parent ) {
8 8
9 } 9 }
10 10
11 BTListItem::BTListItem( QListViewItem * parent ) : QListViewItem( parent ) { 11 BTListItem::BTListItem( QListViewItem * parent ) : QListViewItem( parent ) {
12 12
13 } 13 }
14 14
15 15
16 // name, and then mac and then servicetype 16 // name, and then mac and then servicetype
17 BTListItem::BTListItem( QListView * parent, QString name , QString mac, QString type ) 17 BTListItem::BTListItem( QListView * parent, QString name , QString mac, QString type )
18 : QListViewItem( parent, name, mac, type ){ 18 : QListViewItem( parent, name ){
19 setText(4, mac);
20 setText(5, type);
19 21
20 } 22 }
21 23
22 BTListItem::BTListItem( QListViewItem * parent , QString name, QString mac, QString type ) 24 BTListItem::BTListItem( QListViewItem * parent , QString name, QString mac, QString type )
23 : QListViewItem( parent, name, mac, type ){ 25 : QListViewItem( parent, name ){
24 26 setText(4, mac);
27 setText(5, type);
25 } 28 }
26 29
27 BTListItem::~BTListItem() { 30 BTListItem::~BTListItem() {
28 } 31 }
29 32
30} 33};
diff --git a/noncore/net/opietooth/manager/btlistitem.h b/noncore/net/opietooth/manager/btlistitem.h
index 28612b0..92b3803 100644
--- a/noncore/net/opietooth/manager/btlistitem.h
+++ b/noncore/net/opietooth/manager/btlistitem.h
@@ -1,24 +1,22 @@
1#ifndef BTLISTITEM_H 1#ifndef BTLISTITEM_H
2#define BTLISTITEM_H 2#define BTLISTITEM_H
3 3
4#include <qlistview.h> 4#include <qlistview.h>
5 5
6namespace OpieTooth { 6namespace OpieTooth {
7 7
8 class BTListItem : public QListViewItem { 8 class BTListItem : public QListViewItem {
9 Q_OBJECT
10 9
11 public: 10 public:
12
13 BTListItem( QListView * parent ); 11 BTListItem( QListView * parent );
14 BTListItem( QListViewItem * parent ); 12 BTListItem( QListViewItem * parent );
15 13
16 // name, and then mac and then servicetype 14 // name, and then mac and then servicetype
17 BTListItem( QListView * , QString, QString, QString ); 15 BTListItem( QListView * , QString, QString, QString );
18 BTListItem( QListViewItem * parent , QString, QString , QString ); 16 BTListItem( QListViewItem * parent , QString, QString , QString );
19 ~BTListItem(); 17 ~BTListItem();
20 18
21 } 19 };
22} 20};
23 21
24#endif 22#endif
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index 1d86684..3754869 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -1,12 +1,12 @@
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 4HEADERS = bluebase.h scandialog.h btlistitem.h
5SOURCES = main.cpp bluebase.cpp scandialog.cpp 5SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.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
11TARGET = $(OPIEDIR)/bin/bluetooth-manager 11TARGET = $(OPIEDIR)/bin/bluetooth-manager
12 12