summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/bluebase.cpp
Unidiff
Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp21
1 files changed, 19 insertions, 2 deletions
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
@@ -11,24 +11,25 @@
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>
@@ -50,25 +51,27 @@
50#include <qpe/config.h> 51#include <qpe/config.h>
51 52
52 53
53using namespace OpieTooth; 54using namespace OpieTooth;
54 55
55BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 56BlueBase::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 ) ) );
@@ -213,47 +216,61 @@ void BlueBase::initGui() {
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 */
222QString BlueBase::status()const{ 225QString 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 */
234void BlueBase::applyConfigChanges() { 237void 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 */
254void 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 */
251void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { 268void 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