summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 13954c5..58f97fa 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -1,781 +1,801 @@
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 "servicesdialog.h"
26#include <termios.h> 26#include <termios.h>
27#include <string.h> 27#include <string.h>
28#include <errno.h> 28#include <errno.h>
29 29
30/* OPIE */ 30/* OPIE */
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#include <qpe/resource.h> 32#include <qpe/resource.h>
33#include <qpe/config.h> 33#include <qpe/config.h>
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35#ifdef Q_WS_QWS
36#include <qpe/qcopenvelope_qws.h>
37#endif
38
35using namespace Opie::Core; 39using namespace Opie::Core;
36 40
37/* QT */ 41/* QT */
38#include <qframe.h> 42#include <qframe.h>
39#include <qlabel.h> 43#include <qlabel.h>
40#include <qpushbutton.h> 44#include <qpushbutton.h>
41#include <qlayout.h> 45#include <qlayout.h>
42#include <qvariant.h> 46#include <qvariant.h>
43#include <qimage.h> 47#include <qimage.h>
44#include <qpixmap.h> 48#include <qpixmap.h>
45#include <qtabwidget.h> 49#include <qtabwidget.h>
46#include <qscrollview.h> 50#include <qscrollview.h>
47#include <qvbox.h> 51#include <qvbox.h>
48#include <qmessagebox.h> 52#include <qmessagebox.h>
49#include <qcombobox.h> 53#include <qcombobox.h>
50#include <qcheckbox.h> 54#include <qcheckbox.h>
51#include <qlineedit.h> 55#include <qlineedit.h>
52#include <qlistview.h> 56#include <qlistview.h>
53#include <qdir.h> 57#include <qdir.h>
54#include <qpopupmenu.h> 58#include <qpopupmenu.h>
55#include <qtimer.h> 59#include <qtimer.h>
56#include <qlist.h> 60#include <qlist.h>
57#include <qfile.h> 61#include <qfile.h>
58 62
59/* STD */ 63/* STD */
60#include <remotedevice.h> 64#include <remotedevice.h>
61#include <services.h> 65#include <services.h>
62#include <stdlib.h> 66#include <stdlib.h>
63 67
64using namespace OpieTooth; 68using namespace OpieTooth;
65//Array of possible speeds of the serial port 69//Array of possible speeds of the serial port
66struct SerSpeed { 70struct SerSpeed {
67 const char* str; //string value 71 const char* str; //string value
68 int val; //value itself 72 int val; //value itself
69} speeds[] = { 73} speeds[] = {
70 { "150", B150 }, { "300", B300 }, { "600", B600 }, { "1200", B1200 }, 74 { "150", B150 }, { "300", B300 }, { "600", B600 }, { "1200", B1200 },
71 { "2400", B2400 }, { "4800", B4800 }, { "9600", B9600 }, 75 { "2400", B2400 }, { "4800", B4800 }, { "9600", B9600 },
72 { "19200", B19200 }, { "38400", B38400 }, { "57600", B57600 }, 76 { "19200", B19200 }, { "38400", B38400 }, { "57600", B57600 },
73 { "115200", B115200} 77 { "115200", B115200}
74}; 78};
75 79
76BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 80BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
77 : BluetoothBase( parent, name, fl ) 81 : BluetoothBase( parent, name, fl )
78{ 82{
79 m_localDevice = new Manager( "hci0" ); 83 m_localDevice = new Manager( "hci0" );
80 84
81 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); 85 connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
82 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); 86 connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
83 87
84 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); 88 connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) );
85 89
86 connect( devicesView, SIGNAL( clicked(QListViewItem*)), 90 connect( devicesView, SIGNAL( clicked(QListViewItem*)),
87 this, SLOT( startServiceActionClicked(QListViewItem*) ) ); 91 this, SLOT( startServiceActionClicked(QListViewItem*) ) );
88 connect( devicesView, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), 92 connect( devicesView, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
89 this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); 93 this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) );
90 connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), 94 connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ),
91 this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); 95 this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) );
92 connect( m_localDevice, SIGNAL( available(const QString&,bool) ), 96 connect( m_localDevice, SIGNAL( available(const QString&,bool) ),
93 this, SLOT( deviceActive(const QString&,bool) ) ); 97 this, SLOT( deviceActive(const QString&,bool) ) );
94 connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), 98 connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ),
95 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); 99 this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) );
96 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), 100 connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ),
97 this, SLOT( addSignalStrength(const QString&,const QString&) ) ); 101 this, SLOT( addSignalStrength(const QString&,const QString&) ) );
98 connect(runButton, SIGNAL(clicked()), this, SLOT(doForward())); 102 connect(runButton, SIGNAL(clicked()), this, SLOT(doForward()));
99 connect(encCheckBox, SIGNAL(toggled(bool)), this, SLOT(doEncrypt(bool))); 103 connect(encCheckBox, SIGNAL(toggled(bool)), this, SLOT(doEncrypt(bool)));
100 connect(servicesEditButton, SIGNAL(clicked()), this, SLOT(editServices())); 104 connect(servicesEditButton, SIGNAL(clicked()), this, SLOT(editServices()));
101 105
102 // let hold be rightButtonClicked() 106 // let hold be rightButtonClicked()
103 QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); 107 QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold);
104 QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold); 108 QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold);
105 109
106 //Load all icons needed 110 //Load all icons needed
107 m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); 111 m_offPix = Resource::loadPixmap( "opietooth/notconnected" );
108 m_onPix = Resource::loadPixmap( "opietooth/connected" ); 112 m_onPix = Resource::loadPixmap( "opietooth/connected" );
109 m_findPix = Resource::loadPixmap( "opietooth/find" ); 113 m_findPix = Resource::loadPixmap( "opietooth/find" );
110 114
111 QPalette pal = this->palette(); 115 QPalette pal = this->palette();
112 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 116 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
113 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 117 pal.setColor( QPalette::Active, QColorGroup::Button, col );
114 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 118 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
115 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 119 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
116 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 120 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
117 this->setPalette( pal ); 121 this->setPalette( pal );
118 122
119 setCaption( tr( "Bluetooth Manager" ) ); 123 setCaption( tr( "Bluetooth Manager" ) );
120 124
121 readConfig(); 125 readConfig();
122 initGui(); 126 initGui();
123 127
124 devicesView->setRootIsDecorated(true); 128 devicesView->setRootIsDecorated(true);
125 m_iconLoader = new BTIconLoader(); 129 m_iconLoader = new BTIconLoader();
126 writeToHciConfig(); 130 writeToHciConfig();
127 addConnectedDevices(); 131 addConnectedDevices();
128 readSavedDevices(); 132 readSavedDevices();
129 addServicesToDevices(); 133 addServicesToDevices();
130 QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) ); 134 QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) );
131 forwarder = NULL; 135 forwarder = NULL;
132} 136}
133 137
134/** 138/**
135 * Reads all options from the config file 139 * Reads all options from the config file
136 */ 140 */
137void BlueBase::readConfig() 141void BlueBase::readConfig()
138{ 142{
139 143
140 Config cfg( "bluetoothmanager" ); 144 Config cfg( "bluetoothmanager" );
141 cfg.setGroup( "bluezsettings" ); 145 cfg.setGroup( "bluezsettings" );
142 146
143 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with 147 m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
144 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak 148 m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
145 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); 149 m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE );
146 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); 150 m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE );
147 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); 151 m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE );
148 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE ); 152 m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE );
149} 153}
150 154
151/** 155/**
152 * Writes all options to the config file 156 * Writes all options to the config file
153 */ 157 */
154void BlueBase::writeConfig() 158void BlueBase::writeConfig()
155{ 159{
156 160
157 Config cfg( "bluetoothmanager" ); 161 Config cfg( "bluetoothmanager" );
158 cfg.setGroup( "bluezsettings" ); 162 cfg.setGroup( "bluezsettings" );
159 163
160 cfg.writeEntry( "name" , m_deviceName ); 164 cfg.writeEntry( "name" , m_deviceName );
161 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey ); 165 cfg.writeEntryCrypt( "passkey" , m_defaultPasskey );
162 cfg.writeEntry( "useEncryption" , m_useEncryption ); 166 cfg.writeEntry( "useEncryption" , m_useEncryption );
163 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification ); 167 cfg.writeEntry( "enableAuthentification" , m_enableAuthentification );
164 cfg.writeEntry( "enablePagescan" , m_enablePagescan ); 168 cfg.writeEntry( "enablePagescan" , m_enablePagescan );
165 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan ); 169 cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan );
166 170
167 writeToHciConfig(); 171 writeToHciConfig();
168} 172}
169 173
170/** 174/**
171 * Modify the hcid.conf file to our needs 175 * Modify the hcid.conf file to our needs
172 */ 176 */
173void BlueBase::writeToHciConfig() 177void BlueBase::writeToHciConfig()
174{ 178{
175 QFile pinFile("/etc/bluetooth/pin"); // /etc/bluetooth/pin file 179 QFile pinFile("/etc/bluetooth/pin"); // /etc/bluetooth/pin file
176 owarn << "writeToHciConfig" << oendl; 180 owarn << "writeToHciConfig" << oendl;
177 //Write /etc/bluetooth/hcid.conf file 181 //Write /etc/bluetooth/hcid.conf file
178 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" ); 182 HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
179 hciconf.load(); 183 hciconf.load();
180 hciconf.setPinHelper( QPEApplication::qpeDir() + "bin/bluepin" ); 184 hciconf.setPinHelper( QPEApplication::qpeDir() + "bin/bluepin" );
181 hciconf.setName( m_deviceName ); 185 hciconf.setName( m_deviceName );
182 hciconf.setEncrypt( m_useEncryption ); 186 hciconf.setEncrypt( m_useEncryption );
183 hciconf.setAuth( m_enableAuthentification ); 187 hciconf.setAuth( m_enableAuthentification );
184 hciconf.setPscan( m_enablePagescan ); 188 hciconf.setPscan( m_enablePagescan );
185 hciconf.setIscan( m_enableInquiryscan ); 189 hciconf.setIscan( m_enableInquiryscan );
186 hciconf.save(); 190 hciconf.save();
187 // Write /etc/bluetooth/pin (default PIN file) 191 // Write /etc/bluetooth/pin (default PIN file)
188 pinFile.open(IO_WriteOnly | IO_Truncate); 192 pinFile.open(IO_WriteOnly | IO_Truncate);
189 pinFile.writeBlock(m_defaultPasskey, m_defaultPasskey.length()); 193 pinFile.writeBlock(m_defaultPasskey, m_defaultPasskey.length());
190 pinFile.writeBlock("\n", sizeof("\n")); 194 pinFile.writeBlock("\n", sizeof("\n"));
191 pinFile.flush(); 195 pinFile.flush();
192 pinFile.close(); 196 pinFile.close();
193} 197}
194 198
195 199
196/** 200/**
197 * Read the list of already known devices 201 * Read the list of already known devices
198 */ 202 */
199void BlueBase::readSavedDevices() 203void BlueBase::readSavedDevices()
200{ 204{
201 205
202 QValueList<RemoteDevice> loadedDevices; 206 QValueList<RemoteDevice> loadedDevices;
203 DeviceHandler handler; 207 DeviceHandler handler;
204 loadedDevices = handler.load(); 208 loadedDevices = handler.load();
205 209
206 addSearchedDevices( loadedDevices ); 210 addSearchedDevices( loadedDevices );
207} 211}
208 212
209 213
210/** 214/**
211 * Write the list of already known devices 215 * Write the list of already known devices
212 */ 216 */
213void BlueBase::writeSavedDevices() 217void BlueBase::writeSavedDevices()
214{ 218{
215 QListViewItemIterator it( devicesView ); 219 QListViewItemIterator it( devicesView );
216 BTListItem* item; 220 BTListItem* item;
217 BTDeviceItem* device; 221 BTDeviceItem* device;
218 RemoteDevice::ValueList list; 222 RemoteDevice::ValueList list;
219 for ( ; it.current(); ++it ) 223 for ( ; it.current(); ++it )
220 { 224 {
221 item = (BTListItem*)it.current(); 225 item = (BTListItem*)it.current();
222 if(item->typeId() != BTListItem::Device ) 226 if(item->typeId() != BTListItem::Device )
223 continue; 227 continue;
224 device = (BTDeviceItem*)item; 228 device = (BTDeviceItem*)item;
225 229
226 list.append( device->remoteDevice() ); 230 list.append( device->remoteDevice() );
227 } 231 }
228 /* 232 /*
229 * if not empty save the List through DeviceHandler 233 * if not empty save the List through DeviceHandler
230 */ 234 */
231 if ( list.isEmpty() ) 235 if ( list.isEmpty() )
232 return; 236 return;
233 DeviceHandler handler; 237 DeviceHandler handler;
234 handler.save( list ); 238 handler.save( list );
235} 239}
236 240
237 241
238/** 242/**
239 * Set up the gui 243 * Set up the gui
240 */ 244 */
241void BlueBase::initGui() 245void BlueBase::initGui()
242{ 246{
243 StatusLabel->setText( status() ); // maybe move it to getStatus() 247 StatusLabel->setText( status() ); // maybe move it to getStatus()
244 cryptCheckBox->setChecked( m_useEncryption ); 248 cryptCheckBox->setChecked( m_useEncryption );
245 authCheckBox->setChecked( m_enableAuthentification ); 249 authCheckBox->setChecked( m_enableAuthentification );
246 pagescanCheckBox->setChecked( m_enablePagescan ); 250 pagescanCheckBox->setChecked( m_enablePagescan );
247 inquiryscanCheckBox->setChecked( m_enableInquiryscan ); 251 inquiryscanCheckBox->setChecked( m_enableInquiryscan );
248 deviceNameLine->setText( m_deviceName ); 252 deviceNameLine->setText( m_deviceName );
249 passkeyLine->setText( m_defaultPasskey ); 253 passkeyLine->setText( m_defaultPasskey );
250 // set info tab 254 // set info tab
251 setInfo(); 255 setInfo();
252 serDevName->setText(tr("/dev/ircomm0")); 256 serDevName->setText(tr("/dev/ircomm0"));
253 for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) { 257 for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) {
254 serSpeed->insertItem(speeds[i].str); 258 serSpeed->insertItem(speeds[i].str);
255 } 259 }
256 serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1); 260 serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1);
257 encCheckBox->setChecked(true); 261 encCheckBox->setChecked(true);
258} 262}
259 263
260 264
261/** 265/**
262 * Get the status informations and returns it 266 * Get the status informations and returns it
263 * @return QString the status informations gathered 267 * @return QString the status informations gathered
264 */ 268 */
265QString BlueBase::status()const 269QString BlueBase::status()const
266{ 270{
267 QString infoString = tr( "<b>Device name : </b> Ipaq" ); 271 QString infoString = tr( "<b>Device name : </b> Ipaq" );
268 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" ); 272 infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
269 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" ); 273 infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
270 274
271 return (infoString); 275 return (infoString);
272} 276}
273 277
274 278
275/** 279/**
276 * Read the current values from the gui and invoke writeConfig() 280 * Read the current values from the gui and invoke writeConfig()
277 */ 281 */
278void BlueBase::applyConfigChanges() 282void BlueBase::applyConfigChanges()
279{ 283{
280 m_deviceName = deviceNameLine->text(); 284 m_deviceName = deviceNameLine->text();
281 m_defaultPasskey = passkeyLine->text(); 285 m_defaultPasskey = passkeyLine->text();
282 m_useEncryption = cryptCheckBox->isChecked(); 286 m_useEncryption = cryptCheckBox->isChecked();
283 m_enableAuthentification = authCheckBox->isChecked(); 287 m_enableAuthentification = authCheckBox->isChecked();
284 m_enablePagescan = pagescanCheckBox->isChecked(); 288 m_enablePagescan = pagescanCheckBox->isChecked();
285 m_enableInquiryscan = inquiryscanCheckBox->isChecked(); 289 m_enableInquiryscan = inquiryscanCheckBox->isChecked();
286 290
287 writeConfig(); 291 writeConfig();
288 292
289 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") ); 293 QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
290} 294}
291 295
292/** 296/**
293 * Launch Rfcomm Bind dialog 297 * Launch Rfcomm Bind dialog
294 * 298 *
295 */ 299 */
296void BlueBase::rfcommDialog() 300void BlueBase::rfcommDialog()
297{ 301{
298 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); 302 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
299 303
300 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) 304 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted )
301 { 305 {
302 rfcommAssign.saveConfig(); 306 rfcommAssign.saveConfig();
303 } 307 }
304} 308}
305 309
306/** 310/**
307 * Add fresh found devices from scan dialog to the listing 311 * Add fresh found devices from scan dialog to the listing
308 * 312 *
309 */ 313 */
310void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) 314void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices )
311{ 315{
312 BTDeviceItem * deviceItem; 316 BTDeviceItem * deviceItem;
313 QValueList<RemoteDevice>::ConstIterator it; 317 QValueList<RemoteDevice>::ConstIterator it;
314 318
315 for( it = newDevices.begin(); it != newDevices.end() ; ++it ) 319 for( it = newDevices.begin(); it != newDevices.end() ; ++it )
316 { 320 {
317 321
318 if (find( (*it) )) // is already inserted 322 if (find( (*it) )) // is already inserted
319 continue; 323 continue;
320 324
321 deviceItem = new BTDeviceItem( devicesView , (*it) ); 325 deviceItem = new BTDeviceItem( devicesView , (*it) );
322 deviceItem->setPixmap( 1, m_findPix ); 326 deviceItem->setPixmap( 1, m_findPix );
323 deviceItem->setExpandable ( true ); 327 deviceItem->setExpandable ( true );
324 328
325 // look if device is avail. atm, async 329 // look if device is avail. atm, async
326 deviceActive( (*it) ); 330 deviceActive( (*it) );
327 } 331 }
328} 332}
329 333
330 334
331/** 335/**
332 * Action that is toggled on entrys on click 336 * Action that is toggled on entrys on click
333 */ 337 */
334void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) 338void BlueBase::startServiceActionClicked( QListViewItem */*item*/ )
335{} 339{}
336 340
337 341
338/** 342/**
339 * Action that are toggled on hold (mostly QPopups i guess) 343 * Action that are toggled on hold (mostly QPopups i guess)
340 */ 344 */
341void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) 345void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ )
342{ 346{
343 if (!item ) 347 if (!item )
344 return; 348 return;
345 349
346 QPopupMenu *menu = new QPopupMenu(); 350 QPopupMenu *menu = new QPopupMenu();
347 351
348 if ( static_cast<BTListItem*>( item )->type() == "device") 352 if ( static_cast<BTListItem*>( item )->type() == "device")
349 { 353 {
350 QPopupMenu *groups = new QPopupMenu(); 354 QPopupMenu *groups = new QPopupMenu();
351 355
352 menu->insertItem( static_cast<BTDeviceItem*>( item )->name(), 0 ); 356 menu->insertItem( static_cast<BTDeviceItem*>( item )->name(), 0 );
353 menu->insertSeparator( 1 ); 357 menu->insertSeparator( 1 );
354 menu->insertItem( tr( "&Rescan services" ), 2); 358 menu->insertItem( tr( "&Rescan services" ), 2);
355 // menu->insertItem( tr( "&Add to group" ), groups, 3); 359 // menu->insertItem( tr( "&Add to group" ), groups, 3);
356 menu->insertItem( tr( "&Delete"), 4); 360 menu->insertItem( tr( "&Delete"), 4);
357 int ret = menu->exec( point, 0); 361 int ret = menu->exec( point, 0);
358 362
359 switch(ret) 363 switch(ret)
360 { 364 {
361 case -1: 365 case -1:
362 break; 366 break;
363 case 2: 367 case 2:
364 addServicesToDevice( static_cast<BTDeviceItem*>( item ) ); 368 addServicesToDevice( static_cast<BTDeviceItem*>( item ) );
365 break; 369 break;
366 370
367 case 4: 371 case 4:
368 // deletes childs too 372 // deletes childs too
369 delete item; 373 delete item;
370 break; 374 break;
371 } 375 }
372 // delete groups; 376 // delete groups;
373 } 377 }
374 378
375 /* 379 /*
376 * We got service sensitive PopupMenus in our factory 380 * We got service sensitive PopupMenus in our factory
377 * We will create one through the factory and will insert 381 * We will create one through the factory and will insert
378 * our Separator + ShowInfo into the menu or create a new 382 * our Separator + ShowInfo into the menu or create a new
379 * one if the factory returns 0 383 * one if the factory returns 0
380 * PopupMenu deletion is kind of weird. 384 * PopupMenu deletion is kind of weird.
381 * If escaped( -1 ) or any of our items were chosen we'll 385 * If escaped( -1 ) or any of our items were chosen we'll
382 * delete the PopupMenu otherwise it's the responsibility of 386 * delete the PopupMenu otherwise it's the responsibility of
383 * the PopupMenu to delete itself 387 * the PopupMenu to delete itself
384 * 388 *
385 */ 389 */
386 else if ( ((BTListItem*)item)->type() == "service") 390 else if ( ((BTListItem*)item)->type() == "service")
387 { 391 {
388 BTServiceItem* service = (BTServiceItem*)item; 392 BTServiceItem* service = (BTServiceItem*)item;
389 QMap<int, QString> list = service->services().classIdList(); 393 QMap<int, QString> list = service->services().classIdList();
390 QMap<int, QString>::Iterator it = list.begin(); 394 QMap<int, QString>::Iterator it = list.begin();
391 QPopupMenu *popup =0l; 395 QPopupMenu *popup =0l;
392 if ( it != list.end() ) 396 if ( it != list.end() )
393 { 397 {
394 owarn << "Searching id " << it.key() << " " << it.data().latin1() << "" << oendl; 398 owarn << "Searching id " << it.key() << " " << it.data().latin1() << "" << oendl;
395 popup = m_popHelper.find( it.key(), 399 popup = m_popHelper.find( it.key(),
396 service->services(), 400 service->services(),
397 (BTDeviceItem*)service->parent() ); 401 (BTDeviceItem*)service->parent() );
398 } 402 }
399 else 403 else
400 { 404 {
401 owarn << "Empty" << oendl; 405 owarn << "Empty" << oendl;
402 } 406 }
403 407
404 if ( popup == 0l ) 408 if ( popup == 0l )
405 { 409 {
406 owarn << "factory returned 0l" << oendl; 410 owarn << "factory returned 0l" << oendl;
407 popup = new QPopupMenu(); 411 popup = new QPopupMenu();
408 } 412 }
409 int test1 = popup->insertItem( tr("Test1:"), 2); 413 int test1 = popup->insertItem( tr("Test1:"), 2);
410 414
411 int ret = popup->exec( point ); 415 int ret = popup->exec( point );
412 owarn << "returned from exec() " << oendl; 416 owarn << "returned from exec() " << oendl;
413 if ( ret == -1 ) 417 if ( ret == -1 )
414 { 418 {
415 ; 419 ;
416 } 420 }
417 else if ( ret == test1 ) 421 else if ( ret == test1 )
418 { 422 {
419 ; 423 ;
420 } 424 }
421 delete popup; 425 delete popup;
422 } 426 }
423 delete menu; 427 delete menu;
424} 428}
425 429
426 430
427void BlueBase::addServicesToDevices() 431void BlueBase::addServicesToDevices()
428{ 432{
429 odebug << "BlueBase::addServicesToDevices()" << oendl; 433 odebug << "BlueBase::addServicesToDevices()" << oendl;
430 BTDeviceItem* item = (BTDeviceItem*) devicesView->firstChild(); 434 BTDeviceItem* item = (BTDeviceItem*) devicesView->firstChild();
431 while ( item ) 435 while ( item )
432 { 436 {
433 addServicesToDevice( item ); 437 addServicesToDevice( item );
434 item = (BTDeviceItem*) static_cast<QListViewItem*>( item )->nextSibling(); 438 item = (BTDeviceItem*) static_cast<QListViewItem*>( item )->nextSibling();
435 } 439 }
436} 440}
437 441
438/** 442/**
439 * Search and display avail. services for a device (on expand from device listing) 443 * Search and display avail. services for a device (on expand from device listing)
440 * @param item the service item returned 444 * @param item the service item returned
441 */ 445 */
442void BlueBase::addServicesToDevice( BTDeviceItem * item ) 446void BlueBase::addServicesToDevice( BTDeviceItem * item )
443{ 447{
444 odebug << "BlueBase::addServicesToDevice" << oendl; 448 odebug << "BlueBase::addServicesToDevice" << oendl;
445 // row of mac adress text(3) 449 // row of mac adress text(3)
446 RemoteDevice device = item->remoteDevice(); 450 RemoteDevice device = item->remoteDevice();
447 m_deviceList.insert( item->mac() , item ); 451 m_deviceList.insert( item->mac() , item );
448 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back 452 // and some time later I get a signal foundServices( const QString& device, Services::ValueList ); back
449 m_localDevice->searchServices( device ); 453 m_localDevice->searchServices( device );
450} 454}
451 455
452 456
453/** 457/**
454 * @param device the mac address of the remote device 458 * @param device the mac address of the remote device
455 * @param servicesList the list with the service the device has. 459 * @param servicesList the list with the service the device has.
456 */ 460 */
457void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList ) 461void BlueBase::addServicesToDevice( const QString& device, Services::ValueList servicesList )
458{ 462{
459 odebug << "BlueBase::fill services list" << oendl; 463 odebug << "BlueBase::fill services list" << oendl;
460 464
461 QMap<QString,BTDeviceItem*>::Iterator it; 465 QMap<QString,BTDeviceItem*>::Iterator it;
462 BTDeviceItem* deviceItem = 0; 466 BTDeviceItem* deviceItem = 0;
463 467
464 // get the right devices which requested the search 468 // get the right devices which requested the search
465 it = m_deviceList.find( device ); 469 it = m_deviceList.find( device );
466 if( it == m_deviceList.end() ) 470 if( it == m_deviceList.end() )
467 return; 471 return;
468 deviceItem = it.data(); 472 deviceItem = it.data();
469 473
470 // remove previous entries 474 // remove previous entries
471 QList<QListViewItem> tempList; 475 QList<QListViewItem> tempList;
472 tempList.setAutoDelete( true ); 476 tempList.setAutoDelete( true );
473 QListViewItem * child = deviceItem->firstChild(); 477 QListViewItem * child = deviceItem->firstChild();
474 while( child ) 478 while( child )
475 { 479 {
476 tempList.append( child ); 480 tempList.append( child );
477 child = child->nextSibling(); 481 child = child->nextSibling();
478 } 482 }
479 tempList.clear(); 483 tempList.clear();
480 484
481 QValueList<OpieTooth::Services>::Iterator it2; 485 QValueList<OpieTooth::Services>::Iterator it2;
482 BTServiceItem* serviceItem; 486 BTServiceItem* serviceItem;
483 487
484 488
485 if (!servicesList.isEmpty() ) 489 if (!servicesList.isEmpty() )
486 { 490 {
487 // add services 491 // add services
488 QMap<int, QString> list; 492 QMap<int, QString> list;
489 QMap<int, QString>::Iterator classIt; 493 QMap<int, QString>::Iterator classIt;
490 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 ) 494 for( it2 = servicesList.begin(); it2 != servicesList.end(); ++it2 )
491 { 495 {
492 serviceItem = new BTServiceItem( deviceItem, (*it2) ); 496 serviceItem = new BTServiceItem( deviceItem, (*it2) );
493 list = (*it2).classIdList(); 497 list = (*it2).classIdList();
494 classIt = list.begin(); 498 classIt = list.begin();
495 int classId=0; 499 int classId=0;
496 if ( classIt != list.end() ) 500 if ( classIt != list.end() )
497 { 501 {
498 classId = classIt.key(); 502 classId = classIt.key();
499 } 503 }
500 504
501 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); 505 serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
502 } 506 }
503 } 507 }
504 else 508 else
505 { 509 {
506 Services s1; 510 Services s1;
507 s1.setServiceName( tr("no services found") ); 511 s1.setServiceName( tr("no services found") );
508 serviceItem = new BTServiceItem( deviceItem, s1 ); 512 serviceItem = new BTServiceItem( deviceItem, s1 );
509 } 513 }
510 // now remove them from the list 514 // now remove them from the list
511 m_deviceList.remove( it ); 515 m_deviceList.remove( it );
512} 516}
513 517
514void BlueBase::addSignalStrength() 518void BlueBase::addSignalStrength()
515{ 519{
516 520
517 QListViewItemIterator it( connectionsView ); 521 QListViewItemIterator it( connectionsView );
518 for ( ; it.current(); ++it ) 522 for ( ; it.current(); ++it )
519 { 523 {
520 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() ); 524 m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() );
521 } 525 }
522 526
523 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); 527 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) );
524} 528}
525 529
526void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) 530void BlueBase::addSignalStrength( const QString& mac, const QString& strength )
527{ 531{
528 532
529 QListViewItemIterator it( connectionsView ); 533 QListViewItemIterator it( connectionsView );
530 for ( ; it.current(); ++it ) 534 for ( ; it.current(); ++it )
531 { 535 {
532 if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) 536 if( ((BTConnectionItem*)it.current())->connection().mac() == mac )
533 { 537 {
534 ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); 538 ((BTConnectionItem*)it.current() )->setSignalStrength( strength );
535 } 539 }
536 } 540 }
537} 541}
538 542
539/** 543/**
540 * Add the existing connections (pairs) to the connections tab. 544 * Add the existing connections (pairs) to the connections tab.
541 * This one triggers the search 545 * This one triggers the search
542 */ 546 */
543void BlueBase::addConnectedDevices() 547void BlueBase::addConnectedDevices()
544{ 548{
545 m_localDevice->searchConnections(); 549 m_localDevice->searchConnections();
546 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); 550 QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) );
547} 551}
548 552
549/** 553/**
550 * This adds the found connections to the connection tab. 554 * This adds the found connections to the connection tab.
551 * @param connectionList the ValueList with all current connections 555 * @param connectionList the ValueList with all current connections
552 */ 556 */
553void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) 557void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList )
554{ 558{
555 559
556 QValueList<OpieTooth::ConnectionState>::Iterator it; 560 QValueList<OpieTooth::ConnectionState>::Iterator it;
557 BTConnectionItem * connectionItem; 561 BTConnectionItem * connectionItem;
558 562
559 if ( !connectionList.isEmpty() ) 563 if ( !connectionList.isEmpty() )
560 { 564 {
561 565
562 for (it = connectionList.begin(); it != connectionList.end(); ++it) 566 for (it = connectionList.begin(); it != connectionList.end(); ++it)
563 { 567 {
564 568
565 QListViewItemIterator it2( connectionsView ); 569 QListViewItemIterator it2( connectionsView );
566 bool found = false; 570 bool found = false;
567 for ( ; it2.current(); ++it2 ) 571 for ( ; it2.current(); ++it2 )
568 { 572 {
569 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) 573 if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() )
570 { 574 {
571 found = true; 575 found = true;
572 } 576 }
573 } 577 }
574 578
575 if ( found == false ) 579 if ( found == false )
576 { 580 {
577 connectionItem = new BTConnectionItem( connectionsView, (*it) ); 581 connectionItem = new BTConnectionItem( connectionsView, (*it) );
578 582
579 if( m_deviceList.find((*it).mac()).data() ) 583 if( m_deviceList.find((*it).mac()).data() )
580 { 584 {
581 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); 585 connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() );
582 } 586 }
583 } 587 }
584 588
585 } 589 }
586 590
587 QListViewItemIterator it2( connectionsView ); 591 QListViewItemIterator it2( connectionsView );
588 for ( ; it2.current(); ++it2 ) 592 for ( ; it2.current(); ++it2 )
589 { 593 {
590 bool found = false; 594 bool found = false;
591 for (it = connectionList.begin(); it != connectionList.end(); ++it) 595 for (it = connectionList.begin(); it != connectionList.end(); ++it)
592 { 596 {
593 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) 597 if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() )
594 { 598 {
595 found = true; 599 found = true;
596 } 600 }
597 } 601 }
598 602
599 if ( !found ) 603 if ( !found )
600 { 604 {
601 delete it2.current(); 605 delete it2.current();
602 } 606 }
603 607
604 } 608 }
605 609
606 610
607 } 611 }
608 else 612 else
609 { 613 {
610 connectionsView->clear(); 614 connectionsView->clear();
611 ConnectionState con; 615 ConnectionState con;
612 con.setMac( tr("No connections found") ); 616 con.setMac( tr("No connections found") );
613 connectionItem = new BTConnectionItem( connectionsView , con ); 617 connectionItem = new BTConnectionItem( connectionsView , con );
614 } 618 }
615 619
616 // recall connection search after some time 620 // recall connection search after some time
617 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); 621 QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) );
618} 622}
619 623
620 624
621/** 625/**
622 * Find out if a device can currently be reached 626 * Find out if a device can currently be reached
623 * @param device 627 * @param device
624 */ 628 */
625void BlueBase::deviceActive( const RemoteDevice &device ) 629void BlueBase::deviceActive( const RemoteDevice &device )
626{ 630{
627 // search by mac, async, gets a signal back 631 // search by mac, async, gets a signal back
628 // We should have a BTDeviceItem there or where does it get added to the map -zecke 632 // We should have a BTDeviceItem there or where does it get added to the map -zecke
629 m_localDevice->isAvailable( device.mac() ); 633 m_localDevice->isAvailable( device.mac() );
630} 634}
631 635
632 636
633/** 637/**
634 * The signal catcher. Set the avail. status on device. 638 * The signal catcher. Set the avail. status on device.
635 * @param device - the mac address 639 * @param device - the mac address
636 * @param connected - if it is avail. or not 640 * @param connected - if it is avail. or not
637 */ 641 */
638void BlueBase::deviceActive( const QString& device, bool connected ) 642void BlueBase::deviceActive( const QString& device, bool connected )
639{ 643{
640 odebug << "deviceActive slot" << oendl; 644 odebug << "deviceActive slot" << oendl;
641 645
642 QMap<QString,BTDeviceItem*>::Iterator it; 646 QMap<QString,BTDeviceItem*>::Iterator it;
643 647
644 it = m_deviceList.find( device ); 648 it = m_deviceList.find( device );
645 if( it == m_deviceList.end() ) 649 if( it == m_deviceList.end() )
646 return; 650 return;
647 651
648 BTDeviceItem* deviceItem = it.data(); 652 BTDeviceItem* deviceItem = it.data();
649 653
650 if ( connected ) 654 if ( connected )
651 { 655 {
652 deviceItem->setPixmap( 1, m_onPix ); 656 deviceItem->setPixmap( 1, m_onPix );
653 } 657 }
654 else 658 else
655 { 659 {
656 deviceItem->setPixmap( 1, m_offPix ); 660 deviceItem->setPixmap( 1, m_offPix );
657 } 661 }
658 m_deviceList.remove( it ); 662 m_deviceList.remove( it );
659} 663}
660 664
661 665
662/** 666/**
663 * Open the "scan for devices" dialog 667 * Open the "scan for devices" dialog
664 */ 668 */
665void BlueBase::startScan() 669void BlueBase::startScan()
666{ 670{
667 ScanDialog *scan = new ScanDialog( this, "ScanDialog", 671 ScanDialog *scan = new ScanDialog( this, "ScanDialog",
668 true, WDestructiveClose ); 672 true, WDestructiveClose );
669 QObject::connect( scan, SIGNAL( selectedDevices(const QValueList<RemoteDevice>&) ), 673 QObject::connect( scan, SIGNAL( selectedDevices(const QValueList<RemoteDevice>&) ),
670 this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) ); 674 this, SLOT( addSearchedDevices(const QValueList<RemoteDevice>&) ) );
671 675
672 QPEApplication::showDialog( scan ); 676 QPEApplication::showDialog( scan );
673} 677}
674 678
675 679
676/** 680/**
677 * Set the informations about the local device in information Tab 681 * Set the informations about the local device in information Tab
678 */ 682 */
679void BlueBase::setInfo() 683void BlueBase::setInfo()
680{ 684{
681 StatusLabel->setText( status() ); 685 StatusLabel->setText( status() );
682} 686}
683 687
684 688
685/** 689/**
686 * Decontructor 690 * Decontructor
687 */ 691 */
688BlueBase::~BlueBase() 692BlueBase::~BlueBase()
689{ 693{
690 writeSavedDevices(); 694 writeSavedDevices();
695 if (forwarder) {
696#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
697 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
698 << QPEApplication::Enable;
699#endif
700 delete forwarder;
701 forwarder = NULL;
702 }
691 delete m_iconLoader; 703 delete m_iconLoader;
692} 704}
693 705
694 706
695/** 707/**
696 * find searches the ListView for a BTDeviceItem containig 708 * find searches the ListView for a BTDeviceItem containig
697 * the same Device if found return true else false 709 * the same Device if found return true else false
698 * @param dev RemoteDevice to find 710 * @param dev RemoteDevice to find
699 * @return returns true if found 711 * @return returns true if found
700 */ 712 */
701bool BlueBase::find( const RemoteDevice& rem ) 713bool BlueBase::find( const RemoteDevice& rem )
702{ 714{
703 QListViewItemIterator it( devicesView ); 715 QListViewItemIterator it( devicesView );
704 BTListItem* item; 716 BTListItem* item;
705 BTDeviceItem* device; 717 BTDeviceItem* device;
706 for (; it.current(); ++it ) 718 for (; it.current(); ++it )
707 { 719 {
708 item = (BTListItem*) it.current(); 720 item = (BTListItem*) it.current();
709 if ( item->typeId() != BTListItem::Device ) 721 if ( item->typeId() != BTListItem::Device )
710 continue; 722 continue;
711 723
712 device = (BTDeviceItem*)item; 724 device = (BTDeviceItem*)item;
713 if ( rem.equals( device->remoteDevice() ) ) 725 if ( rem.equals( device->remoteDevice() ) )
714 return true; 726 return true;
715 } 727 }
716 return false; // not found 728 return false; // not found
717} 729}
718 730
719/** 731/**
720 * Start process of the cell phone forwarding 732 * Start process of the cell phone forwarding
721 */ 733 */
722void BlueBase::doForward() 734void BlueBase::doForward()
723{ 735{
724 if (forwarder && forwarder->isRunning()) { 736 if (forwarder && forwarder->isRunning()) {
725 runButton->setText("start gateway"); 737 runButton->setText("start gateway");
726 forwarder->stop(); 738 forwarder->stop();
727 delete forwarder; 739 delete forwarder;
728 forwarder = NULL; 740 forwarder = NULL;
729 return; 741 return;
730 } 742 }
731 QString str = serDevName->text(); 743 QString str = serDevName->text();
732 forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val); 744 forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val);
733 connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)), 745 connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)),
734 this, SLOT(forwardExited(Opie::Core::OProcess*))); 746 this, SLOT(forwardExited(Opie::Core::OProcess*)));
735 if (forwarder->start(OProcess::NotifyOnExit) < 0) { 747 if (forwarder->start(OProcess::NotifyOnExit) < 0) {
736 QMessageBox::critical(this, tr("Forwarder Error"), 748 QMessageBox::critical(this, tr("Forwarder Error"),
737 tr("Forwarder start error:") + tr(strerror(errno))); 749 tr("Forwarder start error:") + tr(strerror(errno)));
738 return; 750 return;
739 } 751 }
740 runButton->setText("stop gateway"); 752 runButton->setText("stop gateway");
753#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
754 QCopEnvelope("QPE/System", "setScreenSaverMode(int)")
755 << QPEApplication::DisableSuspend;
756#endif
741} 757}
742 758
743/** 759/**
744 * React on the process end 760 * React on the process end
745 */ 761 */
746void BlueBase::forwardExit(Opie::Core::OProcess* proc) 762void BlueBase::forwardExit(Opie::Core::OProcess* proc)
747{ 763{
764#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
765 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
766 << QPEApplication::Enable;
767#endif
748 if (proc->exitStatus() != 0) 768 if (proc->exitStatus() != 0)
749 QMessageBox::critical(this, tr("Forwarder Error"), 769 QMessageBox::critical(this, tr("Forwarder Error"),
750 tr("Forwarder start error")); 770 tr("Forwarder start error"));
751 delete proc; 771 delete proc;
752 forwarder = NULL; 772 forwarder = NULL;
753 runButton->setText("start gateway"); 773 runButton->setText("start gateway");
754} 774}
755 775
756/** 776/**
757 * Encrypt entered passkey 777 * Encrypt entered passkey
758 * doit - do encryption of the key 778 * doit - do encryption of the key
759 */ 779 */
760void BlueBase::doEncrypt(bool doit) 780void BlueBase::doEncrypt(bool doit)
761{ 781{
762 passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal); 782 passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal);
763} 783}
764 784
765/** 785/**
766 * Start services edit dialog 786 * Start services edit dialog
767 */ 787 */
768void BlueBase::editServices() 788void BlueBase::editServices()
769{ 789{
770 QString conf = "/etc/default/bluetooth"; 790 QString conf = "/etc/default/bluetooth";
771//// Use for debugging purposes 791//// Use for debugging purposes
772//// QString conf = "/mnt/net/opie/bin/bluetooth"; 792//// QString conf = "/mnt/net/opie/bin/bluetooth";
773 ServicesDialog svcEdit(conf, this, "ServicesDialog", true, 793 ServicesDialog svcEdit(conf, this, "ServicesDialog", true,
774 WStyle_ContextHelp); 794 WStyle_ContextHelp);
775 795
776 if (QPEApplication::execDialog(&svcEdit) == QDialog::Accepted) 796 if (QPEApplication::execDialog(&svcEdit) == QDialog::Accepted)
777 { 797 {
778 } 798 }
779} 799}
780 800
781//eof 801//eof