-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 54 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 3 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/manager.pro | 4 |
3 files changed, 52 insertions, 9 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index af65f14..b4b59c3 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -14,12 +14,13 @@ | |||
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 | #include "hciconfwrapper.h" | ||
20 | 21 | ||
21 | #include <qframe.h> | 22 | #include <qframe.h> |
22 | #include <qlabel.h> | 23 | #include <qlabel.h> |
23 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
24 | #include <qlayout.h> | 25 | #include <qlayout.h> |
25 | #include <qvariant.h> | 26 | #include <qvariant.h> |
@@ -27,13 +28,12 @@ | |||
27 | #include <qimage.h> | 28 | #include <qimage.h> |
28 | #include <qpixmap.h> | 29 | #include <qpixmap.h> |
29 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
30 | #include <qscrollview.h> | 31 | #include <qscrollview.h> |
31 | #include <qvbox.h> | 32 | #include <qvbox.h> |
32 | #include <qmessagebox.h> | 33 | #include <qmessagebox.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 | ||
@@ -55,14 +55,15 @@ namespace OpieTooth { | |||
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 | // hehe, cast right later | ||
61 | connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), | 62 | connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), |
62 | this, SLOT(startServiceActionHold( BTListItem *, const QPoint &, int) ) ); | 63 | this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); |
63 | connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), | 64 | connect( localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), |
64 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); | 65 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); |
65 | connect( localDevice, SIGNAL( available( const QString&, bool ) ), | 66 | connect( localDevice, SIGNAL( available( const QString&, bool ) ), |
66 | this, SLOT( deviceActive( const QString& , bool ) ) ); | 67 | this, SLOT( deviceActive( const QString& , bool ) ) ); |
67 | 68 | ||
68 | //Load all icons needed | 69 | //Load all icons needed |
@@ -87,12 +88,13 @@ namespace OpieTooth { | |||
87 | ListView2->setRootIsDecorated(true); | 88 | ListView2->setRootIsDecorated(true); |
88 | 89 | ||
89 | BTListItem *topLV2 = new BTListItem( ListView2, "Siemens S45", "", "device" ); | 90 | BTListItem *topLV2 = new BTListItem( ListView2, "Siemens S45", "", "device" ); |
90 | topLV2->setPixmap( 1, onPix ); | 91 | topLV2->setPixmap( 1, onPix ); |
91 | (void) new BTListItem( topLV2, "Serial" ,"", "service" ); | 92 | (void) new BTListItem( topLV2, "Serial" ,"", "service" ); |
92 | (void) new BTListItem( topLV2, "BlueNiC" , "", "service" ); | 93 | (void) new BTListItem( topLV2, "BlueNiC" , "", "service" ); |
94 | writeToHciConfig(); | ||
93 | } | 95 | } |
94 | 96 | ||
95 | 97 | ||
96 | /** | 98 | /** |
97 | * Reads all options from the config file | 99 | * Reads all options from the config file |
98 | */ | 100 | */ |
@@ -123,13 +125,51 @@ namespace OpieTooth { | |||
123 | cfg.writeEntry( "name" , deviceName ); | 125 | cfg.writeEntry( "name" , deviceName ); |
124 | cfg.writeEntryCrypt( "passkey" , defaultPasskey ); | 126 | cfg.writeEntryCrypt( "passkey" , defaultPasskey ); |
125 | cfg.writeEntry( "useEncryption" , useEncryption ); | 127 | cfg.writeEntry( "useEncryption" , useEncryption ); |
126 | cfg.writeEntry( "enableAuthentification" , enableAuthentification ); | 128 | cfg.writeEntry( "enableAuthentification" , enableAuthentification ); |
127 | cfg.writeEntry( "enablePagescan" , enablePagescan ); | 129 | cfg.writeEntry( "enablePagescan" , enablePagescan ); |
128 | cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); | 130 | cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); |
129 | } | 131 | |
132 | writeToHciConfig(); | ||
133 | } | ||
134 | |||
135 | void BlueBase::writeToHciConfig() { | ||
136 | |||
137 | HciConfWrapper *hciconf = new HciConfWrapper( "/tmp/hcid.conf" ); | ||
138 | hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); | ||
139 | |||
140 | |||
141 | // hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); | ||
142 | |||
143 | hciconf->setName( deviceName ); | ||
144 | |||
145 | if ( useEncryption == 1) { | ||
146 | hciconf->setEncrypt( true ); | ||
147 | } else { | ||
148 | hciconf->setEncrypt( false ); | ||
149 | } | ||
150 | |||
151 | |||
152 | if ( enableAuthentification == 1) { | ||
153 | hciconf->setAuth( true ); | ||
154 | } else { | ||
155 | hciconf->setAuth( false ); | ||
156 | } | ||
157 | |||
158 | if ( enablePagescan == 1) { | ||
159 | hciconf->setPscan( true ); | ||
160 | } else { | ||
161 | hciconf->setPscan( false ); | ||
162 | } | ||
163 | |||
164 | if ( enableInquiryscan == 1) { | ||
165 | hciconf->setIscan( true ); | ||
166 | } else { | ||
167 | hciconf->setIscan( false ); | ||
168 | } | ||
169 | } | ||
130 | 170 | ||
131 | 171 | ||
132 | /** | 172 | /** |
133 | * Read the list of allready known devices | 173 | * Read the list of allready known devices |
134 | * | 174 | * |
135 | */ | 175 | */ |
@@ -222,12 +262,13 @@ namespace OpieTooth { | |||
222 | enableAuthentification = authCheckBox->isChecked(); | 262 | enableAuthentification = authCheckBox->isChecked(); |
223 | enablePagescan = pagescanCheckBox->isChecked(); | 263 | enablePagescan = pagescanCheckBox->isChecked(); |
224 | enableInquiryscan = inquiryscanCheckBox->isChecked(); | 264 | enableInquiryscan = inquiryscanCheckBox->isChecked(); |
225 | 265 | ||
226 | writeConfig(); | 266 | writeConfig(); |
227 | 267 | ||
268 | |||
228 | QMessageBox* box = new QMessageBox( this, "Test" ); | 269 | QMessageBox* box = new QMessageBox( this, "Test" ); |
229 | box->setText( tr( "Changes applied" ) ); | 270 | box->setText( tr( "Changes applied" ) ); |
230 | box->show(); | 271 | box->show(); |
231 | // falls nötig hcid killhupen - die funktionalität adden | 272 | // falls nötig hcid killhupen - die funktionalität adden |
232 | } | 273 | } |
233 | 274 | ||
@@ -271,21 +312,22 @@ namespace OpieTooth { | |||
271 | 312 | ||
272 | } | 313 | } |
273 | 314 | ||
274 | /** | 315 | /** |
275 | * Action that are toggled on hold (mostly QPopups i guess) | 316 | * Action that are toggled on hold (mostly QPopups i guess) |
276 | */ | 317 | */ |
277 | void BlueBase::startServiceActionHold( BTListItem * item, const QPoint & point, int column ) { | 318 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int column ) { |
278 | 319 | ||
279 | QPopupMenu *menu = new QPopupMenu(); | 320 | QPopupMenu *menu = new QPopupMenu(); |
280 | 321 | ||
281 | int ret=0; | 322 | int ret=0; |
282 | 323 | ||
324 | |||
283 | //QSize s = menu->sizeHint ( ); | 325 | //QSize s = menu->sizeHint ( ); |
284 | 326 | ||
285 | if ( item->type() == "device") { | 327 | if ( ((BTListItem*)item)->type() == "device") { |
286 | 328 | ||
287 | QPopupMenu *groups = new QPopupMenu(); | 329 | QPopupMenu *groups = new QPopupMenu(); |
288 | 330 | ||
289 | menu->insertItem( tr("rescan sevices:"), 0); | 331 | menu->insertItem( tr("rescan sevices:"), 0); |
290 | menu->insertItem( tr("to group"), groups , 1); | 332 | menu->insertItem( tr("to group"), groups , 1); |
291 | menu->insertItem( tr("delete"), 2); | 333 | menu->insertItem( tr("delete"), 2); |
@@ -302,13 +344,13 @@ namespace OpieTooth { | |||
302 | // delete childs too | 344 | // delete childs too |
303 | delete item; | 345 | delete item; |
304 | break; | 346 | break; |
305 | } | 347 | } |
306 | delete groups; | 348 | delete groups; |
307 | 349 | ||
308 | } else if ( item->type() == "service") { | 350 | } else if ( ((BTListItem*)item)->type() == "service") { |
309 | menu->insertItem( tr("Test1:"), 0); | 351 | menu->insertItem( tr("Test1:"), 0); |
310 | menu->insertItem( tr("connect"), 1); | 352 | menu->insertItem( tr("connect"), 1); |
311 | menu->insertItem( tr("delete"), 2); | 353 | menu->insertItem( tr("delete"), 2); |
312 | 354 | ||
313 | ret = menu->exec( point , 0); | 355 | ret = menu->exec( point , 0); |
314 | 356 | ||
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 481f0c9..ef67aa2 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -42,12 +42,13 @@ namespace OpieTooth { | |||
42 | 42 | ||
43 | private: | 43 | private: |
44 | void readConfig(); | 44 | void readConfig(); |
45 | void writeConfig(); | 45 | void writeConfig(); |
46 | void readSavedDevices(); | 46 | void readSavedDevices(); |
47 | void writeSavedDevices(); | 47 | void writeSavedDevices(); |
48 | void writeToHciConfig(); | ||
48 | QString getStatus(); | 49 | QString getStatus(); |
49 | void initGui(); | 50 | void initGui(); |
50 | void setInfo(); | 51 | void setInfo(); |
51 | Manager *localDevice; | 52 | Manager *localDevice; |
52 | QMap<QString,BTListItem*> deviceList; | 53 | QMap<QString,BTListItem*> deviceList; |
53 | 54 | ||
@@ -66,13 +67,13 @@ namespace OpieTooth { | |||
66 | private slots: | 67 | private slots: |
67 | void addSearchedDevices( QList<RemoteDevice> &newDevices ); | 68 | void addSearchedDevices( QList<RemoteDevice> &newDevices ); |
68 | void addServicesToDevice( BTListItem *item ); | 69 | void addServicesToDevice( BTListItem *item ); |
69 | void addServicesToDevice( const QString& device, Services::ValueList ); | 70 | void addServicesToDevice( const QString& device, Services::ValueList ); |
70 | void addConnectedDevices(); | 71 | void addConnectedDevices(); |
71 | void startServiceActionClicked( QListViewItem *item ); | 72 | void startServiceActionClicked( QListViewItem *item ); |
72 | void startServiceActionHold( BTListItem *, const QPoint &, int ); | 73 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); |
73 | void deviceActive( const QString& mac, bool connected ); | 74 | void deviceActive( const QString& mac, bool connected ); |
74 | void applyConfigChanges(); | 75 | void applyConfigChanges(); |
75 | 76 | ||
76 | }; | 77 | }; |
77 | 78 | ||
78 | } | 79 | } |
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index 39ddcaf..4fcf010 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
3 | #CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | HEADERS = bluebase.h scandialog.h btlistitem.h | 4 | HEADERS = bluebase.h scandialog.h btlistitem.h hciconfwrapper.h |
5 | SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp | 5 | SOURCES = main.cpp bluebase.cpp scandialog.cpp btlistitem.cpp hciconfwrapper.cpp |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib | 7 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe -lopietooth -lopie | 9 | LIBS += -lqpe -lopietooth -lopie |
10 | INTERFACES = bluetoothbase.ui devicedialog.ui | 10 | INTERFACES = bluetoothbase.ui devicedialog.ui |
11 | DESTDIR = $(OPIEDIR)/bin | 11 | DESTDIR = $(OPIEDIR)/bin |