-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 132 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 7 |
2 files changed, 89 insertions, 50 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 22b16d2..c7e1fe4 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -1,322 +1,356 @@ | |||
1 | /* | 1 | /* |
2 | * bluebase.cpp * | 2 | * bluebase.cpp * |
3 | * --------------------- | 3 | * --------------------- |
4 | * | 4 | * |
5 | * copyright : (c) 2002 by Maximilian Reiß | 5 | * copyright : (c) 2002 by Maximilian Reiß |
6 | * email : max.reiss@gmx.de | 6 | * email : max.reiss@gmx.de |
7 | * | 7 | * |
8 | */ | 8 | */ |
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * 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 * |
12 | * 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 * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
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 | 38 | ||
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | 41 | ||
42 | #include <remotedevice.h> | 42 | #include <remotedevice.h> |
43 | 43 | ||
44 | 44 | ||
45 | namespace OpieTooth { | 45 | namespace OpieTooth { |
46 | 46 | ||
47 | 47 | ||
48 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 48 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
49 | : BluetoothBase( parent, name, fl ) { | 49 | : BluetoothBase( parent, name, fl ) { |
50 | 50 | ||
51 | localDevice = new Manager( "hci0" ); | ||
51 | 52 | ||
52 | QObject::connect( (QObject*)PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); | 53 | QObject::connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); |
53 | QObject::connect( (QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); | 54 | QObject::connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); |
54 | QObject::connect( (QObject*)ListView2, SIGNAL( expanded( QListViewItem * item ) ), | 55 | QObject::connect( ListView2, SIGNAL( expanded( QListViewItem * item ) ), |
55 | this, SLOT( addServicesToDevice( QListViewItem * item ) ) ); | 56 | this, SLOT( addServicesToDevice( QListViewItem * item ) ) ); |
56 | QObject::connect( (QObject*)ListView2, SIGNAL( clicked( QListViewItem * )), | 57 | QObject::connect( ListView2, SIGNAL( clicked( QListViewItem * )), |
57 | this, SLOT( startServiceActionClicked( QListViewItem * item ) ) ); | 58 | this, SLOT( startServiceActionClicked( QListViewItem * item ) ) ); |
59 | connect( localDevice, SIGNAL( foundServices( const QString& device, Services::ValueList ) ), | ||
60 | this, SLOT( addServicesToDevice( const QString& device, Services::ValueList ) ) ); | ||
58 | 61 | ||
59 | // | ||
60 | // QObject::connect( (QObject*) Manager, SIGNAL (foundServices( const QString& device, Services::ValueList ), this () ) ); | 62 | // QObject::connect( (QObject*) Manager, SIGNAL (foundServices( const QString& device, Services::ValueList ), this () ) ); |
61 | 63 | ||
62 | //Load all icons needed | 64 | //Load all icons needed |
63 | 65 | ||
64 | 66 | ||
65 | QPixmap offPix = Resource::loadPixmap( "editdelete" ); | 67 | QPixmap offPix = Resource::loadPixmap( "editdelete" ); |
66 | QPixmap onPix = Resource::loadPixmap( "installed" ); | 68 | QPixmap onPix = Resource::loadPixmap( "installed" ); |
67 | 69 | ||
68 | QPalette pal = this->palette(); | 70 | QPalette pal = this->palette(); |
69 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | 71 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); |
70 | pal.setColor(QPalette::Active, QColorGroup::Button, col); | 72 | pal.setColor(QPalette::Active, QColorGroup::Button, col); |
71 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); | 73 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); |
72 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); | 74 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); |
73 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); | 75 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); |
74 | this->setPalette(pal); | 76 | this->setPalette(pal); |
75 | 77 | ||
76 | setCaption( tr( "Bluetooth Manager" ) ); | 78 | setCaption( tr( "Bluetooth Manager" ) ); |
77 | 79 | ||
78 | readConfig(); | 80 | readConfig(); |
79 | initGui(); | 81 | initGui(); |
80 | 82 | ||
81 | 83 | ||
82 | //TESTING | 84 | //TESTING |
83 | 85 | ||
84 | ListView2->setRootIsDecorated(true); | 86 | ListView2->setRootIsDecorated(true); |
85 | 87 | ||
86 | QListViewItem *topLV = new QListViewItem( ListView2, "Harlekins Dongle" , "yes"); | 88 | QListViewItem *topLV = new QListViewItem( ListView2, "Harlekins Dongle" , "yes"); |
87 | topLV->setPixmap(0, offPix); | 89 | topLV->setPixmap( 0, offPix ); |
88 | (void) new QListViewItem( topLV, "on" ); | 90 | (void) new QListViewItem( topLV, "on" ); |
89 | (void) new QListViewItem( topLV, "off" ); | 91 | (void) new QListViewItem( topLV, "off" ); |
90 | 92 | ||
91 | QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" ); | 93 | QListViewItem *topLV2 = new QListViewItem( ListView2, "Siemens S45" , "no" ); |
92 | topLV2->setPixmap(0, onPix); | 94 | topLV2->setPixmap( 0, onPix ); |
93 | (void) new QListViewItem( topLV2, "on" ); | 95 | (void) new QListViewItem( topLV2, "on" ); |
94 | (void) new QListViewItem( topLV2, "off" ); | 96 | (void) new QListViewItem( topLV2, "off" ); |
95 | 97 | ||
96 | } | 98 | } |
97 | 99 | ||
98 | 100 | ||
99 | /** | 101 | /** |
100 | * Reads all options from the config file | 102 | * Reads all options from the config file |
101 | */ | 103 | */ |
102 | void BlueBase::readConfig() { | 104 | void BlueBase::readConfig() { |
103 | 105 | ||
104 | Config cfg("bluetoothmanager"); | 106 | Config cfg( "bluetoothmanager" ); |
105 | cfg.setGroup("bluezsettings"); | 107 | cfg.setGroup( "bluezsettings" ); |
106 | 108 | ||
107 | 109 | ||
108 | deviceName = cfg.readEntry("name", "No name"); // name the device should identify with | 110 | deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with |
109 | defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak | 111 | defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak |
110 | useEncryption = cfg.readNumEntry("useEncryption", 1); | 112 | useEncryption = cfg.readNumEntry( "useEncryption" , 1 ); |
111 | enableAuthentification = cfg.readNumEntry("enableAuthentification", 1); | 113 | enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 ); |
112 | enablePagescan = cfg.readNumEntry("enablePagescan",1); | 114 | enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 ); |
113 | enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1); | 115 | enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 ); |
114 | 116 | ||
115 | } | 117 | } |
116 | 118 | ||
117 | /** | 119 | /** |
118 | * Writes all options to the config file | 120 | * Writes all options to the config file |
119 | */ | 121 | */ |
120 | void BlueBase::writeConfig() { | 122 | void BlueBase::writeConfig() { |
121 | 123 | ||
122 | 124 | ||
123 | Config cfg("bluetoothmanager"); | 125 | Config cfg( "bluetoothmanager" ); |
124 | cfg.setGroup("bluezsettings"); | 126 | cfg.setGroup( "bluezsettings" ); |
125 | 127 | ||
126 | cfg.writeEntry("name", deviceName); | 128 | cfg.writeEntry( "name" , deviceName ); |
127 | cfg.writeEntryCrypt("passkey", defaultPasskey); | 129 | cfg.writeEntryCrypt( "passkey" , defaultPasskey ); |
128 | cfg.writeEntry("useEncryption", useEncryption); | 130 | cfg.writeEntry( "useEncryption" , useEncryption ); |
129 | cfg.writeEntry("enableAuthentification", enableAuthentification); | 131 | cfg.writeEntry( "enableAuthentification" , enableAuthentification ); |
130 | cfg.writeEntry("enablePagescan",enablePagescan); | 132 | cfg.writeEntry( "enablePagescan" , enablePagescan ); |
131 | cfg.writeEntry("enableInquiryscan", enableInquiryscan); | 133 | cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); |
132 | } | 134 | } |
133 | 135 | ||
134 | 136 | ||
135 | /* | 137 | /* |
136 | * Read the list of allready known devices | 138 | * Read the list of allready known devices |
137 | * | 139 | * |
138 | */ | 140 | */ |
139 | void BlueBase::readSavedDevices() { | 141 | void BlueBase::readSavedDevices() { |
140 | 142 | ||
141 | QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; | 143 | QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; |
142 | 144 | ||
143 | Config deviceList( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); | 145 | Config deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); |
144 | 146 | ||
145 | 147 | ||
146 | // RemoteDevice *currentDevice = RemoteDevice( , ); | 148 | // RemoteDevice *currentDevice = RemoteDevice( , ); |
147 | //loadedDevices->append( currentDevice ); | 149 | //loadedDevices->append( currentDevice ); |
148 | 150 | ||
149 | addSearchedDevices( *loadedDevices ); | 151 | addSearchedDevices( *loadedDevices ); |
150 | } | 152 | } |
151 | 153 | ||
152 | /* | 154 | /* |
153 | * Write the list of allready known devices | 155 | * Write the list of allready known devices |
154 | * | 156 | * |
155 | */ | 157 | */ |
156 | void BlueBase::writeSavedDevices() { | 158 | void BlueBase::writeSavedDevices() { |
157 | 159 | ||
158 | QListViewItemIterator it( ListView2 ); | 160 | QListViewItemIterator it( ListView2 ); |
159 | 161 | ||
160 | // one top conf file with all decices (by mac adress) | ||
161 | Config deviceList( QDir::homeDirPath() + "/Settings/bluetooth/devicelist.conf", Config::File ); | ||
162 | |||
163 | for ( ; it.current(); ++it ) { | 162 | for ( ; it.current(); ++it ) { |
164 | 163 | ||
165 | // MAC adress as group | ||
166 | deviceList.setGroup( it.current()->text(1) ); | ||
167 | deviceList.writeEntry("inList", 1); | ||
168 | |||
169 | // seperate config file for each device, to store more information in future. | 164 | // seperate config file for each device, to store more information in future. |
170 | 165 | ||
171 | Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (it.current()->text(1)) + ".conf", Config::File ); | 166 | Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (it.current()->text(3)) + ".conf", Config::File ); |
172 | conf.setGroup("Info"); | 167 | conf.setGroup( "Info" ); |
173 | conf.writeEntry("name", it.current()->text(0) ); | 168 | conf.writeEntry( "name", it.current()->text(0) ); |
174 | } | 169 | } |
175 | } | 170 | } |
176 | 171 | ||
177 | 172 | ||
178 | /** | 173 | /** |
179 | * Set up the gui | 174 | * Set up the gui |
180 | */ | 175 | */ |
181 | void BlueBase::initGui() { | 176 | void BlueBase::initGui() { |
182 | 177 | ||
183 | StatusLabel->setText(getStatus()); // maybe move it to getStatus() | 178 | StatusLabel->setText(getStatus()); // maybe move it to getStatus() |
184 | 179 | ||
185 | cryptCheckBox->setChecked(useEncryption); | 180 | cryptCheckBox->setChecked(useEncryption); |
186 | authCheckBox->setChecked(enableAuthentification); | 181 | authCheckBox->setChecked(enableAuthentification); |
187 | pagescanCheckBox->setChecked(enablePagescan); | 182 | pagescanCheckBox->setChecked(enablePagescan); |
188 | inquiryscanCheckBox->setChecked(enableInquiryscan); | 183 | inquiryscanCheckBox->setChecked(enableInquiryscan); |
189 | deviceNameLine->setText(deviceName); | 184 | deviceNameLine->setText(deviceName); |
190 | passkeyLine->setText(defaultPasskey); | 185 | passkeyLine->setText(defaultPasskey); |
191 | // set info tab | 186 | // set info tab |
192 | setInfo(); | 187 | setInfo(); |
193 | } | 188 | } |
194 | 189 | ||
195 | 190 | ||
196 | /** | 191 | /** |
197 | * Get the status informations and returns it | 192 | * Get the status informations and returns it |
198 | * @return QString the status informations gathered | 193 | * @return QString the status informations gathered |
199 | */ | 194 | */ |
200 | QString BlueBase::getStatus(){ | 195 | QString BlueBase::getStatus(){ |
201 | 196 | ||
202 | QString infoString = tr("<b>Device name : </b> Ipaq" ); | 197 | QString infoString = tr("<b>Device name : </b> Ipaq" ); |
203 | infoString += QString("<br><b>" + tr("MAC adress: ") +"</b> No idea"); | 198 | infoString += QString("<br><b>" + tr("MAC adress: ") +"</b> No idea"); |
204 | infoString += QString("<br><b>" + tr("Class") + "</b> PDA"); | 199 | infoString += QString("<br><b>" + tr("Class") + "</b> PDA"); |
205 | 200 | ||
206 | return (infoString); | 201 | return (infoString); |
207 | 202 | ||
208 | } | 203 | } |
209 | 204 | ||
210 | 205 | ||
211 | /** | 206 | /** |
212 | * Read the current values from the gui and invoke writeConfig() | 207 | * Read the current values from the gui and invoke writeConfig() |
213 | */ | 208 | */ |
214 | void BlueBase::applyConfigChanges() { | 209 | void BlueBase::applyConfigChanges() { |
215 | 210 | ||
216 | deviceName = deviceNameLine->text(); | 211 | deviceName = deviceNameLine->text(); |
217 | defaultPasskey = passkeyLine->text(); | 212 | defaultPasskey = passkeyLine->text(); |
218 | useEncryption = cryptCheckBox->isChecked(); | 213 | useEncryption = cryptCheckBox->isChecked(); |
219 | enableAuthentification = authCheckBox->isChecked(); | 214 | enableAuthentification = authCheckBox->isChecked(); |
220 | enablePagescan = pagescanCheckBox->isChecked(); | 215 | enablePagescan = pagescanCheckBox->isChecked(); |
221 | enableInquiryscan = inquiryscanCheckBox->isChecked(); | 216 | enableInquiryscan = inquiryscanCheckBox->isChecked(); |
222 | 217 | ||
223 | writeConfig(); | 218 | writeConfig(); |
224 | 219 | ||
225 | QMessageBox* box = new QMessageBox(this, "Test"); | 220 | QMessageBox* box = new QMessageBox( this, "Test" ); |
226 | box->setText(tr("Changes applied")); | 221 | box->setText( tr( "Changes applied" ) ); |
227 | box->show(); | 222 | box->show(); |
228 | 223 | ||
229 | // falls nötig hcid killhupen - die funktionalität adden | 224 | // falls nötig hcid killhupen - die funktionalität adden |
230 | } | 225 | } |
231 | 226 | ||
232 | 227 | ||
233 | /* | 228 | /* |
234 | * Add fresh found devices from scan dialog to the listing | 229 | * Add fresh found devices from scan dialog to the listing |
235 | * | 230 | * |
236 | */ | 231 | */ |
237 | void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { | 232 | void BlueBase::addSearchedDevices( QList<RemoteDevice> &newDevices ) { |
238 | 233 | ||
239 | QListViewItem * deviceItem; | 234 | QListViewItem * deviceItem; |
240 | 235 | ||
241 | QListIterator<RemoteDevice> it(newDevices); | 236 | QListIterator<RemoteDevice> it( newDevices ); |
242 | 237 | ||
243 | for( ; it.current(); ++it ) { | 238 | for( ; it.current() ; ++it ) { |
244 | 239 | ||
245 | 240 | ||
246 | RemoteDevice *dev = it.current(); | 241 | RemoteDevice *dev = it.current(); |
247 | deviceItem = new QListViewItem( ListView2, dev->name() ); | 242 | deviceItem = new QListViewItem( ListView2, dev->name() ); |
248 | 243 | ||
249 | if (deviceActive( dev ) ) { | 244 | if ( deviceActive( dev ) ) { |
250 | deviceItem->setPixmap(0, onPix); | 245 | deviceItem->setPixmap( 1 , onPix ); |
251 | } else { | 246 | } else { |
252 | deviceItem->setPixmap(0, offPix); | 247 | deviceItem->setPixmap( 1, offPix ); |
253 | } | 248 | } |
254 | 249 | ||
255 | deviceItem->setText(1, dev->mac() ); | 250 | deviceItem->setText( 3, dev->mac() ); |
256 | } | 251 | } |
257 | } | 252 | } |
258 | 253 | ||
259 | 254 | ||
260 | /* | 255 | /* |
261 | * Action that is toggled on entrys on click | 256 | * Action that is toggled on entrys on click |
262 | */ | 257 | */ |
263 | void BlueBase::startServiceActionClicked( QListViewItem * item ) { | 258 | void BlueBase::startServiceActionClicked( QListViewItem * item ) { |
264 | 259 | ||
265 | 260 | ||
266 | } | 261 | } |
267 | 262 | ||
268 | /* | 263 | /* |
269 | * Action that are toggled on hold (mostly QPopups i guess) | 264 | * Action that are toggled on hold (mostly QPopups i guess) |
270 | */ | 265 | */ |
271 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column) { | 266 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { |
272 | 267 | ||
273 | 268 | ||
274 | } | 269 | } |
275 | 270 | ||
276 | /* | 271 | /* |
277 | * Search and display avail. services for a device (on expand from device listing) | 272 | * Search and display avail. services for a device (on expand from device listing) |
278 | * | 273 | * |
279 | */ | 274 | */ |
280 | void BlueBase::addServicesToDevice( QListViewItem * item ) { | 275 | void BlueBase::addServicesToDevice( QListViewItem * item ) { |
276 | |||
281 | // row of mac adress | 277 | // row of mac adress |
282 | RemoteDevice *device = new RemoteDevice(item->text(1), item->text(0)); | 278 | RemoteDevice *device = new RemoteDevice(item->text(3), item->text(0)); |
283 | //dann nen manager und darauf dann searchServises, das liefert nen signal, das wieder connected | 279 | |
284 | // werden muss. | 280 | deviceList.insert( item->text(3) , item ); |
281 | |||
282 | // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back | ||
283 | localDevice->searchServices( *device ); | ||
285 | 284 | ||
286 | // delete | 285 | // delete |
287 | } | 286 | } |
288 | 287 | ||
288 | |||
289 | /** | ||
290 | * Overloaded. This one it the one that is connected to the foundServices signal | ||
291 | * @param device the mac address of the remote device | ||
292 | * @param servicesList the list with the service the device has. | ||
293 | */ | ||
294 | void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) { | ||
295 | |||
296 | qDebug("fill services list"); | ||
297 | |||
298 | |||
299 | QMap<QString,QListViewItem*>::Iterator it; | ||
300 | |||
301 | QListViewItem* deviceItem; | ||
302 | |||
303 | for( it = deviceList.begin(); it != deviceList.end(); ++it ) { | ||
304 | if (it.key() == device ) { | ||
305 | deviceItem = it.data(); | ||
306 | } | ||
307 | } | ||
308 | |||
309 | QValueList<OpieTooth::Services>::Iterator it2; | ||
310 | |||
311 | |||
312 | |||
313 | QListViewItem * serviceItem; | ||
314 | |||
315 | for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) { | ||
316 | it2.serviceName() | ||
317 | serviceItem = new QListViewItem( deviceItem , it2.serviceName() ); | ||
318 | } | ||
319 | |||
320 | } | ||
321 | |||
322 | |||
289 | /* | 323 | /* |
290 | * Find out if a device can currently be reached | 324 | * Find out if a device can currently be reached |
291 | */ | 325 | */ |
292 | bool BlueBase::deviceActive( RemoteDevice *device ) { | 326 | bool BlueBase::deviceActive( RemoteDevice *device ) { |
293 | |||
294 | return true; | 327 | return true; |
295 | } | 328 | } |
296 | 329 | ||
330 | |||
297 | /** | 331 | /** |
298 | * Open the "scan for devices" dialog | 332 | * Open the "scan for devices" dialog |
299 | */ | 333 | */ |
300 | void BlueBase::startScan() { | 334 | void BlueBase::startScan() { |
301 | 335 | ||
302 | ScanDialog *scan = new ScanDialog( this, "", true); | 336 | ScanDialog *scan = new ScanDialog( this, "", true); |
303 | QObject::connect( scan, SIGNAL( selectedDevices(QList<RemoteDevice>&) ), | 337 | QObject::connect( scan, SIGNAL( selectedDevices(QList<RemoteDevice>&) ), |
304 | this, SLOT( addSearchedDevices(QList<RemoteDevice>& ) )); | 338 | this, SLOT( addSearchedDevices(QList<RemoteDevice>& ) )); |
305 | 339 | ||
306 | scan->showMaximized(); | 340 | scan->showMaximized(); |
307 | } | 341 | } |
308 | 342 | ||
309 | 343 | ||
310 | void BlueBase::setInfo() { | 344 | void BlueBase::setInfo() { |
311 | StatusLabel->setText(getStatus()); | 345 | StatusLabel->setText( getStatus() ); |
312 | } | 346 | } |
313 | 347 | ||
314 | /** | 348 | /** |
315 | * Decontructor | 349 | * Decontructor |
316 | */ | 350 | */ |
317 | BlueBase::~BlueBase(){ | 351 | BlueBase::~BlueBase() { |
318 | writeSavedDevices(); | 352 | writeSavedDevices(); |
319 | } | 353 | } |
320 | 354 | ||
321 | } | 355 | } |
322 | 356 | ||
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 7b03f82..dcb7681 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -1,75 +1,80 @@ | |||
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 | #include <remotedevice.h> | 15 | #include <remotedevice.h> |
16 | #include <manager.h> | ||
15 | 17 | ||
16 | class QVBox; | 18 | class QVBox; |
17 | class QHBoxLayout; | 19 | class QHBoxLayout; |
18 | class QGridLayout; | 20 | class QGridLayout; |
19 | class QFrame; | 21 | class QFrame; |
20 | class QLabel; | 22 | class QLabel; |
21 | class QPushButton; | 23 | class QPushButton; |
22 | class QTabWidget; | 24 | class QTabWidget; |
23 | class QCheckBox; | 25 | class QCheckBox; |
24 | 26 | ||
25 | 27 | ||
26 | namespace OpieTooth { | 28 | namespace OpieTooth { |
27 | 29 | ||
28 | 30 | ||
29 | 31 | ||
30 | class BlueBase : public BluetoothBase { | 32 | class BlueBase : public BluetoothBase { |
31 | Q_OBJECT | 33 | Q_OBJECT |
32 | 34 | ||
33 | public: | 35 | public: |
34 | BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 36 | BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
35 | ~BlueBase(); | 37 | ~BlueBase(); |
36 | 38 | ||
37 | protected: | 39 | protected: |
38 | 40 | ||
39 | 41 | ||
40 | private slots: | 42 | private slots: |
41 | void startScan(); | 43 | void startScan(); |
42 | 44 | ||
43 | private: | 45 | private: |
44 | void readConfig(); | 46 | void readConfig(); |
45 | void writeConfig(); | 47 | void writeConfig(); |
46 | void readSavedDevices(); | 48 | void readSavedDevices(); |
47 | void writeSavedDevices(); | 49 | void writeSavedDevices(); |
48 | QString getStatus(); | 50 | QString getStatus(); |
49 | void initGui(); | 51 | void initGui(); |
50 | void setInfo(); | 52 | void setInfo(); |
53 | Manager *localDevice; | ||
54 | QMap<QString,QListViewItem*> deviceList; | ||
51 | 55 | ||
52 | bool deviceActive( RemoteDevice *device ); | 56 | bool deviceActive( RemoteDevice *device ); |
53 | 57 | ||
54 | QString deviceName; | 58 | QString deviceName; |
55 | QString defaultPasskey; | 59 | QString defaultPasskey; |
56 | int useEncryption; | 60 | int useEncryption; |
57 | int enableAuthentification; | 61 | int enableAuthentification; |
58 | int enablePagescan; | 62 | int enablePagescan; |
59 | int enableInquiryscan; | 63 | int enableInquiryscan; |
60 | 64 | ||
61 | QPixmap offPix; | 65 | QPixmap offPix; |
62 | QPixmap onPix; | 66 | QPixmap onPix; |
63 | 67 | ||
64 | private slots: | 68 | private slots: |
65 | void addSearchedDevices( QList<RemoteDevice> &newDevices ); | 69 | void addSearchedDevices( QList<RemoteDevice> &newDevices ); |
66 | void addServicesToDevice( QListViewItem * item ); | 70 | void addServicesToDevice( QListViewItem * item ); |
71 | void addServicesToDevice( const QString& device, Services::ValueList ); | ||
67 | void startServiceActionClicked( QListViewItem * item ); | 72 | void startServiceActionClicked( QListViewItem * item ); |
68 | void startServiceActionHold( QListViewItem * item, const QPoint & point, int column); | 73 | void startServiceActionHold( QListViewItem * item, const QPoint & point, int column); |
69 | void applyConfigChanges(); | 74 | void applyConfigChanges(); |
70 | 75 | ||
71 | }; | 76 | }; |
72 | 77 | ||
73 | } | 78 | } |
74 | 79 | ||
75 | #endif | 80 | #endif |