summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/bluebase.cpp
Unidiff
Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp30
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
@@ -13,24 +13,25 @@
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>
34using namespace Opie::Core; 35using namespace Opie::Core;
35 36
36/* QT */ 37/* QT */
@@ -87,24 +88,25 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
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 );
@@ -118,30 +120,24 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
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 */
141void BlueBase::readConfig() 137void 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
@@ -244,24 +240,30 @@ void BlueBase::writeSavedDevices()
244 */ 240 */
245void BlueBase::initGui() 241void 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 */
263QString BlueBase::status()const 265QString 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" );
@@ -751,13 +753,29 @@ void BlueBase::forwardExit(Opie::Core::OProcess* proc)
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 */
758void BlueBase::doEncrypt(bool doit) 760void 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 */
768void 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