-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 8ddc161..c29eb1a 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -183,129 +183,129 @@ using namespace OpieTooth; | |||
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( const QValueList<RemoteDevice> &newDevices ) { | 247 | void BlueBase::addSearchedDevices( 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 | */ |
267 | void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { | 267 | void 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 | */ |
273 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { | 273 | void 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) { |
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 73fac97..97ce8c3 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -7,79 +7,79 @@ | |||
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 | ||
19 | class QVBox; | 19 | class QVBox; |
20 | class QHBoxLayout; | 20 | class QHBoxLayout; |
21 | class QGridLayout; | 21 | class QGridLayout; |
22 | class QFrame; | 22 | class QFrame; |
23 | class QLabel; | 23 | class QLabel; |
24 | class QPushButton; | 24 | class QPushButton; |
25 | class QTabWidget; | 25 | class QTabWidget; |
26 | class QCheckBox; | 26 | class QCheckBox; |
27 | 27 | ||
28 | 28 | ||
29 | namespace OpieTooth { | 29 | namespace 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( const QValueList<RemoteDevice> &newDevices ); | 71 | void addSearchedDevices( 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 |