summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp138
-rw-r--r--noncore/net/opietooth/manager/bluebase.h32
-rw-r--r--noncore/net/opietooth/manager/main.cpp6
-rw-r--r--noncore/net/opietooth/manager/manager.pro6
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp113
-rw-r--r--noncore/net/opietooth/manager/scandialog.h71
-rw-r--r--noncore/net/opietooth/manager/scandialog.ui155
7 files changed, 277 insertions, 244 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 3d446f0..c905ea3 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -38,78 +38,79 @@
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39#include <qpe/config.h> 39#include <qpe/config.h>
40 40
41BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
42 : BluetoothBase( parent, name, fl ) {
43 41
42namespace OpieTooth {
44 43
45 QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan()));
46 QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges()));
47 44
48 QPalette pal = this->palette(); 45 BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
49 QColor col = pal.color(QPalette::Active, QColorGroup::Background); 46 : BluetoothBase( parent, name, fl ) {
50 pal.setColor(QPalette::Active, QColorGroup::Button, col);
51 pal.setColor(QPalette::Inactive, QColorGroup::Button, col);
52 pal.setColor(QPalette::Normal, QColorGroup::Button, col);
53 pal.setColor(QPalette::Disabled, QColorGroup::Button, col);
54 this->setPalette(pal);
55 47
56 readConfig();
57 initGui();
58}
59 48
60/** 49 QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan()));
50 QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges()));
51
52 QPalette pal = this->palette();
53 QColor col = pal.color(QPalette::Active, QColorGroup::Background);
54 pal.setColor(QPalette::Active, QColorGroup::Button, col);
55 pal.setColor(QPalette::Inactive, QColorGroup::Button, col);
56 pal.setColor(QPalette::Normal, QColorGroup::Button, col);
57 pal.setColor(QPalette::Disabled, QColorGroup::Button, col);
58 this->setPalette(pal);
59
60 readConfig();
61 initGui();
62 }
63
64/**
61 * Reads all options from the config file 65 * Reads all options from the config file
62 */ 66 */
63void BlueBase::readConfig() { 67 void BlueBase::readConfig() {
64 68
65 Config cfg("bluetoothmanager"); 69 Config cfg("bluetoothmanager");
66 cfg.setGroup("bluezsettings"); 70 cfg.setGroup("bluezsettings");
67
68 71
69 deviceName = cfg.readEntry("name", "No name"); // name the device should identify with
70 defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak
71 useEncryption = cfg.readNumEntry("useEncryption", 1);
72 enableAuthentification = cfg.readNumEntry("enableAuthentification", 1);
73 enablePagescan = cfg.readNumEntry("enablePagescan",1);
74 enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1);
75 72
76} 73 deviceName = cfg.readEntry("name", "No name"); // name the device should identify with
74 defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak
75 useEncryption = cfg.readNumEntry("useEncryption", 1);
76 enableAuthentification = cfg.readNumEntry("enableAuthentification", 1);
77 enablePagescan = cfg.readNumEntry("enablePagescan",1);
78 enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1);
79
80 }
77 81
78/** 82/**
79 * Writes all options to the config file 83 * Writes all options to the config file
80 */ 84 */
81void BlueBase::writeConfig() { 85 void BlueBase::writeConfig() {
82
83 86
84 Config cfg("bluetoothmanager");
85 cfg.setGroup("bluezsettings");
86
87 87
88 cfg.writeEntry("name", deviceName); 88 Config cfg("bluetoothmanager");
89 cfg.writeEntryCrypt("passkey", defaultPasskey); 89 cfg.setGroup("bluezsettings");
90 cfg.writeEntry("useEncryption", useEncryption);
91 cfg.writeEntry("enableAuthentification", enableAuthentification);
92 cfg.writeEntry("enablePagescan",enablePagescan);
93 cfg.writeEntry("enableInquiryscan", enableInquiryscan);
94 90
95 91
92 cfg.writeEntry("name", deviceName);
93 cfg.writeEntryCrypt("passkey", defaultPasskey);
94 cfg.writeEntry("useEncryption", useEncryption);
95 cfg.writeEntry("enableAuthentification", enableAuthentification);
96 cfg.writeEntry("enablePagescan",enablePagescan);
97 cfg.writeEntry("enableInquiryscan", enableInquiryscan);
96} 98}
97 99
98 100
99/** 101/**
100 * Set up the gui 102 * Set up the gui
101 */ 103 */
102void BlueBase::initGui() { 104 void BlueBase::initGui() {
103 105
104 StatusLabel->setText(getStatus()); // maybe move it to getStatus() 106 StatusLabel->setText(getStatus()); // maybe move it to getStatus()
105
106 cryptCheckBox->setChecked(useEncryption);
107 authCheckBox->setChecked(enableAuthentification);
108 pagescanCheckBox->setChecked(enablePagescan);
109 inquiryscanCheckBox->setChecked(enableInquiryscan);
110 deviceNameLine->setText(deviceName);
111 passkeyLine->setText(defaultPasskey);
112 107
108 cryptCheckBox->setChecked(useEncryption);
109 authCheckBox->setChecked(enableAuthentification);
110 pagescanCheckBox->setChecked(enablePagescan);
111 inquiryscanCheckBox->setChecked(enableInquiryscan);
112 deviceNameLine->setText(deviceName);
113 passkeyLine->setText(defaultPasskey);
113} 114}
114 115
115 116
@@ -117,49 +118,48 @@ void BlueBase::initGui() {
117 * Get the status informations and returns it 118 * Get the status informations and returns it
118 * @return QString the status informations gathered 119 * @return QString the status informations gathered
119 */ 120 */
120QString BlueBase::getStatus(){ 121 QString BlueBase::getStatus(){
121 122
122 return ("manger.h need also a status method"); 123 return ("manger.h need also a status method");
123 124
124} 125 }
125 126
126 127
127/** 128/**
128 * Read the current values from the gui and invoke writeConfig() 129 * Read the current values from the gui and invoke writeConfig()
129 */ 130 */
130void BlueBase::applyConfigChanges() { 131 void BlueBase::applyConfigChanges() {
131 132
132 deviceName = deviceNameLine->text(); 133 deviceName = deviceNameLine->text();
133 defaultPasskey = passkeyLine->text(); 134 defaultPasskey = passkeyLine->text();
134 useEncryption = cryptCheckBox->isChecked(); 135 useEncryption = cryptCheckBox->isChecked();
135 enableAuthentification = authCheckBox->isChecked(); 136 enableAuthentification = authCheckBox->isChecked();
136 enablePagescan = pagescanCheckBox->isChecked(); 137 enablePagescan = pagescanCheckBox->isChecked();
137 enableInquiryscan = inquiryscanCheckBox->isChecked(); 138 enableInquiryscan = inquiryscanCheckBox->isChecked();
138 139
139 writeConfig(); 140 writeConfig();
140 141
141 QMessageBox* box = new QMessageBox(this, "Test"); 142 QMessageBox* box = new QMessageBox(this, "Test");
142 box->setText(tr("Changes applied")); 143 box->setText(tr("Changes applied"));
143 box->show(); 144 box->show();
144 145
145 // falls nötig hcid killhupen - die funktionalität adden 146 // falls nötig hcid killhupen - die funktionalität adden
146
147
148} 147}
149 148
150 149
151/** 150/**
152 * Open the "scan for devices" dialog 151 * Open the "scan for devices" dialog
153 */ 152 */
154void BlueBase::startScan() { 153 void BlueBase::startScan() {
155 ScanDialog *scan = new ScanDialog( this, "", true); 154 ScanDialog *scan = new ScanDialog( this, "", true);
156 scan->exec(); 155 scan->exec();
157} 156 }
158 157
159/** 158/**
160 * Decontructor 159 * Decontructor
161 */ 160 */
162BlueBase::~BlueBase(){ 161 BlueBase::~BlueBase(){
163} 162 }
164 163
164}
165 165
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index fb1844c..023af7a 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -18,39 +18,41 @@ class QPushButton;
18class QTabWidget; 18class QTabWidget;
19class QCheckBox; 19class QCheckBox;
20 20
21class BlueBase : public BluetoothBase { 21namespace OpieTooth {
22 Q_OBJECT
23 22
24public: 23 class BlueBase : public BluetoothBase {
25 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 24 Q_OBJECT
26 ~BlueBase();
27 25
28protected: 26 public:
27 BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
28 ~BlueBase();
29 29
30 protected:
30 31
31 private slots:
32 void startScan();
33 32
34 private: 33 private slots:
34 void startScan();
35
36 private:
35 void readConfig(); 37 void readConfig();
36 void writeConfig(); 38 void writeConfig();
37 QString getStatus(); 39 QString getStatus();
38 void initGui(); 40 void initGui();
39 41
40 42
41 QString deviceName; 43 QString deviceName;
42 QString defaultPasskey; 44 QString defaultPasskey;
43 int useEncryption; 45 int useEncryption;
44 int enableAuthentification; 46 int enableAuthentification;
45 int enablePagescan; 47 int enablePagescan;
46 int enableInquiryscan; 48 int enableInquiryscan;
47 49
48 private slots: 50 private slots:
49
50 void applyConfigChanges();
51 51
52}; 52 void applyConfigChanges();
53 53
54 };
54 55
56}
55 57
56#endif 58#endif
diff --git a/noncore/net/opietooth/manager/main.cpp b/noncore/net/opietooth/manager/main.cpp
index d566419..a86e36d 100644
--- a/noncore/net/opietooth/manager/main.cpp
+++ b/noncore/net/opietooth/manager/main.cpp
@@ -20,17 +20,19 @@
20#include "bluebase.h" 20#include "bluebase.h"
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22 22
23
23QPEApplication *BluetoothApp; 24QPEApplication *BluetoothApp;
24 25
25int main( int argc, char ** argv ) { 26int main( int argc, char ** argv ) {
26 QPEApplication a(argc, argv); 27 QPEApplication a(argc, argv);
27 BluetoothApp=&a; 28 BluetoothApp=&a;
28 29
29 BlueBase t; 30 OpieTooth::BlueBase t;
30 31
31 t.setCaption( BlueBase::tr("Bluetooth Manager") ); 32 // t.setCaption( OpieTooth::BlueBase::tr("Bluetooth Manager") );
32 a.showMainWidget(&t); 33 a.showMainWidget(&t);
33 34
34 return a.exec(); 35 return a.exec();
35} 36}
36 37
38
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index c369eba..5f0a62c 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -1,12 +1,12 @@
1TEMPLATE = app 1TEMPLATE = app
2#CONFIG = qt warn_on debug 2#CONFIG = qt warn_on debug
3CONFIG = qt warn_on release 3CONFIG = qt warn_on release
4HEADERS = bluebase.h 4HEADERS = bluebase.h scandialog.h
5SOURCES = main.cpp bluebase.cpp 5SOURCES = main.cpp bluebase.cpp scandialog.cpp
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
7INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib 7INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lopietooth 9LIBS += -lqpe -lopietooth
10INTERFACES = bluetoothbase.ui devicedialog.ui scandialog.ui 10INTERFACES = bluetoothbase.ui devicedialog.ui
11TARGET = $(OPIEDIR)/bin/bluetooth-manager 11TARGET = $(OPIEDIR)/bin/bluetooth-manager
12 12
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
new file mode 100644
index 0000000..3ddba3e
--- a/dev/null
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -0,0 +1,113 @@
1/* main.cpp
2 *
3 * ---------------------
4 *
5 * copyright : (c) 2002 by Maximilian Reiß
6 * email : max.reiss@gmx.de
7 *
8 */
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18
19#include "scandialog.h"
20
21#include <qframe.h>
22#include <qheader.h>
23#include <qlabel.h>
24#include <qlistview.h>
25#include <qpushbutton.h>
26#include <qlayout.h>
27#include <qvariant.h>
28#include <qtooltip.h>
29#include <qwhatsthis.h>
30
31#include <manager.h>
32#include <device.h>
33#include <remotedevice.h>
34
35
36namespace OpieTooth {
37
38/*
39
40 */
41 ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
42 : QDialog( parent, name, modal, fl ) {
43
44 if ( !name )
45 setName( "ScanDialog" );
46 resize( 360, 392 );
47 setCaption( tr( "Scan for devices" ) );
48
49 Frame7 = new QFrame( this, "Frame7" );
50 Frame7->setGeometry( QRect( 0, 0, 240, 331 ) );
51 Frame7->setFrameShape( QFrame::StyledPanel );
52 Frame7->setFrameShadow( QFrame::Raised );
53
54 QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" );
55 privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 310 ) );
56 Layout11 = new QGridLayout( privateLayoutWidget );
57 Layout11->setSpacing( 6 );
58 Layout11->setMargin( 0 );
59
60
61 TextLabel10 = new QLabel( privateLayoutWidget, "TextLabel10" );
62 TextLabel10->setText( tr( "ersetzen durch qprogressbar" ) );
63
64 Layout11->addMultiCellWidget( TextLabel10, 1, 1, 0, 1 );
65
66 StartButton = new QPushButton( privateLayoutWidget, "PushButton13" );
67 StartButton->setText( tr( "Start" ) );
68
69 Layout11->addWidget( StartButton, 2, 0 );
70
71 PushButton6 = new QPushButton( privateLayoutWidget, "PushButton6" );
72 PushButton6->setText( tr( "Stop" ) );
73
74 Layout11->addWidget( PushButton6, 2, 1 );
75
76 ListView1 = new QListView( privateLayoutWidget, "ListView1" );
77
78 // ListView1->addColumn( tr( "In List" ) );
79 ListView1->addColumn( tr( "Device Name" ) );
80 //ListView1->addColumn( tr( "Type" ) );
81
82 Layout11->addMultiCellWidget( ListView1, 0, 0, 0, 1 );
83
84 connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) );
85 connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ),
86 this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ;
87 }
88
89 void ScanDialog::startSearch() {
90 // read it from config later
91 localDevice = new Manager( "hci0" );
92 localDevice->searchDevices();
93 }
94
95
96 void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) {
97
98
99 RemoteDevices::ValueList::Iterator it;
100 for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
101
102
103 }
104 }
105
106/*
107 * Cleanup
108 */
109 ScanDialog::~ScanDialog() {
110 delete localDevice;
111 }
112
113}
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h
new file mode 100644
index 0000000..5cebb11
--- a/dev/null
+++ b/noncore/net/opietooth/manager/scandialog.h
@@ -0,0 +1,71 @@
1/* main.cpp
2 *
3 * copyright : (c) 2002 by Maximilian Reiß
4 * email : max.reiss@gmx.de
5 *
6 */
7/***************************************************************************
8 * *
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 *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16
17#ifndef SCANDIALOG_H
18#define SCANDIALOG_H
19
20#include <qvariant.h>
21#include <qdialog.h>
22
23
24#include <remotedevice.h>
25
26class QVBoxLayout;
27class QHBoxLayout;
28class QGridLayout;
29class QFrame;
30class QLabel;
31class QListView;
32class QListViewItem;
33class QPushButton;
34
35class Manager;
36class Device;
37
38
39namespace OpieTooth {
40
41
42
43 class ScanDialog : public QDialog {
44 Q_OBJECT
45
46 public:
47 ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
48 ~ScanDialog();
49
50 QFrame* Frame7;
51 QLabel* TextLabel10;
52 QPushButton* StartButton;
53 QPushButton* PushButton6;
54 QListView* ListView1;
55
56
57 protected:
58 QGridLayout* Layout11;
59
60 private slots:
61 void startSearch();
62 void fillList(const QString& device, RemoteDevices::ValueList list);
63
64 private:
65
66 Manager *localDevice;
67 };
68
69}
70
71#endif // SCANDIALOG_H
diff --git a/noncore/net/opietooth/manager/scandialog.ui b/noncore/net/opietooth/manager/scandialog.ui
deleted file mode 100644
index 37847ba..0000000
--- a/noncore/net/opietooth/manager/scandialog.ui
+++ b/dev/null
@@ -1,155 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>ScanDialog</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>ScanDialog</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>360</width>
15 <height>392</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Form3</string>
21 </property>
22 <widget>
23 <class>QFrame</class>
24 <property stdset="1">
25 <name>name</name>
26 <cstring>Frame7</cstring>
27 </property>
28 <property stdset="1">
29 <name>geometry</name>
30 <rect>
31 <x>0</x>
32 <y>0</y>
33 <width>240</width>
34 <height>331</height>
35 </rect>
36 </property>
37 <property stdset="1">
38 <name>frameShape</name>
39 <enum>StyledPanel</enum>
40 </property>
41 <property stdset="1">
42 <name>frameShadow</name>
43 <enum>Raised</enum>
44 </property>
45 <widget>
46 <class>QLayoutWidget</class>
47 <property stdset="1">
48 <name>name</name>
49 <cstring>Layout11</cstring>
50 </property>
51 <property stdset="1">
52 <name>geometry</name>
53 <rect>
54 <x>10</x>
55 <y>9</y>
56 <width>221</width>
57 <height>310</height>
58 </rect>
59 </property>
60 <grid>
61 <property stdset="1">
62 <name>margin</name>
63 <number>0</number>
64 </property>
65 <property stdset="1">
66 <name>spacing</name>
67 <number>6</number>
68 </property>
69 <widget row="1" column="0" rowspan="1" colspan="2" >
70 <class>QLabel</class>
71 <property stdset="1">
72 <name>name</name>
73 <cstring>TextLabel10</cstring>
74 </property>
75 <property stdset="1">
76 <name>text</name>
77 <string>ersetzen durch qprogressbar</string>
78 </property>
79 </widget>
80 <widget row="2" column="0" >
81 <class>QPushButton</class>
82 <property stdset="1">
83 <name>name</name>
84 <cstring>PushButton13</cstring>
85 </property>
86 <property stdset="1">
87 <name>text</name>
88 <string>Start</string>
89 </property>
90 </widget>
91 <widget row="2" column="1" >
92 <class>QPushButton</class>
93 <property stdset="1">
94 <name>name</name>
95 <cstring>PushButton6</cstring>
96 </property>
97 <property stdset="1">
98 <name>text</name>
99 <string>Stop</string>
100 </property>
101 </widget>
102 <widget row="0" column="0" rowspan="1" colspan="2" >
103 <class>QListView</class>
104 <column>
105 <property>
106 <name>text</name>
107 <string>In List</string>
108 </property>
109 <property>
110 <name>clickable</name>
111 <bool>true</bool>
112 </property>
113 <property>
114 <name>resizeable</name>
115 <bool>true</bool>
116 </property>
117 </column>
118 <column>
119 <property>
120 <name>text</name>
121 <string>Device Name</string>
122 </property>
123 <property>
124 <name>clickable</name>
125 <bool>true</bool>
126 </property>
127 <property>
128 <name>resizeable</name>
129 <bool>true</bool>
130 </property>
131 </column>
132 <column>
133 <property>
134 <name>text</name>
135 <string>Type</string>
136 </property>
137 <property>
138 <name>clickable</name>
139 <bool>true</bool>
140 </property>
141 <property>
142 <name>resizeable</name>
143 <bool>true</bool>
144 </property>
145 </column>
146 <property stdset="1">
147 <name>name</name>
148 <cstring>ListView1</cstring>
149 </property>
150 </widget>
151 </grid>
152 </widget>
153 </widget>
154</widget>
155</UI>