18 files changed, 1108 insertions, 357 deletions
diff --git a/noncore/net/opietooth/blue-pin/blue-pin.pro b/noncore/net/opietooth/blue-pin/blue-pin.pro index 102a937..fbf9dbe 100644 --- a/noncore/net/opietooth/blue-pin/blue-pin.pro +++ b/noncore/net/opietooth/blue-pin/blue-pin.pro | |||
@@ -1,34 +1,30 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG = qt warn_on release quick-app |
2 | #CONFIG = qt warn_on debug | ||
3 | CONFIG = qt warn_on release | ||
4 | HEADERS = pindlg.h | 2 | HEADERS = pindlg.h |
5 | SOURCES = main.cc pindlg.cc | 3 | SOURCES = main.cc pindlg.cc |
6 | INCLUDEPATH += $(OPIEDIR)/include | 4 | INCLUDEPATH += $(OPIEDIR)/include |
7 | INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib | 5 | INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib |
8 | DEPENDPATH += $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe | 7 | LIBS += -lqpe |
10 | INTERFACES = pindlgbase.ui | 8 | INTERFACES = pindlgbase.ui |
11 | DESTDIR = $(OPIEDIR)/bin | 9 | TARGET = bluepin |
12 | TARGET = bluepin | ||
13 | 10 | ||
14 | TRANSLATIONS = ../../../../i18n/de/bluepin.ts \ | 11 | TRANSLATIONS = ../../../../i18n/de/bluepin.ts \ |
15 | ../../../../i18n/nl/bluepin.ts \ | 12 | ../../../../i18n/nl/bluepin.ts \ |
16 | ../../../../i18n/da/bluepin.ts \ | 13 | ../../../../i18n/da/bluepin.ts \ |
17 | ../../../../i18n/xx/bluepin.ts \ | 14 | ../../../../i18n/xx/bluepin.ts \ |
18 | ../../../../i18n/en/bluepin.ts \ | 15 | ../../../../i18n/en/bluepin.ts \ |
19 | ../../../../i18n/es/bluepin.ts \ | 16 | ../../../../i18n/es/bluepin.ts \ |
20 | ../../../../i18n/fr/bluepin.ts \ | 17 | ../../../../i18n/fr/bluepin.ts \ |
21 | ../../../../i18n/hu/bluepin.ts \ | 18 | ../../../../i18n/hu/bluepin.ts \ |
22 | ../../../../i18n/ja/bluepin.ts \ | 19 | ../../../../i18n/ja/bluepin.ts \ |
23 | ../../../../i18n/ko/bluepin.ts \ | 20 | ../../../../i18n/ko/bluepin.ts \ |
24 | ../../../../i18n/no/bluepin.ts \ | 21 | ../../../../i18n/no/bluepin.ts \ |
25 | ../../../../i18n/pl/bluepin.ts \ | 22 | ../../../../i18n/pl/bluepin.ts \ |
26 | ../../../../i18n/pt/bluepin.ts \ | 23 | ../../../../i18n/pt/bluepin.ts \ |
27 | ../../../../i18n/pt_BR/bluepin.ts \ | 24 | ../../../../i18n/pt_BR/bluepin.ts \ |
28 | ../../../../i18n/sl/bluepin.ts \ | 25 | ../../../../i18n/sl/bluepin.ts \ |
29 | ../../../../i18n/zh_CN/bluepin.ts \ | 26 | ../../../../i18n/zh_CN/bluepin.ts \ |
30 | ../../../../i18n/zh_TW/bluepin.ts | 27 | ../../../../i18n/zh_TW/bluepin.ts |
31 | 28 | ||
32 | 29 | ||
33 | |||
34 | include ( $(OPIEDIR)/include.pro ) | 30 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/opietooth/manager/.cvsignore b/noncore/net/opietooth/manager/.cvsignore index 3fb67fe..19c03a7 100644 --- a/noncore/net/opietooth/manager/.cvsignore +++ b/noncore/net/opietooth/manager/.cvsignore | |||
@@ -1,9 +1,13 @@ | |||
1 | Makefile | 1 | Makefile |
2 | Makefile.in | 2 | Makefile.in |
3 | bluetoothbase.cpp | 3 | bluetoothbase.cpp |
4 | bluetoothbase.h | 4 | bluetoothbase.h |
5 | devicedialog.cpp | 5 | devicedialog.cpp |
6 | devicedialog.h | 6 | devicedialog.h |
7 | moc_* | 7 | moc_* |
8 | scandialog.cpp | 8 | scandialog.cpp |
9 | scandialog.h | 9 | scandialog.h |
10 | rfcommassigndialogbase.cpp | ||
11 | rfcommassigndialogbase.h | ||
12 | rfcommdialogitembase.cpp | ||
13 | rfcommdialogitembase.h | ||
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 54808fa..2e68984 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -1,110 +1,113 @@ | |||
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 | #include "hciconfwrapper.h" | 20 | #include "hciconfwrapper.h" |
21 | #include "devicehandler.h" | 21 | #include "devicehandler.h" |
22 | #include "btconnectionitem.h" | 22 | #include "btconnectionitem.h" |
23 | #include "rfcommassigndialogimpl.h" | ||
23 | 24 | ||
24 | #include <remotedevice.h> | 25 | #include <remotedevice.h> |
25 | #include <services.h> | 26 | #include <services.h> |
26 | 27 | ||
27 | #include <stdlib.h> | 28 | #include <stdlib.h> |
28 | 29 | ||
29 | #include <qframe.h> | 30 | #include <qframe.h> |
30 | #include <qlabel.h> | 31 | #include <qlabel.h> |
31 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
32 | #include <qlayout.h> | 33 | #include <qlayout.h> |
33 | #include <qvariant.h> | 34 | #include <qvariant.h> |
34 | #include <qimage.h> | 35 | #include <qimage.h> |
35 | #include <qpixmap.h> | 36 | #include <qpixmap.h> |
36 | #include <qtabwidget.h> | 37 | #include <qtabwidget.h> |
37 | #include <qscrollview.h> | 38 | #include <qscrollview.h> |
38 | #include <qvbox.h> | 39 | #include <qvbox.h> |
39 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
40 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
41 | #include <qlineedit.h> | 42 | #include <qlineedit.h> |
42 | #include <qlistview.h> | 43 | #include <qlistview.h> |
43 | #include <qdir.h> | 44 | #include <qdir.h> |
44 | #include <qpopupmenu.h> | 45 | #include <qpopupmenu.h> |
45 | #include <qtimer.h> | 46 | #include <qtimer.h> |
46 | #include <qlist.h> | 47 | #include <qlist.h> |
47 | 48 | ||
48 | #include <qpe/qpeapplication.h> | 49 | #include <qpe/qpeapplication.h> |
49 | #include <qpe/resource.h> | 50 | #include <qpe/resource.h> |
50 | #include <qpe/config.h> | 51 | #include <qpe/config.h> |
51 | 52 | ||
52 | 53 | ||
53 | using namespace OpieTooth; | 54 | using namespace OpieTooth; |
54 | 55 | ||
55 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 56 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
56 | : BluetoothBase( parent, name, fl ) { | 57 | : BluetoothBase( parent, name, fl ) { |
57 | 58 | ||
58 | m_localDevice = new Manager( "hci0" ); | 59 | m_localDevice = new Manager( "hci0" ); |
59 | 60 | ||
60 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); | 61 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); |
61 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); | 62 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); |
62 | // not good since lib is async | 63 | |
64 | connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); | ||
65 | // not good since lib is async | ||
63 | // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), | 66 | // connect( ListView2, SIGNAL( expanded ( QListViewItem* ) ), |
64 | // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); | 67 | // this, SLOT( addServicesToDevice( QListViewItem * ) ) ); |
65 | connect( ListView2, SIGNAL( clicked( QListViewItem* )), | 68 | connect( ListView2, SIGNAL( clicked( QListViewItem* )), |
66 | this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); | 69 | this, SLOT( startServiceActionClicked( QListViewItem* ) ) ); |
67 | connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), | 70 | connect( ListView2, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int ) ), |
68 | this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); | 71 | this, SLOT(startServiceActionHold( QListViewItem *, const QPoint &, int) ) ); |
69 | connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), | 72 | connect( m_localDevice , SIGNAL( foundServices( const QString& , Services::ValueList ) ), |
70 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); | 73 | this, SLOT( addServicesToDevice( const QString& , Services::ValueList ) ) ); |
71 | connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), | 74 | connect( m_localDevice, SIGNAL( available( const QString&, bool ) ), |
72 | this, SLOT( deviceActive( const QString& , bool ) ) ); | 75 | this, SLOT( deviceActive( const QString& , bool ) ) ); |
73 | connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), | 76 | connect( m_localDevice, SIGNAL( connections( ConnectionState::ValueList ) ), |
74 | this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); | 77 | this, SLOT( addConnectedDevices( ConnectionState::ValueList ) ) ); |
75 | connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ), | 78 | connect( m_localDevice, SIGNAL( signalStrength( const QString&, const QString& ) ), |
76 | this, SLOT( addSignalStrength( const QString&, const QString& ) ) ); | 79 | this, SLOT( addSignalStrength( const QString&, const QString& ) ) ); |
77 | 80 | ||
78 | 81 | ||
79 | // let hold be rightButtonClicked() | 82 | // let hold be rightButtonClicked() |
80 | QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); | 83 | QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); |
81 | QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); | 84 | QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); |
82 | 85 | ||
83 | //Load all icons needed | 86 | //Load all icons needed |
84 | m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); | 87 | m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); |
85 | m_onPix = Resource::loadPixmap( "opietooth/connected" ); | 88 | m_onPix = Resource::loadPixmap( "opietooth/connected" ); |
86 | m_findPix = Resource::loadPixmap( "opietooth/find" ); | 89 | m_findPix = Resource::loadPixmap( "opietooth/find" ); |
87 | 90 | ||
88 | QPalette pal = this->palette(); | 91 | QPalette pal = this->palette(); |
89 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); | 92 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); |
90 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); | 93 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); |
91 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); | 94 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); |
92 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); | 95 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); |
93 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); | 96 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); |
94 | this->setPalette( pal ); | 97 | this->setPalette( pal ); |
95 | 98 | ||
96 | setCaption( tr( "Bluetooth Manager" ) ); | 99 | setCaption( tr( "Bluetooth Manager" ) ); |
97 | 100 | ||
98 | readConfig(); | 101 | readConfig(); |
99 | initGui(); | 102 | initGui(); |
100 | 103 | ||
101 | ListView2->setRootIsDecorated(true); | 104 | ListView2->setRootIsDecorated(true); |
102 | 105 | ||
103 | 106 | ||
104 | writeToHciConfig(); | 107 | writeToHciConfig(); |
105 | // search conncetions | 108 | // search conncetions |
106 | addConnectedDevices(); | 109 | addConnectedDevices(); |
107 | addSignalStrength(); | 110 | addSignalStrength(); |
108 | m_iconLoader = new BTIconLoader(); | 111 | m_iconLoader = new BTIconLoader(); |
109 | readSavedDevices(); | 112 | readSavedDevices(); |
110 | } | 113 | } |
@@ -177,119 +180,133 @@ void BlueBase::readSavedDevices() { | |||
177 | * Write the list of allready known devices | 180 | * Write the list of allready known devices |
178 | */ | 181 | */ |
179 | void BlueBase::writeSavedDevices() { | 182 | void BlueBase::writeSavedDevices() { |
180 | QListViewItemIterator it( ListView2 ); | 183 | QListViewItemIterator it( ListView2 ); |
181 | BTListItem* item; | 184 | BTListItem* item; |
182 | BTDeviceItem* device; | 185 | BTDeviceItem* device; |
183 | RemoteDevice::ValueList list; | 186 | RemoteDevice::ValueList list; |
184 | for ( ; it.current(); ++it ) { | 187 | for ( ; it.current(); ++it ) { |
185 | item = (BTListItem*)it.current(); | 188 | item = (BTListItem*)it.current(); |
186 | if(item->typeId() != BTListItem::Device ) | 189 | if(item->typeId() != BTListItem::Device ) |
187 | continue; | 190 | continue; |
188 | device = (BTDeviceItem*)item; | 191 | device = (BTDeviceItem*)item; |
189 | 192 | ||
190 | list.append( device->remoteDevice() ); | 193 | list.append( device->remoteDevice() ); |
191 | } | 194 | } |
192 | /* | 195 | /* |
193 | * if not empty save the List through DeviceHandler | 196 | * if not empty save the List through DeviceHandler |
194 | */ | 197 | */ |
195 | if ( list.isEmpty() ) | 198 | if ( list.isEmpty() ) |
196 | return; | 199 | return; |
197 | DeviceHandler handler; | 200 | DeviceHandler handler; |
198 | handler.save( list ); | 201 | handler.save( list ); |
199 | } | 202 | } |
200 | 203 | ||
201 | 204 | ||
202 | /** | 205 | /** |
203 | * Set up the gui | 206 | * Set up the gui |
204 | */ | 207 | */ |
205 | void BlueBase::initGui() { | 208 | void BlueBase::initGui() { |
206 | StatusLabel->setText( status() ); // maybe move it to getStatus() | 209 | StatusLabel->setText( status() ); // maybe move it to getStatus() |
207 | cryptCheckBox->setChecked( m_useEncryption ); | 210 | cryptCheckBox->setChecked( m_useEncryption ); |
208 | authCheckBox->setChecked( m_enableAuthentification ); | 211 | authCheckBox->setChecked( m_enableAuthentification ); |
209 | pagescanCheckBox->setChecked( m_enablePagescan ); | 212 | pagescanCheckBox->setChecked( m_enablePagescan ); |
210 | inquiryscanCheckBox->setChecked( m_enableInquiryscan ); | 213 | inquiryscanCheckBox->setChecked( m_enableInquiryscan ); |
211 | deviceNameLine->setText( m_deviceName ); | 214 | deviceNameLine->setText( m_deviceName ); |
212 | passkeyLine->setText( m_defaultPasskey ); | 215 | passkeyLine->setText( m_defaultPasskey ); |
213 | // set info tab | 216 | // set info tab |
214 | setInfo(); | 217 | setInfo(); |
215 | } | 218 | } |
216 | 219 | ||
217 | 220 | ||
218 | /** | 221 | /** |
219 | * Get the status informations and returns it | 222 | * Get the status informations and returns it |
220 | * @return QString the status informations gathered | 223 | * @return QString the status informations gathered |
221 | */ | 224 | */ |
222 | QString BlueBase::status()const{ | 225 | QString BlueBase::status()const{ |
223 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); | 226 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); |
224 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); | 227 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); |
225 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); | 228 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); |
226 | 229 | ||
227 | return (infoString); | 230 | return (infoString); |
228 | } | 231 | } |
229 | 232 | ||
230 | 233 | ||
231 | /** | 234 | /** |
232 | * Read the current values from the gui and invoke writeConfig() | 235 | * Read the current values from the gui and invoke writeConfig() |
233 | */ | 236 | */ |
234 | void BlueBase::applyConfigChanges() { | 237 | void BlueBase::applyConfigChanges() { |
235 | m_deviceName = deviceNameLine->text(); | 238 | m_deviceName = deviceNameLine->text(); |
236 | m_defaultPasskey = passkeyLine->text(); | 239 | m_defaultPasskey = passkeyLine->text(); |
237 | m_useEncryption = cryptCheckBox->isChecked(); | 240 | m_useEncryption = cryptCheckBox->isChecked(); |
238 | m_enableAuthentification = authCheckBox->isChecked(); | 241 | m_enableAuthentification = authCheckBox->isChecked(); |
239 | m_enablePagescan = pagescanCheckBox->isChecked(); | 242 | m_enablePagescan = pagescanCheckBox->isChecked(); |
240 | m_enableInquiryscan = inquiryscanCheckBox->isChecked(); | 243 | m_enableInquiryscan = inquiryscanCheckBox->isChecked(); |
241 | 244 | ||
242 | writeConfig(); | 245 | writeConfig(); |
243 | 246 | ||
244 | QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); | 247 | QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); |
245 | } | 248 | } |
246 | 249 | ||
247 | /** | 250 | /** |
251 | * Launch Rfcomm Bind dialog | ||
252 | * | ||
253 | */ | ||
254 | void BlueBase::rfcommDialog() { | ||
255 | RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); | ||
256 | |||
257 | rfcommAssign.showMaximized(); | ||
258 | |||
259 | if ( rfcommAssign.exec() == QDialog::Accepted ) { | ||
260 | rfcommAssign.saveConfig(); | ||
261 | } | ||
262 | } | ||
263 | |||
264 | /** | ||
248 | * Add fresh found devices from scan dialog to the listing | 265 | * Add fresh found devices from scan dialog to the listing |
249 | * | 266 | * |
250 | */ | 267 | */ |
251 | void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { | 268 | void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { |
252 | BTDeviceItem * deviceItem; | 269 | BTDeviceItem * deviceItem; |
253 | QValueList<RemoteDevice>::ConstIterator it; | 270 | QValueList<RemoteDevice>::ConstIterator it; |
254 | 271 | ||
255 | for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { | 272 | for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { |
256 | 273 | ||
257 | if (find( (*it) )) // is already inserted | 274 | if (find( (*it) )) // is already inserted |
258 | continue; | 275 | continue; |
259 | 276 | ||
260 | deviceItem = new BTDeviceItem( ListView2 , (*it) ); | 277 | deviceItem = new BTDeviceItem( ListView2 , (*it) ); |
261 | deviceItem->setPixmap( 1, m_findPix ); | 278 | deviceItem->setPixmap( 1, m_findPix ); |
262 | deviceItem->setExpandable ( true ); | 279 | deviceItem->setExpandable ( true ); |
263 | 280 | ||
264 | // look if device is avail. atm, async | 281 | // look if device is avail. atm, async |
265 | deviceActive( (*it) ); | 282 | deviceActive( (*it) ); |
266 | 283 | ||
267 | // ggf auch hier? | 284 | // ggf auch hier? |
268 | addServicesToDevice( deviceItem ); | 285 | addServicesToDevice( deviceItem ); |
269 | } | 286 | } |
270 | } | 287 | } |
271 | 288 | ||
272 | 289 | ||
273 | /** | 290 | /** |
274 | * Action that is toggled on entrys on click | 291 | * Action that is toggled on entrys on click |
275 | */ | 292 | */ |
276 | void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { | 293 | void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) { |
277 | } | 294 | } |
278 | 295 | ||
279 | 296 | ||
280 | /** | 297 | /** |
281 | * Action that are toggled on hold (mostly QPopups i guess) | 298 | * Action that are toggled on hold (mostly QPopups i guess) |
282 | */ | 299 | */ |
283 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { | 300 | void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { |
284 | if (!item ) | 301 | if (!item ) |
285 | return; | 302 | return; |
286 | 303 | ||
287 | QPopupMenu *menu = new QPopupMenu(); | 304 | QPopupMenu *menu = new QPopupMenu(); |
288 | int ret=0; | 305 | int ret=0; |
289 | 306 | ||
290 | if ( ((BTListItem*)item)->type() == "device") { | 307 | if ( ((BTListItem*)item)->type() == "device") { |
291 | 308 | ||
292 | QPopupMenu *groups = new QPopupMenu(); | 309 | QPopupMenu *groups = new QPopupMenu(); |
293 | 310 | ||
294 | menu->insertItem( ((BTDeviceItem*)item)->name(),0 ); | 311 | menu->insertItem( ((BTDeviceItem*)item)->name(),0 ); |
295 | menu->insertSeparator(1); | 312 | menu->insertSeparator(1); |
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 743062c..a8ab3db 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h | |||
@@ -1,97 +1,101 @@ | |||
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 | #include "btserviceitem.h" | 14 | #include "btserviceitem.h" |
15 | #include "btdeviceitem.h" | 15 | #include "btdeviceitem.h" |
16 | 16 | ||
17 | #include "popuphelper.h" | 17 | #include "popuphelper.h" |
18 | 18 | ||
19 | #include "bticonloader.h" | 19 | #include "bticonloader.h" |
20 | 20 | ||
21 | #include <remotedevice.h> | 21 | #include <remotedevice.h> |
22 | #include <manager.h> | 22 | #include <manager.h> |
23 | 23 | ||
24 | class QVBox; | 24 | class QVBox; |
25 | class QHBoxLayout; | 25 | class QHBoxLayout; |
26 | class QGridLayout; | 26 | class QGridLayout; |
27 | class QFrame; | 27 | class QFrame; |
28 | class QLabel; | 28 | class QLabel; |
29 | class QPushButton; | 29 | class QPushButton; |
30 | class QTabWidget; | 30 | class QTabWidget; |
31 | class QCheckBox; | 31 | class QCheckBox; |
32 | class BTConnectionItem; | 32 | class BTConnectionItem; |
33 | 33 | ||
34 | 34 | ||
35 | namespace OpieTooth { | 35 | namespace OpieTooth { |
36 | 36 | ||
37 | class BlueBase : public BluetoothBase { | 37 | class BlueBase : public BluetoothBase { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | 39 | ||
40 | public: | 40 | public: |
41 | BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 41 | BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
42 | ~BlueBase(); | 42 | ~BlueBase(); |
43 | |||
44 | static QString appName() { return QString::fromLatin1("bluetooth-manager"); } | ||
43 | 45 | ||
44 | protected: | 46 | protected: |
45 | 47 | ||
46 | 48 | ||
47 | private slots: | 49 | private slots: |
48 | void startScan(); | 50 | void startScan(); |
49 | 51 | ||
52 | |||
50 | private: | 53 | private: |
51 | bool find( const RemoteDevice& device ); | 54 | bool find( const RemoteDevice& device ); |
52 | void readConfig(); | 55 | void readConfig(); |
53 | void writeConfig(); | 56 | void writeConfig(); |
54 | void readSavedDevices(); | 57 | void readSavedDevices(); |
55 | void writeSavedDevices(); | 58 | void writeSavedDevices(); |
56 | void writeToHciConfig(); | 59 | void writeToHciConfig(); |
57 | QString status()const; | 60 | QString status()const; |
58 | void initGui(); | 61 | void initGui(); |
59 | void setInfo(); | 62 | void setInfo(); |
60 | 63 | ||
61 | PopupHelper m_popHelper; | 64 | PopupHelper m_popHelper; |
62 | Manager *m_localDevice; | 65 | Manager *m_localDevice; |
63 | QMap<QString,BTDeviceItem*> m_deviceList; | 66 | QMap<QString,BTDeviceItem*> m_deviceList; |
64 | 67 | ||
65 | void deviceActive( const RemoteDevice &device ); | 68 | void deviceActive( const RemoteDevice &device ); |
66 | 69 | ||
67 | QString m_deviceName; | 70 | QString m_deviceName; |
68 | QString m_defaultPasskey; | 71 | QString m_defaultPasskey; |
69 | bool m_useEncryption; | 72 | bool m_useEncryption; |
70 | bool m_enableAuthentification; | 73 | bool m_enableAuthentification; |
71 | bool m_enablePagescan; | 74 | bool m_enablePagescan; |
72 | bool m_enableInquiryscan; | 75 | bool m_enableInquiryscan; |
73 | 76 | ||
74 | QPixmap m_offPix; | 77 | QPixmap m_offPix; |
75 | QPixmap m_onPix; | 78 | QPixmap m_onPix; |
76 | QPixmap m_findPix; | 79 | QPixmap m_findPix; |
77 | 80 | ||
78 | BTIconLoader *m_iconLoader; | 81 | BTIconLoader *m_iconLoader; |
79 | 82 | ||
80 | private slots: | 83 | private slots: |
81 | void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); | 84 | void addSearchedDevices( const QValueList<RemoteDevice> &newDevices ); |
82 | void addServicesToDevice( BTDeviceItem *item ); | 85 | void addServicesToDevice( BTDeviceItem *item ); |
83 | void addServicesToDevice( const QString& device, Services::ValueList ); | 86 | void addServicesToDevice( const QString& device, Services::ValueList ); |
84 | void addConnectedDevices(); | 87 | void addConnectedDevices(); |
85 | void addConnectedDevices( ConnectionState::ValueList ); | 88 | void addConnectedDevices( ConnectionState::ValueList ); |
86 | void startServiceActionClicked( QListViewItem *item ); | 89 | void startServiceActionClicked( QListViewItem *item ); |
87 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); | 90 | void startServiceActionHold( QListViewItem *, const QPoint &, int ); |
88 | void deviceActive( const QString& mac, bool connected ); | 91 | void deviceActive( const QString& mac, bool connected ); |
89 | void applyConfigChanges(); | 92 | void applyConfigChanges(); |
90 | void addSignalStrength(); | 93 | void addSignalStrength(); |
91 | void addSignalStrength( const QString& mac, const QString& strengh ); | 94 | void addSignalStrength( const QString& mac, const QString& strengh ); |
95 | void rfcommDialog(); | ||
92 | 96 | ||
93 | }; | 97 | }; |
94 | 98 | ||
95 | } | 99 | } |
96 | 100 | ||
97 | #endif | 101 | #endif |
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index 9ff970f..bb906a1 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui | |||
@@ -1,395 +1,443 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>BluetoothBase</class> | 2 | <class>BluetoothBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>BluetoothBase</cstring> | 7 | <cstring>BluetoothBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>224</width> | 14 | <width>258</width> |
15 | <height>320</height> | 15 | <height>407</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Form1</string> | 20 | <string>Form1</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <widget> |
29 | <class>QTabWidget</class> | ||
29 | <property stdset="1"> | 30 | <property stdset="1"> |
30 | <name>margin</name> | 31 | <name>name</name> |
31 | <number>0</number> | 32 | <cstring>Status</cstring> |
32 | </property> | 33 | </property> |
33 | <property stdset="1"> | 34 | <property stdset="1"> |
34 | <name>spacing</name> | 35 | <name>geometry</name> |
35 | <number>0</number> | 36 | <rect> |
37 | <x>1</x> | ||
38 | <y>1</y> | ||
39 | <width>245</width> | ||
40 | <height>289</height> | ||
41 | </rect> | ||
42 | </property> | ||
43 | <property> | ||
44 | <name>layoutMargin</name> | ||
45 | </property> | ||
46 | <property> | ||
47 | <name>layoutSpacing</name> | ||
36 | </property> | 48 | </property> |
37 | <widget> | 49 | <widget> |
38 | <class>QTabWidget</class> | 50 | <class>QWidget</class> |
39 | <property stdset="1"> | 51 | <property stdset="1"> |
40 | <name>name</name> | 52 | <name>name</name> |
41 | <cstring>Status</cstring> | 53 | <cstring>tab</cstring> |
42 | </property> | ||
43 | <property> | ||
44 | <name>layoutMargin</name> | ||
45 | </property> | ||
46 | <property> | ||
47 | <name>layoutSpacing</name> | ||
48 | </property> | 54 | </property> |
49 | <widget> | 55 | <attribute> |
50 | <class>QWidget</class> | 56 | <name>title</name> |
57 | <string>Devices</string> | ||
58 | </attribute> | ||
59 | <vbox> | ||
51 | <property stdset="1"> | 60 | <property stdset="1"> |
52 | <name>name</name> | 61 | <name>margin</name> |
53 | <cstring>tab</cstring> | 62 | <number>2</number> |
54 | </property> | 63 | </property> |
55 | <attribute> | 64 | <property stdset="1"> |
56 | <name>title</name> | 65 | <name>spacing</name> |
57 | <string>Devices</string> | 66 | <number>2</number> |
58 | </attribute> | 67 | </property> |
59 | <vbox> | 68 | <widget> |
69 | <class>QListView</class> | ||
70 | <column> | ||
71 | <property> | ||
72 | <name>text</name> | ||
73 | <string>Device Name</string> | ||
74 | </property> | ||
75 | <property> | ||
76 | <name>clickable</name> | ||
77 | <bool>true</bool> | ||
78 | </property> | ||
79 | <property> | ||
80 | <name>resizeable</name> | ||
81 | <bool>true</bool> | ||
82 | </property> | ||
83 | </column> | ||
84 | <column> | ||
85 | <property> | ||
86 | <name>text</name> | ||
87 | <string>Online</string> | ||
88 | </property> | ||
89 | <property> | ||
90 | <name>clickable</name> | ||
91 | <bool>true</bool> | ||
92 | </property> | ||
93 | <property> | ||
94 | <name>resizeable</name> | ||
95 | <bool>true</bool> | ||
96 | </property> | ||
97 | </column> | ||
60 | <property stdset="1"> | 98 | <property stdset="1"> |
61 | <name>margin</name> | 99 | <name>name</name> |
62 | <number>2</number> | 100 | <cstring>ListView2</cstring> |
63 | </property> | 101 | </property> |
102 | </widget> | ||
103 | <widget> | ||
104 | <class>QPushButton</class> | ||
64 | <property stdset="1"> | 105 | <property stdset="1"> |
65 | <name>spacing</name> | 106 | <name>name</name> |
66 | <number>2</number> | 107 | <cstring>PushButton2</cstring> |
67 | </property> | 108 | </property> |
68 | <widget> | 109 | <property stdset="1"> |
69 | <class>QListView</class> | 110 | <name>sizePolicy</name> |
70 | <column> | 111 | <sizepolicy> |
71 | <property> | 112 | <hsizetype>0</hsizetype> |
72 | <name>text</name> | 113 | <vsizetype>0</vsizetype> |
73 | <string>Device Name</string> | 114 | </sizepolicy> |
74 | </property> | 115 | </property> |
75 | <property> | 116 | <property stdset="1"> |
76 | <name>clickable</name> | 117 | <name>text</name> |
77 | <bool>true</bool> | 118 | <string>Scan for Devices</string> |
78 | </property> | 119 | </property> |
79 | <property> | 120 | </widget> |
80 | <name>resizeable</name> | 121 | </vbox> |
81 | <bool>true</bool> | 122 | </widget> |
82 | </property> | 123 | <widget> |
83 | </column> | 124 | <class>QWidget</class> |
84 | <column> | 125 | <property stdset="1"> |
85 | <property> | 126 | <name>name</name> |
86 | <name>text</name> | 127 | <cstring>tab</cstring> |
87 | <string>Online</string> | 128 | </property> |
88 | </property> | 129 | <attribute> |
89 | <property> | 130 | <name>title</name> |
90 | <name>clickable</name> | 131 | <string>Connections</string> |
91 | <bool>true</bool> | 132 | </attribute> |
92 | </property> | 133 | <vbox> |
93 | <property> | 134 | <property stdset="1"> |
94 | <name>resizeable</name> | 135 | <name>margin</name> |
95 | <bool>true</bool> | 136 | <number>2</number> |
96 | </property> | 137 | </property> |
97 | </column> | 138 | <property stdset="1"> |
98 | <property stdset="1"> | 139 | <name>spacing</name> |
99 | <name>name</name> | 140 | <number>2</number> |
100 | <cstring>ListView2</cstring> | 141 | </property> |
142 | <widget> | ||
143 | <class>QListView</class> | ||
144 | <column> | ||
145 | <property> | ||
146 | <name>text</name> | ||
147 | <string>Device Name</string> | ||
101 | </property> | 148 | </property> |
102 | </widget> | 149 | <property> |
103 | <widget> | 150 | <name>clickable</name> |
104 | <class>QPushButton</class> | 151 | <bool>true</bool> |
105 | <property stdset="1"> | ||
106 | <name>name</name> | ||
107 | <cstring>PushButton2</cstring> | ||
108 | </property> | 152 | </property> |
109 | <property stdset="1"> | 153 | <property> |
110 | <name>sizePolicy</name> | 154 | <name>resizeable</name> |
111 | <sizepolicy> | 155 | <bool>true</bool> |
112 | <hsizetype>0</hsizetype> | ||
113 | <vsizetype>0</vsizetype> | ||
114 | </sizepolicy> | ||
115 | </property> | 156 | </property> |
116 | <property stdset="1"> | 157 | </column> |
158 | <column> | ||
159 | <property> | ||
117 | <name>text</name> | 160 | <name>text</name> |
118 | <string>Scan for Devices</string> | 161 | <string>Connection type</string> |
119 | </property> | 162 | </property> |
120 | </widget> | 163 | <property> |
121 | </vbox> | 164 | <name>clickable</name> |
122 | </widget> | 165 | <bool>true</bool> |
123 | <widget> | 166 | </property> |
124 | <class>QWidget</class> | 167 | <property> |
125 | <property stdset="1"> | 168 | <name>resizeable</name> |
126 | <name>name</name> | 169 | <bool>true</bool> |
127 | <cstring>tab</cstring> | 170 | </property> |
128 | </property> | 171 | </column> |
129 | <attribute> | 172 | <column> |
130 | <name>title</name> | 173 | <property> |
131 | <string>Connections</string> | 174 | <name>text</name> |
132 | </attribute> | 175 | <string>Signal</string> |
133 | <vbox> | 176 | </property> |
134 | <property stdset="1"> | 177 | <property> |
135 | <name>margin</name> | 178 | <name>clickable</name> |
136 | <number>2</number> | 179 | <bool>true</bool> |
137 | </property> | 180 | </property> |
181 | <property> | ||
182 | <name>resizeable</name> | ||
183 | <bool>true</bool> | ||
184 | </property> | ||
185 | </column> | ||
138 | <property stdset="1"> | 186 | <property stdset="1"> |
139 | <name>spacing</name> | 187 | <name>name</name> |
140 | <number>2</number> | 188 | <cstring>ListView4</cstring> |
141 | </property> | 189 | </property> |
142 | <widget> | 190 | </widget> |
143 | <class>QListView</class> | 191 | </vbox> |
144 | <column> | 192 | </widget> |
145 | <property> | 193 | <widget> |
146 | <name>text</name> | 194 | <class>QWidget</class> |
147 | <string>Device Name</string> | 195 | <property stdset="1"> |
148 | </property> | 196 | <name>name</name> |
149 | <property> | 197 | <cstring>tab</cstring> |
150 | <name>clickable</name> | 198 | </property> |
151 | <bool>true</bool> | 199 | <attribute> |
152 | </property> | 200 | <name>title</name> |
153 | <property> | 201 | <string>Config</string> |
154 | <name>resizeable</name> | 202 | </attribute> |
155 | <bool>true</bool> | 203 | <vbox> |
156 | </property> | 204 | <property stdset="1"> |
157 | </column> | 205 | <name>margin</name> |
158 | <column> | 206 | <number>11</number> |
159 | <property> | 207 | </property> |
160 | <name>text</name> | ||
161 | <string>Connection type</string> | ||
162 | </property> | ||
163 | <property> | ||
164 | <name>clickable</name> | ||
165 | <bool>true</bool> | ||
166 | </property> | ||
167 | <property> | ||
168 | <name>resizeable</name> | ||
169 | <bool>true</bool> | ||
170 | </property> | ||
171 | </column> | ||
172 | <column> | ||
173 | <property> | ||
174 | <name>text</name> | ||
175 | <string>Signal</string> | ||
176 | </property> | ||
177 | <property> | ||
178 | <name>clickable</name> | ||
179 | <bool>true</bool> | ||
180 | </property> | ||
181 | <property> | ||
182 | <name>resizeable</name> | ||
183 | <bool>true</bool> | ||
184 | </property> | ||
185 | </column> | ||
186 | <property stdset="1"> | ||
187 | <name>name</name> | ||
188 | <cstring>ListView4</cstring> | ||
189 | </property> | ||
190 | </widget> | ||
191 | </vbox> | ||
192 | </widget> | ||
193 | <widget> | ||
194 | <class>QWidget</class> | ||
195 | <property stdset="1"> | 208 | <property stdset="1"> |
196 | <name>name</name> | 209 | <name>spacing</name> |
197 | <cstring>tab</cstring> | 210 | <number>6</number> |
198 | </property> | 211 | </property> |
199 | <attribute> | 212 | <widget> |
200 | <name>title</name> | 213 | <class>QGroupBox</class> |
201 | <string>Config</string> | ||
202 | </attribute> | ||
203 | <vbox> | ||
204 | <property stdset="1"> | 214 | <property stdset="1"> |
205 | <name>margin</name> | 215 | <name>name</name> |
206 | <number>2</number> | 216 | <cstring>GroupBox1</cstring> |
207 | </property> | 217 | </property> |
208 | <property stdset="1"> | 218 | <property stdset="1"> |
209 | <name>spacing</name> | 219 | <name>title</name> |
210 | <number>2</number> | 220 | <string>Bluetooh Basic Config</string> |
211 | </property> | 221 | </property> |
212 | <widget> | 222 | <vbox> |
213 | <class>QLayoutWidget</class> | ||
214 | <property stdset="1"> | 223 | <property stdset="1"> |
215 | <name>name</name> | 224 | <name>margin</name> |
216 | <cstring>Layout2</cstring> | 225 | <number>11</number> |
217 | </property> | 226 | </property> |
218 | <hbox> | ||
219 | <property stdset="1"> | ||
220 | <name>margin</name> | ||
221 | <number>0</number> | ||
222 | </property> | ||
223 | <property stdset="1"> | ||
224 | <name>spacing</name> | ||
225 | <number>6</number> | ||
226 | </property> | ||
227 | <widget> | ||
228 | <class>QLabel</class> | ||
229 | <property stdset="1"> | ||
230 | <name>name</name> | ||
231 | <cstring>deviceNameLabel</cstring> | ||
232 | </property> | ||
233 | <property stdset="1"> | ||
234 | <name>text</name> | ||
235 | <string>Device Name</string> | ||
236 | </property> | ||
237 | </widget> | ||
238 | <widget> | ||
239 | <class>QLineEdit</class> | ||
240 | <property stdset="1"> | ||
241 | <name>name</name> | ||
242 | <cstring>deviceNameLine</cstring> | ||
243 | </property> | ||
244 | </widget> | ||
245 | </hbox> | ||
246 | </widget> | ||
247 | <widget> | ||
248 | <class>QLayoutWidget</class> | ||
249 | <property stdset="1"> | 227 | <property stdset="1"> |
250 | <name>name</name> | 228 | <name>spacing</name> |
251 | <cstring>Layout3</cstring> | 229 | <number>6</number> |
252 | </property> | 230 | </property> |
253 | <hbox> | 231 | <widget> |
254 | <property stdset="1"> | 232 | <class>QLayoutWidget</class> |
255 | <name>margin</name> | ||
256 | <number>0</number> | ||
257 | </property> | ||
258 | <property stdset="1"> | 233 | <property stdset="1"> |
259 | <name>spacing</name> | 234 | <name>name</name> |
260 | <number>6</number> | 235 | <cstring>Layout7</cstring> |
261 | </property> | 236 | </property> |
262 | <widget> | 237 | <hbox> |
263 | <class>QLabel</class> | ||
264 | <property stdset="1"> | 238 | <property stdset="1"> |
265 | <name>name</name> | 239 | <name>margin</name> |
266 | <cstring>passkeyLabel</cstring> | 240 | <number>0</number> |
267 | </property> | 241 | </property> |
268 | <property stdset="1"> | 242 | <property stdset="1"> |
269 | <name>text</name> | 243 | <name>spacing</name> |
270 | <string>Default Passkey</string> | 244 | <number>6</number> |
271 | </property> | 245 | </property> |
272 | </widget> | 246 | <widget> |
273 | <widget> | 247 | <class>QLayoutWidget</class> |
274 | <class>QLineEdit</class> | 248 | <property stdset="1"> |
249 | <name>name</name> | ||
250 | <cstring>Layout6</cstring> | ||
251 | </property> | ||
252 | <vbox> | ||
253 | <property stdset="1"> | ||
254 | <name>margin</name> | ||
255 | <number>0</number> | ||
256 | </property> | ||
257 | <property stdset="1"> | ||
258 | <name>spacing</name> | ||
259 | <number>6</number> | ||
260 | </property> | ||
261 | <widget> | ||
262 | <class>QLabel</class> | ||
263 | <property stdset="1"> | ||
264 | <name>name</name> | ||
265 | <cstring>deviceNameLabel</cstring> | ||
266 | </property> | ||
267 | <property stdset="1"> | ||
268 | <name>text</name> | ||
269 | <string>Device Name</string> | ||
270 | </property> | ||
271 | </widget> | ||
272 | <widget> | ||
273 | <class>QLabel</class> | ||
274 | <property stdset="1"> | ||
275 | <name>name</name> | ||
276 | <cstring>passkeyLabel</cstring> | ||
277 | </property> | ||
278 | <property stdset="1"> | ||
279 | <name>text</name> | ||
280 | <string>Default Passkey</string> | ||
281 | </property> | ||
282 | </widget> | ||
283 | </vbox> | ||
284 | </widget> | ||
285 | <widget> | ||
286 | <class>QLayoutWidget</class> | ||
287 | <property stdset="1"> | ||
288 | <name>name</name> | ||
289 | <cstring>Layout5</cstring> | ||
290 | </property> | ||
291 | <vbox> | ||
292 | <property stdset="1"> | ||
293 | <name>margin</name> | ||
294 | <number>0</number> | ||
295 | </property> | ||
296 | <property stdset="1"> | ||
297 | <name>spacing</name> | ||
298 | <number>6</number> | ||
299 | </property> | ||
300 | <widget> | ||
301 | <class>QLineEdit</class> | ||
302 | <property stdset="1"> | ||
303 | <name>name</name> | ||
304 | <cstring>deviceNameLine</cstring> | ||
305 | </property> | ||
306 | </widget> | ||
307 | <widget> | ||
308 | <class>QLineEdit</class> | ||
309 | <property stdset="1"> | ||
310 | <name>name</name> | ||
311 | <cstring>passkeyLine</cstring> | ||
312 | </property> | ||
313 | <property stdset="1"> | ||
314 | <name>echoMode</name> | ||
315 | <enum>Password</enum> | ||
316 | </property> | ||
317 | </widget> | ||
318 | </vbox> | ||
319 | </widget> | ||
320 | </hbox> | ||
321 | </widget> | ||
322 | <widget> | ||
323 | <class>QLayoutWidget</class> | ||
324 | <property stdset="1"> | ||
325 | <name>name</name> | ||
326 | <cstring>Layout5</cstring> | ||
327 | </property> | ||
328 | <vbox> | ||
275 | <property stdset="1"> | 329 | <property stdset="1"> |
276 | <name>name</name> | 330 | <name>margin</name> |
277 | <cstring>passkeyLine</cstring> | 331 | <number>0</number> |
278 | </property> | 332 | </property> |
279 | <property stdset="1"> | 333 | <property stdset="1"> |
280 | <name>echoMode</name> | 334 | <name>spacing</name> |
281 | <enum>Password</enum> | 335 | <number>6</number> |
282 | </property> | 336 | </property> |
283 | </widget> | 337 | <widget> |
284 | </hbox> | 338 | <class>QCheckBox</class> |
285 | </widget> | 339 | <property stdset="1"> |
286 | <widget> | 340 | <name>name</name> |
287 | <class>QLayoutWidget</class> | 341 | <cstring>authCheckBox</cstring> |
288 | <property stdset="1"> | 342 | </property> |
289 | <name>name</name> | 343 | <property stdset="1"> |
290 | <cstring>Layout5</cstring> | 344 | <name>text</name> |
291 | </property> | 345 | <string>enable authentification</string> |
292 | <vbox> | 346 | </property> |
347 | </widget> | ||
348 | <widget> | ||
349 | <class>QCheckBox</class> | ||
350 | <property stdset="1"> | ||
351 | <name>name</name> | ||
352 | <cstring>cryptCheckBox</cstring> | ||
353 | </property> | ||
354 | <property stdset="1"> | ||
355 | <name>text</name> | ||
356 | <string>enable encryption</string> | ||
357 | </property> | ||
358 | </widget> | ||
359 | <widget> | ||
360 | <class>QCheckBox</class> | ||
361 | <property stdset="1"> | ||
362 | <name>name</name> | ||
363 | <cstring>pagescanCheckBox</cstring> | ||
364 | </property> | ||
365 | <property stdset="1"> | ||
366 | <name>text</name> | ||
367 | <string>Enable Page scan</string> | ||
368 | </property> | ||
369 | </widget> | ||
370 | <widget> | ||
371 | <class>QCheckBox</class> | ||
372 | <property stdset="1"> | ||
373 | <name>name</name> | ||
374 | <cstring>inquiryscanCheckBox</cstring> | ||
375 | </property> | ||
376 | <property stdset="1"> | ||
377 | <name>text</name> | ||
378 | <string>Enable Inquiry scan</string> | ||
379 | </property> | ||
380 | </widget> | ||
381 | </vbox> | ||
382 | </widget> | ||
383 | <widget> | ||
384 | <class>QPushButton</class> | ||
293 | <property stdset="1"> | 385 | <property stdset="1"> |
294 | <name>margin</name> | 386 | <name>name</name> |
295 | <number>0</number> | 387 | <cstring>configApplyButton</cstring> |
296 | </property> | 388 | </property> |
297 | <property stdset="1"> | 389 | <property stdset="1"> |
298 | <name>spacing</name> | 390 | <name>text</name> |
299 | <number>6</number> | 391 | <string>Apply</string> |
300 | </property> | 392 | </property> |
301 | <widget> | 393 | </widget> |
302 | <class>QCheckBox</class> | 394 | </vbox> |
303 | <property stdset="1"> | 395 | </widget> |
304 | <name>name</name> | 396 | <widget> |
305 | <cstring>authCheckBox</cstring> | 397 | <class>QPushButton</class> |
306 | </property> | 398 | <property stdset="1"> |
307 | <property stdset="1"> | 399 | <name>name</name> |
308 | <name>text</name> | 400 | <cstring>rfcommBindButton</cstring> |
309 | <string>enable authentification</string> | 401 | </property> |
310 | </property> | 402 | <property stdset="1"> |
311 | </widget> | 403 | <name>text</name> |
312 | <widget> | 404 | <string>Rfcomm Bind Table</string> |
313 | <class>QCheckBox</class> | 405 | </property> |
314 | <property stdset="1"> | 406 | </widget> |
315 | <name>name</name> | 407 | </vbox> |
316 | <cstring>cryptCheckBox</cstring> | 408 | </widget> |
317 | </property> | 409 | <widget> |
318 | <property stdset="1"> | 410 | <class>QWidget</class> |
319 | <name>text</name> | 411 | <property stdset="1"> |
320 | <string>enable encryption</string> | 412 | <name>name</name> |
321 | </property> | 413 | <cstring>tab</cstring> |
322 | </widget> | 414 | </property> |
323 | <widget> | 415 | <attribute> |
324 | <class>QCheckBox</class> | 416 | <name>title</name> |
325 | <property stdset="1"> | 417 | <string>Status</string> |
326 | <name>name</name> | 418 | </attribute> |
327 | <cstring>pagescanCheckBox</cstring> | 419 | <vbox> |
328 | </property> | ||
329 | <property stdset="1"> | ||
330 | <name>text</name> | ||
331 | <string>Enable Page scan</string> | ||
332 | </property> | ||
333 | </widget> | ||
334 | <widget> | ||
335 | <class>QCheckBox</class> | ||
336 | <property stdset="1"> | ||
337 | <name>name</name> | ||
338 | <cstring>inquiryscanCheckBox</cstring> | ||
339 | </property> | ||
340 | <property stdset="1"> | ||
341 | <name>text</name> | ||
342 | <string>Enable Inquiry scan</string> | ||
343 | </property> | ||
344 | </widget> | ||
345 | </vbox> | ||
346 | </widget> | ||
347 | <widget> | ||
348 | <class>QPushButton</class> | ||
349 | <property stdset="1"> | ||
350 | <name>name</name> | ||
351 | <cstring>configApplyButton</cstring> | ||
352 | </property> | ||
353 | <property stdset="1"> | ||
354 | <name>text</name> | ||
355 | <string>Apply</string> | ||
356 | </property> | ||
357 | </widget> | ||
358 | </vbox> | ||
359 | </widget> | ||
360 | <widget> | ||
361 | <class>QWidget</class> | ||
362 | <property stdset="1"> | 420 | <property stdset="1"> |
363 | <name>name</name> | 421 | <name>margin</name> |
364 | <cstring>tab</cstring> | 422 | <number>2</number> |
365 | </property> | 423 | </property> |
366 | <attribute> | 424 | <property stdset="1"> |
367 | <name>title</name> | 425 | <name>spacing</name> |
368 | <string>Status</string> | 426 | <number>2</number> |
369 | </attribute> | 427 | </property> |
370 | <vbox> | 428 | <widget> |
429 | <class>QLabel</class> | ||
371 | <property stdset="1"> | 430 | <property stdset="1"> |
372 | <name>margin</name> | 431 | <name>name</name> |
373 | <number>2</number> | 432 | <cstring>StatusLabel</cstring> |
374 | </property> | 433 | </property> |
375 | <property stdset="1"> | 434 | <property stdset="1"> |
376 | <name>spacing</name> | 435 | <name>text</name> |
377 | <number>2</number> | 436 | <string>Status Label</string> |
378 | </property> | 437 | </property> |
379 | <widget> | 438 | </widget> |
380 | <class>QLabel</class> | 439 | </vbox> |
381 | <property stdset="1"> | ||
382 | <name>name</name> | ||
383 | <cstring>StatusLabel</cstring> | ||
384 | </property> | ||
385 | <property stdset="1"> | ||
386 | <name>text</name> | ||
387 | <string>Status Label</string> | ||
388 | </property> | ||
389 | </widget> | ||
390 | </vbox> | ||
391 | </widget> | ||
392 | </widget> | 440 | </widget> |
393 | </vbox> | 441 | </widget> |
394 | </widget> | 442 | </widget> |
395 | </UI> | 443 | </UI> |
diff --git a/noncore/net/opietooth/manager/main.cpp b/noncore/net/opietooth/manager/main.cpp index a86e36d..82aeebd 100644 --- a/noncore/net/opietooth/manager/main.cpp +++ b/noncore/net/opietooth/manager/main.cpp | |||
@@ -1,38 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * main.cpp | 2 | * main.cpp |
3 | * | 3 | * |
4 | * --------------------- | 4 | * --------------------- |
5 | * | 5 | * |
6 | * begin : Sun 10 17:20:00 CEST 2002 | 6 | * begin : Sun 10 17:20:00 CEST 2002 |
7 | * copyright : (c) 2002 by Maximilian Reiß | 7 | * copyright : (c) 2002 by Maximilian Reiß |
8 | * email : max.reiss@gmx.de | 8 | * email : max.reiss@gmx.de |
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | /*************************************************************************** | 11 | /*************************************************************************** |
12 | * * | 12 | * * |
13 | * This program is free software; you can redistribute it and/or modify * | 13 | * This program is free software; you can redistribute it and/or modify * |
14 | * it under the terms of the GNU General Public License as published by * | 14 | * it under the terms of the GNU General Public License as published by * |
15 | * the Free Software Foundation; either version 2 of the License, or * | 15 | * the Free Software Foundation; either version 2 of the License, or * |
16 | * (at your option) any later version. * | 16 | * (at your option) any later version. * |
17 | * * | 17 | * * |
18 | ***************************************************************************/ | 18 | ***************************************************************************/ |
19 | 19 | ||
20 | #include "bluebase.h" | 20 | #include "bluebase.h" |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <opie/oapplicationfactory.h> | ||
22 | 23 | ||
23 | 24 | OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::BlueBase> ) | |
24 | QPEApplication *BluetoothApp; | ||
25 | |||
26 | int main( int argc, char ** argv ) { | ||
27 | QPEApplication a(argc, argv); | ||
28 | BluetoothApp=&a; | ||
29 | |||
30 | OpieTooth::BlueBase t; | ||
31 | |||
32 | // t.setCaption( OpieTooth::BlueBase::tr("Bluetooth Manager") ); | ||
33 | a.showMainWidget(&t); | ||
34 | |||
35 | return a.exec(); | ||
36 | } | ||
37 | |||
38 | 25 | ||
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index 9841740..6ff4ebb 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro | |||
@@ -1,50 +1,50 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on debug | ||
3 | #CONFIG = qt warn_on release | ||
4 | HEADERS = btconnectionitem.h btdeviceitem.h \ | 2 | HEADERS = btconnectionitem.h btdeviceitem.h \ |
5 | btserviceitem.h stdpopups.h \ | 3 | btserviceitem.h stdpopups.h \ |
6 | popuphelper.h bluebase.h \ | 4 | popuphelper.h bluebase.h \ |
7 | scandialog.h btlistitem.h \ | 5 | scandialog.h btlistitem.h \ |
8 | hciconfwrapper.h bticonloader.h \ | 6 | hciconfwrapper.h bticonloader.h \ |
9 | pppdialog.h obexdialog.h \ | 7 | pppdialog.h obexdialog.h \ |
8 | rfcommassigndialogimpl.h rfcommassigndialogitem.h \ | ||
10 | devicehandler.h rfcpopup.h obexpopup.h \ | 9 | devicehandler.h rfcpopup.h obexpopup.h \ |
11 | rfcommhelper.h panpopup.h dunpopup.h | 10 | rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h |
12 | 11 | ||
13 | SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ | 12 | SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ |
14 | btserviceitem.cpp stdpopups.cpp \ | 13 | btserviceitem.cpp stdpopups.cpp \ |
15 | popuphelper.cpp main.cpp \ | 14 | popuphelper.cpp main.cpp \ |
16 | bluebase.cpp scandialog.cpp \ | 15 | bluebase.cpp scandialog.cpp \ |
17 | btlistitem.cpp hciconfwrapper.cpp \ | 16 | btlistitem.cpp hciconfwrapper.cpp \ |
18 | bticonloader.cpp pppdialog.cpp \ | 17 | bticonloader.cpp pppdialog.cpp \ |
18 | rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \ | ||
19 | obexdialog.cpp devicehandler.cpp \ | 19 | obexdialog.cpp devicehandler.cpp \ |
20 | rfcpopup.cpp obexpopup.cpp \ | 20 | rfcpopup.cpp obexpopup.cpp \ |
21 | rfcommhelper.cpp panpopup.cpp dunpopup.cpp | 21 | rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp |
22 | INCLUDEPATH += $(OPIEDIR)/include | 22 | INCLUDEPATH += $(OPIEDIR)/include |
23 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib | 23 | INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib |
24 | DEPENDPATH += $(OPIEDIR)/include | 24 | DEPENDPATH += $(OPIEDIR)/include |
25 | LIBS += -lqpe -lopietooth -lopie | 25 | LIBS += -lqpe -lopietooth -lopie |
26 | INTERFACES = bluetoothbase.ui devicedialog.ui | 26 | INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui rfcommdialogitembase.ui |
27 | DESTDIR = $(OPIEDIR)/bin | 27 | |
28 | TARGET = bluetooth-manager | 28 | TARGET = bluetooth-manager |
29 | 29 | ||
30 | TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ | 30 | TRANSLATIONS = ../../../../i18n/de/bluetooth-manager.ts \ |
31 | ../../../../i18n/nl/bluetooth-manager.ts \ | 31 | ../../../../i18n/nl/bluetooth-manager.ts \ |
32 | ../../../../i18n/da/bluetooth-manager.ts \ | 32 | ../../../../i18n/da/bluetooth-manager.ts \ |
33 | ../../../../i18n/xx/bluetooth-manager.ts \ | 33 | ../../../../i18n/xx/bluetooth-manager.ts \ |
34 | ../../../../i18n/en/bluetooth-manager.ts \ | 34 | ../../../../i18n/en/bluetooth-manager.ts \ |
35 | ../../../../i18n/es/bluetooth-manager.ts \ | 35 | ../../../../i18n/es/bluetooth-manager.ts \ |
36 | ../../../../i18n/fr/bluetooth-manager.ts \ | 36 | ../../../../i18n/fr/bluetooth-manager.ts \ |
37 | ../../../../i18n/hu/bluetooth-manager.ts \ | 37 | ../../../../i18n/hu/bluetooth-manager.ts \ |
38 | ../../../../i18n/ja/bluetooth-manager.ts \ | 38 | ../../../../i18n/ja/bluetooth-manager.ts \ |
39 | ../../../../i18n/ko/bluetooth-manager.ts \ | 39 | ../../../../i18n/ko/bluetooth-manager.ts \ |
40 | ../../../../i18n/no/bluetooth-manager.ts \ | 40 | ../../../../i18n/no/bluetooth-manager.ts \ |
41 | ../../../../i18n/pl/bluetooth-manager.ts \ | 41 | ../../../../i18n/pl/bluetooth-manager.ts \ |
42 | ../../../../i18n/pt/bluetooth-manager.ts \ | 42 | ../../../../i18n/pt/bluetooth-manager.ts \ |
43 | ../../../../i18n/pt_BR/bluetooth-manager.ts \ | 43 | ../../../../i18n/pt_BR/bluetooth-manager.ts \ |
44 | ../../../../i18n/sl/bluetooth-manager.ts \ | 44 | ../../../../i18n/sl/bluetooth-manager.ts \ |
45 | ../../../../i18n/zh_CN/bluetooth-manager.ts \ | 45 | ../../../../i18n/zh_CN/bluetooth-manager.ts \ |
46 | ../../../../i18n/zh_TW/bluetooth-manager.ts | 46 | ../../../../i18n/zh_TW/bluetooth-manager.ts |
47 | 47 | ||
48 | 48 | ||
49 | 49 | ||
50 | include ( $(OPIEDIR)/include.pro ) | 50 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogbase.ui b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui new file mode 100644 index 0000000..aefa698 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogbase.ui | |||
@@ -0,0 +1,44 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>RfcommAssignDialogBase</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>RfcommAssignDialogBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>444</width> | ||
15 | <height>343</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Rfcomm Bind</string> | ||
21 | </property> | ||
22 | <vbox> | ||
23 | <property stdset="1"> | ||
24 | <name>margin</name> | ||
25 | <number>11</number> | ||
26 | </property> | ||
27 | <property stdset="1"> | ||
28 | <name>spacing</name> | ||
29 | <number>6</number> | ||
30 | </property> | ||
31 | <widget> | ||
32 | <class>QLabel</class> | ||
33 | <property stdset="1"> | ||
34 | <name>name</name> | ||
35 | <cstring>TextLabel1</cstring> | ||
36 | </property> | ||
37 | <property stdset="1"> | ||
38 | <name>text</name> | ||
39 | <string>Bind device to a interface</string> | ||
40 | </property> | ||
41 | </widget> | ||
42 | </vbox> | ||
43 | </widget> | ||
44 | </UI> | ||
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp new file mode 100644 index 0000000..b5cc074 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp | |||
@@ -0,0 +1,120 @@ | |||
1 | |||
2 | #include "rfcommassigndialogimpl.h" | ||
3 | #include "rfcommassigndialogitem.h" | ||
4 | #include "rfcommconfhandler.h" | ||
5 | |||
6 | #include <qpe/config.h> | ||
7 | |||
8 | #include <qlayout.h> | ||
9 | |||
10 | using namespace OpieTooth; | ||
11 | |||
12 | // TODO: write only the file in bluebase? | ||
13 | // muss rfcommd dann neu gestartet werden | ||
14 | // sollte rfcomm bind all nicht eh default config sein ( polled das? - d.h. sobald nen gerät in der nähe ist bindet es? | ||
15 | |||
16 | |||
17 | RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
18 | : RfcommAssignDialogBase( parent, name, modal, fl ) { | ||
19 | |||
20 | m_range = 5; | ||
21 | |||
22 | m_scrollView = new QScrollView( this ); | ||
23 | m_scrollView->setResizePolicy( QScrollView::AutoOneFit ); | ||
24 | m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
25 | |||
26 | RfcommAssignDialogBaseLayout->addWidget( m_scrollView ); | ||
27 | |||
28 | m_box = new QVBox( m_scrollView->viewport() ); | ||
29 | m_scrollView->addChild( m_box ); | ||
30 | |||
31 | confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" ); | ||
32 | |||
33 | loadConfig(); | ||
34 | } | ||
35 | |||
36 | RfcommAssignDialog::~RfcommAssignDialog() { | ||
37 | if ( confHandler ) { | ||
38 | delete confHandler; | ||
39 | } | ||
40 | } | ||
41 | |||
42 | |||
43 | void RfcommAssignDialog::newDevice( const QString & mac ) { | ||
44 | |||
45 | for ( int i = 0 ; i < m_range; i++ ) { | ||
46 | |||
47 | QMap<QString, RfCommConfObject*>::Iterator it; | ||
48 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); | ||
49 | // make sure that rfcommX is not assigned yet | ||
50 | if ( it == confHandler->foundEntries().end() ) { | ||
51 | QDialog dialog( this, "newdevice", true, WStyle_ContextHelp ); | ||
52 | dialog.showMaximized(); | ||
53 | RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); | ||
54 | newDev->setIdent( i ); | ||
55 | newDev->setMac( mac ); | ||
56 | |||
57 | if ( dialog.exec() == QDialog::Accepted ) { | ||
58 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); | ||
59 | m_itemList.insert( i , rfcomm ); | ||
60 | rfcomm->setIdent( i ); | ||
61 | rfcomm->setMac( mac ); | ||
62 | rfcomm->setChannel( newDev->channel() ); | ||
63 | rfcomm->setComment( newDev->comment() ); | ||
64 | qDebug( "New device set up" ); | ||
65 | } | ||
66 | } | ||
67 | } | ||
68 | } | ||
69 | |||
70 | void RfcommAssignDialog::loadConfig() { | ||
71 | |||
72 | //Config cfg( "bluetoothmanager-rfcommbind" ); | ||
73 | |||
74 | for ( int i = 0 ; i < m_range; i++ ) { | ||
75 | // cfg.setGroup( QString("%1").arg( i ) ); | ||
76 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); | ||
77 | m_itemList.insert( i , rfcomm ); | ||
78 | rfcomm->setIdent( i ); | ||
79 | QMap<QString, RfCommConfObject*>::Iterator it; | ||
80 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); | ||
81 | if ( it != confHandler->foundEntries().end() ) { | ||
82 | qDebug( "Found key in foundEntries() " ); | ||
83 | rfcomm->setMac( it.data()->mac() ); | ||
84 | rfcomm->setChannel( it.data()->channel() ); | ||
85 | rfcomm->setComment( it.data()->comment() ); | ||
86 | } | ||
87 | /* Use rfcomm.conf directly for now | ||
88 | * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); | ||
89 | * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); | ||
90 | * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); | ||
91 | */ | ||
92 | } | ||
93 | } | ||
94 | |||
95 | |||
96 | void RfcommAssignDialog::saveConfig() { | ||
97 | |||
98 | //Config cfg( "bluetoothmanager-rfcommbind" ); | ||
99 | |||
100 | QMap< int, RfcommDialogItem*>::Iterator it; | ||
101 | |||
102 | QMap< QString, RfCommConfObject*> outMap; | ||
103 | |||
104 | for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) { | ||
105 | |||
106 | //cfg.setGroup( QString("%1").arg( it.key() ) ); | ||
107 | RfcommDialogItem *rfcomm = it.data(); | ||
108 | |||
109 | |||
110 | outMap.insert( QString( "%1").arg( it.key() ), new RfCommConfObject( it.key(), rfcomm->mac(), rfcomm->channel(), rfcomm->comment() ) ); | ||
111 | |||
112 | |||
113 | //cfg.writeEntry( "mac", rfcomm->mac() ); | ||
114 | //cfg.writeEntry( "channel", rfcomm->channel() ); | ||
115 | //cfg.writeEntry( "comment", rfcomm->comment() ); | ||
116 | } | ||
117 | |||
118 | confHandler->save( outMap ); | ||
119 | |||
120 | } | ||
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.h b/noncore/net/opietooth/manager/rfcommassigndialogimpl.h new file mode 100644 index 0000000..9983632 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef RFCOMMASSIGN | ||
2 | #define RFCOMMASSIGN | ||
3 | |||
4 | #include "rfcommassigndialogbase.h" | ||
5 | #include "rfcommassigndialogitem.h" | ||
6 | #include "rfcommconfhandler.h" | ||
7 | |||
8 | #include <qscrollview.h> | ||
9 | #include <qmap.h> | ||
10 | #include <qvbox.h> | ||
11 | |||
12 | namespace OpieTooth { | ||
13 | |||
14 | class RfcommAssignDialog: public RfcommAssignDialogBase { | ||
15 | |||
16 | Q_OBJECT | ||
17 | |||
18 | public: | ||
19 | |||
20 | RfcommAssignDialog( QWidget* parent = 0, const char* name = 0,bool modal = 0, WFlags fl = 0 ); | ||
21 | ~RfcommAssignDialog(); | ||
22 | |||
23 | void loadConfig(); | ||
24 | void saveConfig(); | ||
25 | |||
26 | void newDevice( const QString & mac ); | ||
27 | |||
28 | private: | ||
29 | QScrollView *m_scrollView; | ||
30 | // how many rfcomm devices are possible | ||
31 | int m_range; | ||
32 | QMap< int, RfcommDialogItem* > m_itemList; | ||
33 | QVBox *m_box; | ||
34 | RfCommConfHandler *confHandler; | ||
35 | }; | ||
36 | |||
37 | } | ||
38 | |||
39 | #endif | ||
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp new file mode 100644 index 0000000..1e7130f --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp | |||
@@ -0,0 +1,54 @@ | |||
1 | |||
2 | #include "rfcommassigndialogitem.h" | ||
3 | |||
4 | #include <qlineedit.h> | ||
5 | #include <qcombobox.h> | ||
6 | #include <qlabel.h> | ||
7 | #include <qgroupbox.h> | ||
8 | |||
9 | using namespace OpieTooth; | ||
10 | |||
11 | |||
12 | RfcommDialogItem::RfcommDialogItem( QWidget* parent, const char* name, WFlags fl ) | ||
13 | : RfcommDialogItemBase( parent, name, fl ) { | ||
14 | |||
15 | } | ||
16 | |||
17 | RfcommDialogItem::~RfcommDialogItem() { | ||
18 | } | ||
19 | |||
20 | |||
21 | int RfcommDialogItem::ident() { | ||
22 | return m_ident; | ||
23 | } | ||
24 | |||
25 | QString RfcommDialogItem::mac() { | ||
26 | return m_macAddress->text(); | ||
27 | } | ||
28 | |||
29 | int RfcommDialogItem::channel() { | ||
30 | return m_channelDropdown->currentItem(); | ||
31 | } | ||
32 | |||
33 | QString RfcommDialogItem::comment() { | ||
34 | return m_commentLine->text(); | ||
35 | } | ||
36 | |||
37 | void RfcommDialogItem::setIdent( int ident ) { | ||
38 | m_ident = ident; | ||
39 | m_identLabel->setTitle( QString( "rfcomm%1").arg( ident ) ); | ||
40 | } | ||
41 | |||
42 | void RfcommDialogItem::setMac( const QString &mac ) { | ||
43 | m_macAddress->setText( mac ); | ||
44 | } | ||
45 | |||
46 | void RfcommDialogItem::setChannel( int channel ) { | ||
47 | m_channelDropdown->setCurrentItem( channel ); | ||
48 | } | ||
49 | |||
50 | void RfcommDialogItem::setComment( const QString &comment ) { | ||
51 | m_commentLine->setText( comment ); | ||
52 | } | ||
53 | |||
54 | |||
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.h b/noncore/net/opietooth/manager/rfcommassigndialogitem.h new file mode 100644 index 0000000..34a794f --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.h | |||
@@ -0,0 +1,40 @@ | |||
1 | #ifndef RFCOMMDIALOGITEM | ||
2 | #define RFCOMMDIALOGITEM | ||
3 | |||
4 | #include "rfcommdialogitembase.h" | ||
5 | |||
6 | #include <qwidget.h> | ||
7 | |||
8 | namespace OpieTooth { | ||
9 | |||
10 | class RfcommDialogItem : public RfcommDialogItemBase { | ||
11 | |||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | RfcommDialogItem( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
16 | ~RfcommDialogItem(); | ||
17 | |||
18 | // number if the rfcomm device | ||
19 | int ident(); | ||
20 | // devices mac address | ||
21 | QString mac(); | ||
22 | int channel(); | ||
23 | QString comment(); | ||
24 | |||
25 | void setIdent( int ident ); | ||
26 | void setMac( const QString& mac ); | ||
27 | void setChannel( int channel ); | ||
28 | void setComment( const QString& comment ); | ||
29 | |||
30 | private: | ||
31 | |||
32 | |||
33 | int m_ident; | ||
34 | |||
35 | }; | ||
36 | |||
37 | |||
38 | } | ||
39 | |||
40 | #endif | ||
diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp new file mode 100644 index 0000000..20453e8 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp | |||
@@ -0,0 +1,114 @@ | |||
1 | |||
2 | #include <qtextstream.h> | ||
3 | |||
4 | #include "rfcommconfhandler.h" | ||
5 | |||
6 | |||
7 | using namespace OpieTooth; | ||
8 | |||
9 | // move to lib | ||
10 | |||
11 | |||
12 | RfCommConfObject::RfCommConfObject( int number, QString mac, int channel, QString comment ) { | ||
13 | m_number = number; | ||
14 | m_mac = mac; | ||
15 | m_channel = channel; | ||
16 | m_comment = comment; | ||
17 | // m_foundEntries = 0; | ||
18 | } | ||
19 | |||
20 | void RfCommConfObject::setNumber( int number ) { | ||
21 | m_number = number; | ||
22 | } | ||
23 | |||
24 | void RfCommConfObject::setMac( QString mac ) { | ||
25 | m_mac = mac; | ||
26 | } | ||
27 | |||
28 | void RfCommConfObject::setChannel( int channel ) { | ||
29 | m_channel = channel; | ||
30 | } | ||
31 | |||
32 | void RfCommConfObject::setComment( QString comment ) { | ||
33 | m_comment = comment; | ||
34 | } | ||
35 | |||
36 | |||
37 | RfCommConfObject::~RfCommConfObject() { | ||
38 | } | ||
39 | |||
40 | |||
41 | RfCommConfHandler::RfCommConfHandler( const QString & filename ) { | ||
42 | |||
43 | m_filename = filename; | ||
44 | load(); | ||
45 | } | ||
46 | |||
47 | RfCommConfHandler::~RfCommConfHandler() { | ||
48 | |||
49 | } | ||
50 | |||
51 | void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) { | ||
52 | |||
53 | QFile rfCommConf( "/tmp/test" ); | ||
54 | QTextStream outStream( &rfCommConf ); | ||
55 | if ( rfCommConf.open( IO_WriteOnly ) ) { | ||
56 | |||
57 | QMap<QString, RfCommConfObject*>::Iterator it; | ||
58 | for( it = devices.begin(); it != devices.end(); ++it ) { | ||
59 | outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n"; | ||
60 | outStream << " device " + it.data()->mac() + ";\n"; | ||
61 | outStream << " channel " + QString( "%1" ).arg( it.data()->channel() ) + ";\n"; | ||
62 | outStream << " comment \"" + it.data()->comment() + "\";\n"; | ||
63 | outStream << "}\n\n"; | ||
64 | } | ||
65 | |||
66 | rfCommConf.close(); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | |||
71 | QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() { | ||
72 | return m_foundEntries; | ||
73 | } | ||
74 | |||
75 | void RfCommConfHandler::load() { | ||
76 | |||
77 | QFile rfCommConf( m_filename ); | ||
78 | if ( rfCommConf.open( IO_ReadOnly ) ) { | ||
79 | |||
80 | QStringList list; | ||
81 | QTextStream inStream( &rfCommConf ); | ||
82 | list = QStringList::split( "\n", inStream.read() ); | ||
83 | |||
84 | QString number; | ||
85 | QString mac; | ||
86 | QString channel; | ||
87 | QString comment; | ||
88 | |||
89 | for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) { | ||
90 | |||
91 | QString tmpLine = ( *line ).stripWhiteSpace(); | ||
92 | |||
93 | if ( tmpLine.startsWith("rfcomm") ) { | ||
94 | QString number = tmpLine.mid( 6,1 ); | ||
95 | qDebug( tmpLine ); | ||
96 | qDebug( "TEST " + number ); | ||
97 | } else if ( tmpLine.startsWith( "}" ) ) { | ||
98 | m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) ); | ||
99 | } else if ( tmpLine.startsWith( "device" ) ) { | ||
100 | mac = tmpLine.mid( 7, 17 ); | ||
101 | qDebug( "mac" + mac ); | ||
102 | } else if ( tmpLine.startsWith( "channel" ) ) { | ||
103 | channel = tmpLine.mid( 8, 1 ); | ||
104 | qDebug ( "Channel :" + channel ); | ||
105 | } else if ( tmpLine.startsWith( "comment" ) ) { | ||
106 | comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 ); | ||
107 | qDebug( "Comment: " + comment ); | ||
108 | } | ||
109 | } | ||
110 | rfCommConf.close(); | ||
111 | } | ||
112 | save( m_foundEntries ); | ||
113 | qDebug( QString( "ENTries: %1").arg( m_foundEntries.count() ) ); | ||
114 | } | ||
diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.h b/noncore/net/opietooth/manager/rfcommconfhandler.h new file mode 100644 index 0000000..e13c833 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommconfhandler.h | |||
@@ -0,0 +1,54 @@ | |||
1 | #ifndef RFCOMMCONFHANDLER | ||
2 | #define RFCOMMCONFHANDLER | ||
3 | |||
4 | #include <qstring.h> | ||
5 | #include <qfile.h> | ||
6 | #include <qobject.h> | ||
7 | #include <qmap.h> | ||
8 | |||
9 | namespace OpieTooth { | ||
10 | |||
11 | class RfCommConfObject { | ||
12 | |||
13 | public: | ||
14 | RfCommConfObject( int number, QString mac, int channel, QString comment ); | ||
15 | ~RfCommConfObject(); | ||
16 | |||
17 | void setNumber( int number ); | ||
18 | int number() { return m_number; }; | ||
19 | void setMac( QString mac ); | ||
20 | QString mac() { return m_mac; }; | ||
21 | void setChannel( int channel ); | ||
22 | int channel() { return m_channel; }; | ||
23 | void setComment( QString comment ); | ||
24 | QString comment() { return m_comment; }; | ||
25 | |||
26 | |||
27 | private: | ||
28 | int m_number; | ||
29 | QString m_mac; | ||
30 | int m_channel; | ||
31 | QString m_comment; | ||
32 | |||
33 | }; | ||
34 | |||
35 | class RfCommConfHandler { | ||
36 | |||
37 | public: | ||
38 | RfCommConfHandler( const QString & filename ); | ||
39 | ~RfCommConfHandler(); | ||
40 | |||
41 | void save( QMap<QString, RfCommConfObject*> devices ); | ||
42 | |||
43 | QMap<QString, RfCommConfObject*> foundEntries(); | ||
44 | |||
45 | private: | ||
46 | void load(); | ||
47 | |||
48 | QString m_filename; | ||
49 | QMap<QString, RfCommConfObject*> m_foundEntries; | ||
50 | }; | ||
51 | |||
52 | } | ||
53 | |||
54 | #endif | ||
diff --git a/noncore/net/opietooth/manager/rfcommdialogitembase.ui b/noncore/net/opietooth/manager/rfcommdialogitembase.ui new file mode 100644 index 0000000..dafca52 --- a/dev/null +++ b/noncore/net/opietooth/manager/rfcommdialogitembase.ui | |||
@@ -0,0 +1,216 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>RfcommDialogItemBase</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>RfcommDialogItemBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>345</width> | ||
15 | <height>95</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Form2</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>0</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>0</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QGroupBox</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>m_identLabel</cstring> | ||
42 | </property> | ||
43 | <property> | ||
44 | <name>layoutMargin</name> | ||
45 | </property> | ||
46 | <property> | ||
47 | <name>layoutSpacing</name> | ||
48 | </property> | ||
49 | <grid> | ||
50 | <property stdset="1"> | ||
51 | <name>margin</name> | ||
52 | <number>5</number> | ||
53 | </property> | ||
54 | <property stdset="1"> | ||
55 | <name>spacing</name> | ||
56 | <number>5</number> | ||
57 | </property> | ||
58 | <widget row="0" column="0" > | ||
59 | <class>QLayoutWidget</class> | ||
60 | <property stdset="1"> | ||
61 | <name>name</name> | ||
62 | <cstring>Layout3</cstring> | ||
63 | </property> | ||
64 | <hbox> | ||
65 | <property stdset="1"> | ||
66 | <name>margin</name> | ||
67 | <number>0</number> | ||
68 | </property> | ||
69 | <property stdset="1"> | ||
70 | <name>spacing</name> | ||
71 | <number>6</number> | ||
72 | </property> | ||
73 | <widget> | ||
74 | <class>QLabel</class> | ||
75 | <property stdset="1"> | ||
76 | <name>name</name> | ||
77 | <cstring>TextLabel4</cstring> | ||
78 | </property> | ||
79 | <property stdset="1"> | ||
80 | <name>text</name> | ||
81 | <string>Mac</string> | ||
82 | </property> | ||
83 | </widget> | ||
84 | <widget> | ||
85 | <class>QLineEdit</class> | ||
86 | <property stdset="1"> | ||
87 | <name>name</name> | ||
88 | <cstring>m_macAddress</cstring> | ||
89 | </property> | ||
90 | </widget> | ||
91 | <widget> | ||
92 | <class>QLabel</class> | ||
93 | <property stdset="1"> | ||
94 | <name>name</name> | ||
95 | <cstring>TextLabel5</cstring> | ||
96 | </property> | ||
97 | <property stdset="1"> | ||
98 | <name>text</name> | ||
99 | <string>Channel</string> | ||
100 | </property> | ||
101 | </widget> | ||
102 | <widget> | ||
103 | <class>QComboBox</class> | ||
104 | <item> | ||
105 | <property> | ||
106 | <name>text</name> | ||
107 | <string>0</string> | ||
108 | </property> | ||
109 | </item> | ||
110 | <item> | ||
111 | <property> | ||
112 | <name>text</name> | ||
113 | <string>1</string> | ||
114 | </property> | ||
115 | </item> | ||
116 | <item> | ||
117 | <property> | ||
118 | <name>text</name> | ||
119 | <string>2</string> | ||
120 | </property> | ||
121 | </item> | ||
122 | <item> | ||
123 | <property> | ||
124 | <name>text</name> | ||
125 | <string>3</string> | ||
126 | </property> | ||
127 | </item> | ||
128 | <item> | ||
129 | <property> | ||
130 | <name>text</name> | ||
131 | <string>4</string> | ||
132 | </property> | ||
133 | </item> | ||
134 | <item> | ||
135 | <property> | ||
136 | <name>text</name> | ||
137 | <string>5</string> | ||
138 | </property> | ||
139 | </item> | ||
140 | <item> | ||
141 | <property> | ||
142 | <name>text</name> | ||
143 | <string>6</string> | ||
144 | </property> | ||
145 | </item> | ||
146 | <item> | ||
147 | <property> | ||
148 | <name>text</name> | ||
149 | <string>7</string> | ||
150 | </property> | ||
151 | </item> | ||
152 | <item> | ||
153 | <property> | ||
154 | <name>text</name> | ||
155 | <string>8</string> | ||
156 | </property> | ||
157 | </item> | ||
158 | <item> | ||
159 | <property> | ||
160 | <name>text</name> | ||
161 | <string>9</string> | ||
162 | </property> | ||
163 | </item> | ||
164 | <item> | ||
165 | <property> | ||
166 | <name>text</name> | ||
167 | <string>10</string> | ||
168 | </property> | ||
169 | </item> | ||
170 | <property stdset="1"> | ||
171 | <name>name</name> | ||
172 | <cstring>m_channelDropdown</cstring> | ||
173 | </property> | ||
174 | </widget> | ||
175 | </hbox> | ||
176 | </widget> | ||
177 | <widget row="1" column="0" > | ||
178 | <class>QLayoutWidget</class> | ||
179 | <property stdset="1"> | ||
180 | <name>name</name> | ||
181 | <cstring>Layout4</cstring> | ||
182 | </property> | ||
183 | <hbox> | ||
184 | <property stdset="1"> | ||
185 | <name>margin</name> | ||
186 | <number>0</number> | ||
187 | </property> | ||
188 | <property stdset="1"> | ||
189 | <name>spacing</name> | ||
190 | <number>6</number> | ||
191 | </property> | ||
192 | <widget> | ||
193 | <class>QLabel</class> | ||
194 | <property stdset="1"> | ||
195 | <name>name</name> | ||
196 | <cstring>TextLabel3</cstring> | ||
197 | </property> | ||
198 | <property stdset="1"> | ||
199 | <name>text</name> | ||
200 | <string>Comment:</string> | ||
201 | </property> | ||
202 | </widget> | ||
203 | <widget> | ||
204 | <class>QLineEdit</class> | ||
205 | <property stdset="1"> | ||
206 | <name>name</name> | ||
207 | <cstring>m_commentLine</cstring> | ||
208 | </property> | ||
209 | </widget> | ||
210 | </hbox> | ||
211 | </widget> | ||
212 | </grid> | ||
213 | </widget> | ||
214 | </vbox> | ||
215 | </widget> | ||
216 | </UI> | ||
diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp index cc87b6c..d95f14b 100644 --- a/noncore/net/opietooth/manager/rfcpopup.cpp +++ b/noncore/net/opietooth/manager/rfcpopup.cpp | |||
@@ -1,85 +1,96 @@ | |||
1 | 1 | ||
2 | #include <qtimer.h> | 2 | #include <qtimer.h> |
3 | 3 | ||
4 | #include "pppdialog.h" | 4 | #include "pppdialog.h" |
5 | #include "rfcpopup.h" | 5 | #include "rfcpopup.h" |
6 | #include "rfcommassigndialogimpl.h" | ||
6 | 7 | ||
7 | using namespace OpieTooth; | 8 | using namespace OpieTooth; |
8 | 9 | ||
9 | /* | 10 | /* |
10 | * c'tor init the QAction | 11 | * c'tor init the QAction |
11 | */ | 12 | */ |
12 | RfcCommPopup::RfcCommPopup() | 13 | RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) |
13 | : QPopupMenu() { | 14 | : QPopupMenu() { |
14 | qWarning("RfcCommPopup c'tor"); | 15 | qWarning("RfcCommPopup c'tor"); |
15 | 16 | ||
16 | QAction* a; | 17 | QAction* a; |
17 | 18 | ||
19 | |||
20 | m_item = item; | ||
21 | |||
18 | /* connect action */ | 22 | /* connect action */ |
19 | a = new QAction( ); // so it's get deleted | 23 | a = new QAction( ); // so it's get deleted |
20 | a->setText("Connect"); | 24 | a->setText("Connect"); |
21 | a->addTo( this ); | 25 | a->addTo( this ); |
22 | connect( a, SIGNAL( activated() ), | 26 | connect( a, SIGNAL( activated() ), |
23 | this, SLOT( slotConnect() ) ); | 27 | this, SLOT( slotConnect() ) ); |
24 | 28 | ||
25 | 29 | ||
26 | /* disconnect action */ | 30 | /* disconnect action */ |
27 | a = new QAction( ); | 31 | a = new QAction( ); |
28 | a->setText("Disconnect"); | 32 | a->setText("Disconnect"); |
29 | a->addTo( this ); | 33 | a->addTo( this ); |
30 | connect( a, SIGNAL( activated() ) , | 34 | connect( a, SIGNAL( activated() ) , |
31 | this, SLOT( slotDisconnect() ) ); | 35 | this, SLOT( slotDisconnect() ) ); |
32 | 36 | ||
33 | 37 | ||
34 | /* foo action */ | 38 | /* foo action */ |
35 | a = new QAction( ); | 39 | a = new QAction( ); |
36 | a->setText("Foo"); | 40 | a->setText("Bind table"); |
37 | a->addTo( this ); | 41 | a->addTo( this ); |
38 | connect( a, SIGNAL( activated() ), | 42 | connect( a, SIGNAL( activated() ), |
39 | this, SLOT( slotFoo() ) ); | 43 | this, SLOT( slotBind() ) ); |
40 | 44 | ||
41 | 45 | ||
42 | /* bar action */ | 46 | /* bar action */ |
43 | a = new QAction( ); | 47 | a = new QAction( ); |
44 | a->setText( "Bar" ); | 48 | a->setText( "Bar" ); |
45 | a->addTo( this ); | 49 | a->addTo( this ); |
46 | connect( a, SIGNAL( activated() ), | 50 | connect( a, SIGNAL( activated() ), |
47 | this, SLOT( slotBar() ) ); | 51 | this, SLOT( slotBar() ) ); |
48 | 52 | ||
49 | }; | 53 | }; |
50 | 54 | ||
51 | 55 | ||
52 | RfcCommPopup::~RfcCommPopup() { | 56 | RfcCommPopup::~RfcCommPopup() { |
53 | /* delete m_con; | 57 | /* delete m_con; |
54 | delete m_dis; | 58 | delete m_dis; |
55 | delete m_foo; | 59 | delete m_foo; |
56 | delete m_bar; */ | 60 | delete m_bar; */ |
57 | } | 61 | } |
58 | 62 | ||
59 | 63 | ||
60 | void RfcCommPopup::slotConnect() { | 64 | void RfcCommPopup::slotConnect() { |
61 | 65 | ||
62 | qWarning("connect"); | 66 | qWarning("connect"); |
63 | 67 | ||
64 | 68 | ||
65 | 69 | ||
66 | PPPDialog pppDialog; | 70 | PPPDialog pppDialog; |
67 | pppDialog.showMaximized(); | 71 | pppDialog.showMaximized(); |
68 | pppDialog.exec(); | 72 | pppDialog.exec(); |
69 | } | 73 | } |
70 | 74 | ||
71 | 75 | ||
72 | void RfcCommPopup::slotDisconnect() { | 76 | void RfcCommPopup::slotDisconnect() { |
73 | qWarning("slot disconnected"); | 77 | qWarning("slot disconnected"); |
74 | } | 78 | } |
75 | 79 | ||
76 | 80 | ||
77 | void RfcCommPopup::slotFoo() { | 81 | void RfcCommPopup::slotBind() { |
78 | qWarning("slotFoo"); | 82 | RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); |
83 | |||
84 | rfcommAssign.showMaximized(); | ||
85 | rfcommAssign.newDevice( m_item->mac() ); | ||
86 | |||
87 | if ( rfcommAssign.exec() == QDialog::Accepted ) { | ||
88 | rfcommAssign.saveConfig(); | ||
89 | } | ||
79 | } | 90 | } |
80 | 91 | ||
81 | 92 | ||
82 | void RfcCommPopup::slotBar() { | 93 | void RfcCommPopup::slotBar() { |
83 | qWarning("slotBar"); | 94 | qWarning("slotBar"); |
84 | }; | 95 | }; |
85 | 96 | ||
diff --git a/noncore/net/opietooth/manager/rfcpopup.h b/noncore/net/opietooth/manager/rfcpopup.h index c388f65..74b9117 100644 --- a/noncore/net/opietooth/manager/rfcpopup.h +++ b/noncore/net/opietooth/manager/rfcpopup.h | |||
@@ -1,36 +1,39 @@ | |||
1 | #ifndef RFCPOPUP_H | 1 | #ifndef RFCPOPUP_H |
2 | #define RFCPOPUP_H | 2 | #define RFCPOPUP_H |
3 | 3 | ||
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | 6 | ||
7 | #include "btdeviceitem.h" | ||
8 | |||
7 | namespace OpieTooth { | 9 | namespace OpieTooth { |
8 | /** | 10 | /** |
9 | * A simple reference implementation for | 11 | * A simple reference implementation for |
10 | * the popup helper factory. | 12 | * the popup helper factory. |
11 | * This class derives from QPopupMenu and uses | 13 | * This class derives from QPopupMenu and uses |
12 | * plugged QActions to do all the nasty in it's | 14 | * plugged QActions to do all the nasty in it's |
13 | * slots. After the work is done everything must | 15 | * slots. After the work is done everything must |
14 | * be deleted. | 16 | * be deleted. |
15 | */ | 17 | */ |
16 | class RfcCommPopup : public QPopupMenu { | 18 | class RfcCommPopup : public QPopupMenu { |
17 | Q_OBJECT | 19 | Q_OBJECT |
18 | public: | 20 | public: |
19 | RfcCommPopup(); | 21 | RfcCommPopup( OpieTooth::BTDeviceItem* ); |
20 | ~RfcCommPopup(); | 22 | ~RfcCommPopup(); |
21 | 23 | ||
22 | 24 | ||
23 | private: | 25 | private: |
24 | QAction* m_con; | 26 | QAction* m_con; |
25 | QAction* m_dis; | 27 | QAction* m_dis; |
26 | QAction* m_foo; | 28 | QAction* m_bind; |
27 | QAction* m_bar; | 29 | QAction* m_bar; |
30 | OpieTooth::BTDeviceItem *m_item; | ||
28 | private slots: | 31 | private slots: |
29 | void slotConnect(); | 32 | void slotConnect(); |
30 | void slotDisconnect(); | 33 | void slotDisconnect(); |
31 | void slotFoo(); | 34 | void slotBind(); |
32 | void slotBar(); | 35 | void slotBar(); |
33 | }; | 36 | }; |
34 | }; | 37 | }; |
35 | 38 | ||
36 | #endif | 39 | #endif |
diff --git a/noncore/net/opietooth/manager/stdpopups.cpp b/noncore/net/opietooth/manager/stdpopups.cpp index 38b8ee7..e1f8396 100644 --- a/noncore/net/opietooth/manager/stdpopups.cpp +++ b/noncore/net/opietooth/manager/stdpopups.cpp | |||
@@ -1,26 +1,26 @@ | |||
1 | 1 | ||
2 | #include "rfcpopup.h" | 2 | #include "rfcpopup.h" |
3 | #include "obexpopup.h" | 3 | #include "obexpopup.h" |
4 | #include "panpopup.h" | 4 | #include "panpopup.h" |
5 | #include "dunpopup.h" | 5 | #include "dunpopup.h" |
6 | 6 | ||
7 | #include "stdpopups.h" | 7 | #include "stdpopups.h" |
8 | 8 | ||
9 | extern "C" { | 9 | extern "C" { |
10 | 10 | ||
11 | QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { | 11 | QPopupMenu* newRfcComPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { |
12 | return new OpieTooth::RfcCommPopup(/* servive, item*/ ); // fix spellin RfComm vs. RfcComm and paramaters | 12 | return new OpieTooth::RfcCommPopup(/* servive,*/ item ); // fix spellin RfComm vs. RfcComm and paramaters |
13 | //return 0l; | 13 | //return 0l; |
14 | } | 14 | } |
15 | QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) { | 15 | QPopupMenu* newObexPushPopup( const OpieTooth::Services&, OpieTooth::BTDeviceItem* ) { |
16 | return new OpieTooth::ObexPopup(); | 16 | return new OpieTooth::ObexPopup(); |
17 | } | 17 | } |
18 | QPopupMenu* newPanPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { | 18 | QPopupMenu* newPanPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { |
19 | return new OpieTooth::PanPopup( item ); | 19 | return new OpieTooth::PanPopup( item ); |
20 | } | 20 | } |
21 | 21 | ||
22 | QPopupMenu* newDunPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { | 22 | QPopupMenu* newDunPopup( const OpieTooth::Services& service, OpieTooth::BTDeviceItem* item ) { |
23 | return new OpieTooth::DunPopup( item ); | 23 | return new OpieTooth::DunPopup( item ); |
24 | } | 24 | } |
25 | } | 25 | } |
26 | 26 | ||