Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 105 |
1 files changed, 104 insertions, 1 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index c17271f..3d446f0 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -21,42 +21,145 @@ | |||
21 | 21 | ||
22 | #include <qframe.h> | 22 | #include <qframe.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qvariant.h> | 26 | #include <qvariant.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qimage.h> | 28 | #include <qimage.h> |
29 | #include <qpixmap.h> | 29 | #include <qpixmap.h> |
30 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
31 | #include <qscrollview.h> | 31 | #include <qscrollview.h> |
32 | #include <qvbox.h> | 32 | #include <qvbox.h> |
33 | #include <qmessagebox.h> | ||
33 | #include <qapplication.h> | 34 | #include <qapplication.h> |
34 | #include <qcheckbox.h> | 35 | #include <qcheckbox.h> |
36 | #include <qlineedit.h> | ||
35 | 37 | ||
36 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
39 | #include <qpe/config.h> | ||
37 | 40 | ||
38 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 41 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
39 | : BluetoothBase( parent, name, fl ) { | 42 | : BluetoothBase( parent, name, fl ) { |
40 | 43 | ||
41 | 44 | ||
42 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); | 45 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); |
46 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); | ||
43 | 47 | ||
44 | QPalette pal = this->palette(); | 48 | QPalette pal = this->palette(); |
45 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | 49 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); |
46 | pal.setColor(QPalette::Active, QColorGroup::Button, col); | 50 | pal.setColor(QPalette::Active, QColorGroup::Button, col); |
47 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); | 51 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); |
48 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); | 52 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); |
49 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); | 53 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); |
50 | this->setPalette(pal); | 54 | this->setPalette(pal); |
55 | |||
56 | readConfig(); | ||
57 | initGui(); | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * Reads all options from the config file | ||
62 | */ | ||
63 | void BlueBase::readConfig() { | ||
64 | |||
65 | Config cfg("bluetoothmanager"); | ||
66 | cfg.setGroup("bluezsettings"); | ||
67 | |||
68 | |||
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 | |||
76 | } | ||
77 | |||
78 | /** | ||
79 | * Writes all options to the config file | ||
80 | */ | ||
81 | void BlueBase::writeConfig() { | ||
82 | |||
83 | |||
84 | Config cfg("bluetoothmanager"); | ||
85 | cfg.setGroup("bluezsettings"); | ||
86 | |||
87 | |||
88 | cfg.writeEntry("name", deviceName); | ||
89 | cfg.writeEntryCrypt("passkey", defaultPasskey); | ||
90 | cfg.writeEntry("useEncryption", useEncryption); | ||
91 | cfg.writeEntry("enableAuthentification", enableAuthentification); | ||
92 | cfg.writeEntry("enablePagescan",enablePagescan); | ||
93 | cfg.writeEntry("enableInquiryscan", enableInquiryscan); | ||
94 | |||
95 | |||
96 | } | ||
97 | |||
98 | |||
99 | /** | ||
100 | * Set up the gui | ||
101 | */ | ||
102 | void BlueBase::initGui() { | ||
103 | |||
104 | 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 | |||
113 | } | ||
114 | |||
115 | |||
116 | /** | ||
117 | * Get the status informations and returns it | ||
118 | * @return QString the status informations gathered | ||
119 | */ | ||
120 | QString BlueBase::getStatus(){ | ||
121 | |||
122 | return ("manger.h need also a status method"); | ||
123 | |||
124 | } | ||
125 | |||
126 | |||
127 | /** | ||
128 | * Read the current values from the gui and invoke writeConfig() | ||
129 | */ | ||
130 | void BlueBase::applyConfigChanges() { | ||
131 | |||
132 | deviceName = deviceNameLine->text(); | ||
133 | defaultPasskey = passkeyLine->text(); | ||
134 | useEncryption = cryptCheckBox->isChecked(); | ||
135 | enableAuthentification = authCheckBox->isChecked(); | ||
136 | enablePagescan = pagescanCheckBox->isChecked(); | ||
137 | enableInquiryscan = inquiryscanCheckBox->isChecked(); | ||
138 | |||
139 | writeConfig(); | ||
140 | |||
141 | QMessageBox* box = new QMessageBox(this, "Test"); | ||
142 | box->setText(tr("Changes applied")); | ||
143 | box->show(); | ||
144 | |||
145 | // falls nötig hcid killhupen - die funktionalität adden | ||
146 | |||
147 | |||
51 | } | 148 | } |
52 | 149 | ||
53 | 150 | ||
151 | /** | ||
152 | * Open the "scan for devices" dialog | ||
153 | */ | ||
54 | void BlueBase::startScan() { | 154 | void BlueBase::startScan() { |
55 | Form3 *scan = new Form3( this, "", true); | 155 | ScanDialog *scan = new ScanDialog( this, "", true); |
56 | scan->exec(); | 156 | scan->exec(); |
57 | } | 157 | } |
58 | 158 | ||
159 | /** | ||
160 | * Decontructor | ||
161 | */ | ||
59 | BlueBase::~BlueBase(){ | 162 | BlueBase::~BlueBase(){ |
60 | } | 163 | } |
61 | 164 | ||
62 | 165 | ||