Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 924d191..13954c5 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -1,183 +1,179 @@ | |||
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 | #include "rfcommassigndialogimpl.h" |
24 | #include "forwarder.h" | 24 | #include "forwarder.h" |
25 | #include "servicesdialog.h" | ||
25 | #include <termios.h> | 26 | #include <termios.h> |
26 | #include <string.h> | 27 | #include <string.h> |
27 | #include <errno.h> | 28 | #include <errno.h> |
28 | 29 | ||
29 | /* OPIE */ | 30 | /* OPIE */ |
30 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
31 | #include <qpe/resource.h> | 32 | #include <qpe/resource.h> |
32 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
33 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
34 | using namespace Opie::Core; | 35 | using namespace Opie::Core; |
35 | 36 | ||
36 | /* QT */ | 37 | /* QT */ |
37 | #include <qframe.h> | 38 | #include <qframe.h> |
38 | #include <qlabel.h> | 39 | #include <qlabel.h> |
39 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
40 | #include <qlayout.h> | 41 | #include <qlayout.h> |
41 | #include <qvariant.h> | 42 | #include <qvariant.h> |
42 | #include <qimage.h> | 43 | #include <qimage.h> |
43 | #include <qpixmap.h> | 44 | #include <qpixmap.h> |
44 | #include <qtabwidget.h> | 45 | #include <qtabwidget.h> |
45 | #include <qscrollview.h> | 46 | #include <qscrollview.h> |
46 | #include <qvbox.h> | 47 | #include <qvbox.h> |
47 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
48 | #include <qcombobox.h> | 49 | #include <qcombobox.h> |
49 | #include <qcheckbox.h> | 50 | #include <qcheckbox.h> |
50 | #include <qlineedit.h> | 51 | #include <qlineedit.h> |
51 | #include <qlistview.h> | 52 | #include <qlistview.h> |
52 | #include <qdir.h> | 53 | #include <qdir.h> |
53 | #include <qpopupmenu.h> | 54 | #include <qpopupmenu.h> |
54 | #include <qtimer.h> | 55 | #include <qtimer.h> |
55 | #include <qlist.h> | 56 | #include <qlist.h> |
56 | #include <qfile.h> | 57 | #include <qfile.h> |
57 | 58 | ||
58 | /* STD */ | 59 | /* STD */ |
59 | #include <remotedevice.h> | 60 | #include <remotedevice.h> |
60 | #include <services.h> | 61 | #include <services.h> |
61 | #include <stdlib.h> | 62 | #include <stdlib.h> |
62 | 63 | ||
63 | using namespace OpieTooth; | 64 | using namespace OpieTooth; |
64 | //Array of possible speeds of the serial port | 65 | //Array of possible speeds of the serial port |
65 | struct SerSpeed { | 66 | struct SerSpeed { |
66 | const char* str; //string value | 67 | const char* str; //string value |
67 | int val; //value itself | 68 | int val; //value itself |
68 | } speeds[] = { | 69 | } speeds[] = { |
69 | { "150", B150 }, { "300", B300 }, { "600", B600 }, { "1200", B1200 }, | 70 | { "150", B150 }, { "300", B300 }, { "600", B600 }, { "1200", B1200 }, |
70 | { "2400", B2400 }, { "4800", B4800 }, { "9600", B9600 }, | 71 | { "2400", B2400 }, { "4800", B4800 }, { "9600", B9600 }, |
71 | { "19200", B19200 }, { "38400", B38400 }, { "57600", B57600 }, | 72 | { "19200", B19200 }, { "38400", B38400 }, { "57600", B57600 }, |
72 | { "115200", B115200} | 73 | { "115200", B115200} |
73 | }; | 74 | }; |
74 | 75 | ||
75 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 76 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
76 | : BluetoothBase( parent, name, fl ) | 77 | : BluetoothBase( parent, name, fl ) |
77 | { | 78 | { |
78 | m_localDevice = new Manager( "hci0" ); | 79 | m_localDevice = new Manager( "hci0" ); |
79 | 80 | ||
80 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); | 81 | connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); |
81 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); | 82 | connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); |
82 | 83 | ||
83 | connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); | 84 | connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); |
84 | 85 | ||
85 | connect( devicesView, SIGNAL( clicked(QListViewItem*)), | 86 | connect( devicesView, SIGNAL( clicked(QListViewItem*)), |
86 | this, SLOT( startServiceActionClicked(QListViewItem*) ) ); | 87 | this, SLOT( startServiceActionClicked(QListViewItem*) ) ); |
87 | connect( devicesView, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), | 88 | connect( devicesView, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), |
88 | this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); | 89 | this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); |
89 | connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), | 90 | connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), |
90 | this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); | 91 | this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); |
91 | connect( m_localDevice, SIGNAL( available(const QString&,bool) ), | 92 | connect( m_localDevice, SIGNAL( available(const QString&,bool) ), |
92 | this, SLOT( deviceActive(const QString&,bool) ) ); | 93 | this, SLOT( deviceActive(const QString&,bool) ) ); |
93 | connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), | 94 | connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), |
94 | this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); | 95 | this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); |
95 | connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), | 96 | connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), |
96 | this, SLOT( addSignalStrength(const QString&,const QString&) ) ); | 97 | this, SLOT( addSignalStrength(const QString&,const QString&) ) ); |
97 | connect(runButton, SIGNAL(clicked()), this, SLOT(doForward())); | 98 | connect(runButton, SIGNAL(clicked()), this, SLOT(doForward())); |
98 | connect(encCheckBox, SIGNAL(toggled(bool)), this, SLOT(doEncrypt(bool))); | 99 | connect(encCheckBox, SIGNAL(toggled(bool)), this, SLOT(doEncrypt(bool))); |
100 | connect(servicesEditButton, SIGNAL(clicked()), this, SLOT(editServices())); | ||
99 | 101 | ||
100 | // let hold be rightButtonClicked() | 102 | // let hold be rightButtonClicked() |
101 | QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); | 103 | QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); |
102 | QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold); | 104 | QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold); |
103 | 105 | ||
104 | //Load all icons needed | 106 | //Load all icons needed |
105 | m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); | 107 | m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); |
106 | m_onPix = Resource::loadPixmap( "opietooth/connected" ); | 108 | m_onPix = Resource::loadPixmap( "opietooth/connected" ); |
107 | m_findPix = Resource::loadPixmap( "opietooth/find" ); | 109 | m_findPix = Resource::loadPixmap( "opietooth/find" ); |
108 | 110 | ||
109 | QPalette pal = this->palette(); | 111 | QPalette pal = this->palette(); |
110 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); | 112 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); |
111 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); | 113 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); |
112 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); | 114 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); |
113 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); | 115 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); |
114 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); | 116 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); |
115 | this->setPalette( pal ); | 117 | this->setPalette( pal ); |
116 | 118 | ||
117 | setCaption( tr( "Bluetooth Manager" ) ); | 119 | setCaption( tr( "Bluetooth Manager" ) ); |
118 | 120 | ||
119 | readConfig(); | 121 | readConfig(); |
120 | initGui(); | 122 | initGui(); |
121 | 123 | ||
122 | devicesView->setRootIsDecorated(true); | 124 | devicesView->setRootIsDecorated(true); |
123 | m_iconLoader = new BTIconLoader(); | 125 | m_iconLoader = new BTIconLoader(); |
124 | writeToHciConfig(); | 126 | writeToHciConfig(); |
125 | addConnectedDevices(); | 127 | addConnectedDevices(); |
126 | readSavedDevices(); | 128 | readSavedDevices(); |
127 | addServicesToDevices(); | 129 | addServicesToDevices(); |
128 | QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) ); | 130 | QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) ); |
129 | forwarder = NULL; | 131 | forwarder = NULL; |
130 | serDevName->setText(tr("/dev/ircomm0")); | ||
131 | for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) { | ||
132 | serSpeed->insertItem(speeds[i].str); | ||
133 | } | ||
134 | serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1); | ||
135 | encCheckBox->setChecked(true); | ||
136 | } | 132 | } |
137 | 133 | ||
138 | /** | 134 | /** |
139 | * Reads all options from the config file | 135 | * Reads all options from the config file |
140 | */ | 136 | */ |
141 | void BlueBase::readConfig() | 137 | void BlueBase::readConfig() |
142 | { | 138 | { |
143 | 139 | ||
144 | Config cfg( "bluetoothmanager" ); | 140 | Config cfg( "bluetoothmanager" ); |
145 | cfg.setGroup( "bluezsettings" ); | 141 | cfg.setGroup( "bluezsettings" ); |
146 | 142 | ||
147 | m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with | 143 | m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with |
148 | m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak | 144 | m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak |
149 | m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); | 145 | m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); |
150 | m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); | 146 | m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); |
151 | m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); | 147 | m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); |
152 | m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); | 148 | m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); |
153 | } | 149 | } |
154 | 150 | ||
155 | /** | 151 | /** |
156 | * Writes all options to the config file | 152 | * Writes all options to the config file |
157 | */ | 153 | */ |
158 | void BlueBase::writeConfig() | 154 | void BlueBase::writeConfig() |
159 | { | 155 | { |
160 | 156 | ||
161 | Config cfg( "bluetoothmanager" ); | 157 | Config cfg( "bluetoothmanager" ); |
162 | cfg.setGroup( "bluezsettings" ); | 158 | cfg.setGroup( "bluezsettings" ); |
163 | 159 | ||
164 | cfg.writeEntry( "name" , m_deviceName ); | 160 | cfg.writeEntry( "name" , m_deviceName ); |
165 | cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); | 161 | cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); |
166 | cfg.writeEntry( "useEncryption" , m_useEncryption ); | 162 | cfg.writeEntry( "useEncryption" , m_useEncryption ); |
167 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); | 163 | cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); |
168 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); | 164 | cfg.writeEntry( "enablePagescan" , m_enablePagescan ); |
169 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); | 165 | cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); |
170 | 166 | ||
171 | writeToHciConfig(); | 167 | writeToHciConfig(); |
172 | } | 168 | } |
173 | 169 | ||
174 | /** | 170 | /** |
175 | * Modify the hcid.conf file to our needs | 171 | * Modify the hcid.conf file to our needs |
176 | */ | 172 | */ |
177 | void BlueBase::writeToHciConfig() | 173 | void BlueBase::writeToHciConfig() |
178 | { | 174 | { |
179 | QFile pinFile("/etc/bluetooth/pin"); // /etc/bluetooth/pin file | 175 | QFile pinFile("/etc/bluetooth/pin"); // /etc/bluetooth/pin file |
180 | owarn << "writeToHciConfig" << oendl; | 176 | owarn << "writeToHciConfig" << oendl; |
181 | //Write /etc/bluetooth/hcid.conf file | 177 | //Write /etc/bluetooth/hcid.conf file |
182 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); | 178 | HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); |
183 | hciconf.load(); | 179 | hciconf.load(); |
@@ -208,96 +204,102 @@ void BlueBase::readSavedDevices() | |||
208 | loadedDevices = handler.load(); | 204 | loadedDevices = handler.load(); |
209 | 205 | ||
210 | addSearchedDevices( loadedDevices ); | 206 | addSearchedDevices( loadedDevices ); |
211 | } | 207 | } |
212 | 208 | ||
213 | 209 | ||
214 | /** | 210 | /** |
215 | * Write the list of already known devices | 211 | * Write the list of already known devices |
216 | */ | 212 | */ |
217 | void BlueBase::writeSavedDevices() | 213 | void BlueBase::writeSavedDevices() |
218 | { | 214 | { |
219 | QListViewItemIterator it( devicesView ); | 215 | QListViewItemIterator it( devicesView ); |
220 | BTListItem* item; | 216 | BTListItem* item; |
221 | BTDeviceItem* device; | 217 | BTDeviceItem* device; |
222 | RemoteDevice::ValueList list; | 218 | RemoteDevice::ValueList list; |
223 | for ( ; it.current(); ++it ) | 219 | for ( ; it.current(); ++it ) |
224 | { | 220 | { |
225 | item = (BTListItem*)it.current(); | 221 | item = (BTListItem*)it.current(); |
226 | if(item->typeId() != BTListItem::Device ) | 222 | if(item->typeId() != BTListItem::Device ) |
227 | continue; | 223 | continue; |
228 | device = (BTDeviceItem*)item; | 224 | device = (BTDeviceItem*)item; |
229 | 225 | ||
230 | list.append( device->remoteDevice() ); | 226 | list.append( device->remoteDevice() ); |
231 | } | 227 | } |
232 | /* | 228 | /* |
233 | * if not empty save the List through DeviceHandler | 229 | * if not empty save the List through DeviceHandler |
234 | */ | 230 | */ |
235 | if ( list.isEmpty() ) | 231 | if ( list.isEmpty() ) |
236 | return; | 232 | return; |
237 | DeviceHandler handler; | 233 | DeviceHandler handler; |
238 | handler.save( list ); | 234 | handler.save( list ); |
239 | } | 235 | } |
240 | 236 | ||
241 | 237 | ||
242 | /** | 238 | /** |
243 | * Set up the gui | 239 | * Set up the gui |
244 | */ | 240 | */ |
245 | void BlueBase::initGui() | 241 | void BlueBase::initGui() |
246 | { | 242 | { |
247 | StatusLabel->setText( status() ); // maybe move it to getStatus() | 243 | StatusLabel->setText( status() ); // maybe move it to getStatus() |
248 | cryptCheckBox->setChecked( m_useEncryption ); | 244 | cryptCheckBox->setChecked( m_useEncryption ); |
249 | authCheckBox->setChecked( m_enableAuthentification ); | 245 | authCheckBox->setChecked( m_enableAuthentification ); |
250 | pagescanCheckBox->setChecked( m_enablePagescan ); | 246 | pagescanCheckBox->setChecked( m_enablePagescan ); |
251 | inquiryscanCheckBox->setChecked( m_enableInquiryscan ); | 247 | inquiryscanCheckBox->setChecked( m_enableInquiryscan ); |
252 | deviceNameLine->setText( m_deviceName ); | 248 | deviceNameLine->setText( m_deviceName ); |
253 | passkeyLine->setText( m_defaultPasskey ); | 249 | passkeyLine->setText( m_defaultPasskey ); |
254 | // set info tab | 250 | // set info tab |
255 | setInfo(); | 251 | setInfo(); |
252 | serDevName->setText(tr("/dev/ircomm0")); | ||
253 | for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) { | ||
254 | serSpeed->insertItem(speeds[i].str); | ||
255 | } | ||
256 | serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1); | ||
257 | encCheckBox->setChecked(true); | ||
256 | } | 258 | } |
257 | 259 | ||
258 | 260 | ||
259 | /** | 261 | /** |
260 | * Get the status informations and returns it | 262 | * Get the status informations and returns it |
261 | * @return QString the status informations gathered | 263 | * @return QString the status informations gathered |
262 | */ | 264 | */ |
263 | QString BlueBase::status()const | 265 | QString BlueBase::status()const |
264 | { | 266 | { |
265 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); | 267 | QString infoString = tr( "<b>Device name : </b> Ipaq" ); |
266 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); | 268 | infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); |
267 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); | 269 | infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); |
268 | 270 | ||
269 | return (infoString); | 271 | return (infoString); |
270 | } | 272 | } |
271 | 273 | ||
272 | 274 | ||
273 | /** | 275 | /** |
274 | * Read the current values from the gui and invoke writeConfig() | 276 | * Read the current values from the gui and invoke writeConfig() |
275 | */ | 277 | */ |
276 | void BlueBase::applyConfigChanges() | 278 | void BlueBase::applyConfigChanges() |
277 | { | 279 | { |
278 | m_deviceName = deviceNameLine->text(); | 280 | m_deviceName = deviceNameLine->text(); |
279 | m_defaultPasskey = passkeyLine->text(); | 281 | m_defaultPasskey = passkeyLine->text(); |
280 | m_useEncryption = cryptCheckBox->isChecked(); | 282 | m_useEncryption = cryptCheckBox->isChecked(); |
281 | m_enableAuthentification = authCheckBox->isChecked(); | 283 | m_enableAuthentification = authCheckBox->isChecked(); |
282 | m_enablePagescan = pagescanCheckBox->isChecked(); | 284 | m_enablePagescan = pagescanCheckBox->isChecked(); |
283 | m_enableInquiryscan = inquiryscanCheckBox->isChecked(); | 285 | m_enableInquiryscan = inquiryscanCheckBox->isChecked(); |
284 | 286 | ||
285 | writeConfig(); | 287 | writeConfig(); |
286 | 288 | ||
287 | QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); | 289 | QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); |
288 | } | 290 | } |
289 | 291 | ||
290 | /** | 292 | /** |
291 | * Launch Rfcomm Bind dialog | 293 | * Launch Rfcomm Bind dialog |
292 | * | 294 | * |
293 | */ | 295 | */ |
294 | void BlueBase::rfcommDialog() | 296 | void BlueBase::rfcommDialog() |
295 | { | 297 | { |
296 | RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); | 298 | RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); |
297 | 299 | ||
298 | if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) | 300 | if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) |
299 | { | 301 | { |
300 | rfcommAssign.saveConfig(); | 302 | rfcommAssign.saveConfig(); |
301 | } | 303 | } |
302 | } | 304 | } |
303 | 305 | ||
@@ -715,49 +717,65 @@ bool BlueBase::find( const RemoteDevice& rem ) | |||
715 | } | 717 | } |
716 | 718 | ||
717 | /** | 719 | /** |
718 | * Start process of the cell phone forwarding | 720 | * Start process of the cell phone forwarding |
719 | */ | 721 | */ |
720 | void BlueBase::doForward() | 722 | void BlueBase::doForward() |
721 | { | 723 | { |
722 | if (forwarder && forwarder->isRunning()) { | 724 | if (forwarder && forwarder->isRunning()) { |
723 | runButton->setText("start gateway"); | 725 | runButton->setText("start gateway"); |
724 | forwarder->stop(); | 726 | forwarder->stop(); |
725 | delete forwarder; | 727 | delete forwarder; |
726 | forwarder = NULL; | 728 | forwarder = NULL; |
727 | return; | 729 | return; |
728 | } | 730 | } |
729 | QString str = serDevName->text(); | 731 | QString str = serDevName->text(); |
730 | forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val); | 732 | forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val); |
731 | connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)), | 733 | connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)), |
732 | this, SLOT(forwardExited(Opie::Core::OProcess*))); | 734 | this, SLOT(forwardExited(Opie::Core::OProcess*))); |
733 | if (forwarder->start(OProcess::NotifyOnExit) < 0) { | 735 | if (forwarder->start(OProcess::NotifyOnExit) < 0) { |
734 | QMessageBox::critical(this, tr("Forwarder Error"), | 736 | QMessageBox::critical(this, tr("Forwarder Error"), |
735 | tr("Forwarder start error:") + tr(strerror(errno))); | 737 | tr("Forwarder start error:") + tr(strerror(errno))); |
736 | return; | 738 | return; |
737 | } | 739 | } |
738 | runButton->setText("stop gateway"); | 740 | runButton->setText("stop gateway"); |
739 | } | 741 | } |
740 | 742 | ||
741 | /** | 743 | /** |
742 | * React on the process end | 744 | * React on the process end |
743 | */ | 745 | */ |
744 | void BlueBase::forwardExit(Opie::Core::OProcess* proc) | 746 | void BlueBase::forwardExit(Opie::Core::OProcess* proc) |
745 | { | 747 | { |
746 | if (proc->exitStatus() != 0) | 748 | if (proc->exitStatus() != 0) |
747 | QMessageBox::critical(this, tr("Forwarder Error"), | 749 | QMessageBox::critical(this, tr("Forwarder Error"), |
748 | tr("Forwarder start error")); | 750 | tr("Forwarder start error")); |
749 | delete proc; | 751 | delete proc; |
750 | forwarder = NULL; | 752 | forwarder = NULL; |
751 | runButton->setText("start gateway"); | 753 | runButton->setText("start gateway"); |
752 | } | 754 | } |
753 | 755 | ||
754 | /** | 756 | /** |
755 | * Encrypt entered passkey | 757 | * Encrypt entered passkey |
756 | * doit - do encryption of the key | 758 | * doit - do encryption of the key |
757 | */ | 759 | */ |
758 | void BlueBase::doEncrypt(bool doit) | 760 | void BlueBase::doEncrypt(bool doit) |
759 | { | 761 | { |
760 | passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal); | 762 | passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal); |
761 | } | 763 | } |
762 | 764 | ||
765 | /** | ||
766 | * Start services edit dialog | ||
767 | */ | ||
768 | void BlueBase::editServices() | ||
769 | { | ||
770 | QString conf = "/etc/default/bluetooth"; | ||
771 | //// Use for debugging purposes | ||
772 | //// QString conf = "/mnt/net/opie/bin/bluetooth"; | ||
773 | ServicesDialog svcEdit(conf, this, "ServicesDialog", true, | ||
774 | WStyle_ContextHelp); | ||
775 | |||
776 | if (QPEApplication::execDialog(&svcEdit) == QDialog::Accepted) | ||
777 | { | ||
778 | } | ||
779 | } | ||
780 | |||
763 | //eof | 781 | //eof |