summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/bluebase.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore 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
@@ -1,48 +1,49 @@
/*
* bluebase.cpp *
* ---------------------
*
* copyright : (c) 2002 by Maximilian Reiß
* email : max.reiss@gmx.de
*
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "bluebase.h"
#include "scandialog.h"
#include "hciconfwrapper.h"
#include "devicehandler.h"
#include "btconnectionitem.h"
#include "rfcommassigndialogimpl.h"
#include "forwarder.h"
+#include "servicesdialog.h"
#include <termios.h>
#include <string.h>
#include <errno.h>
/* OPIE */
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <opie2/odebug.h>
using namespace Opie::Core;
/* QT */
#include <qframe.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qtabwidget.h>
#include <qscrollview.h>
#include <qvbox.h>
#include <qmessagebox.h>
#include <qcombobox.h>
@@ -75,85 +76,80 @@ struct SerSpeed {
BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
: BluetoothBase( parent, name, fl )
{
m_localDevice = new Manager( "hci0" );
connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) );
connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) );
connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) );
connect( devicesView, SIGNAL( clicked(QListViewItem*)),
this, SLOT( startServiceActionClicked(QListViewItem*) ) );
connect( devicesView, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) );
connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ),
this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) );
connect( m_localDevice, SIGNAL( available(const QString&,bool) ),
this, SLOT( deviceActive(const QString&,bool) ) );
connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ),
this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) );
connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ),
this, SLOT( addSignalStrength(const QString&,const QString&) ) );
connect(runButton, SIGNAL(clicked()), this, SLOT(doForward()));
connect(encCheckBox, SIGNAL(toggled(bool)), this, SLOT(doEncrypt(bool)));
+ connect(servicesEditButton, SIGNAL(clicked()), this, SLOT(editServices()));
// let hold be rightButtonClicked()
QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold);
QPEApplication::setStylusOperation( connectionsView->viewport(), QPEApplication::RightOnHold);
//Load all icons needed
m_offPix = Resource::loadPixmap( "opietooth/notconnected" );
m_onPix = Resource::loadPixmap( "opietooth/connected" );
m_findPix = Resource::loadPixmap( "opietooth/find" );
QPalette pal = this->palette();
QColor col = pal.color( QPalette::Active, QColorGroup::Background );
pal.setColor( QPalette::Active, QColorGroup::Button, col );
pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
pal.setColor( QPalette::Normal, QColorGroup::Button, col );
pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
this->setPalette( pal );
setCaption( tr( "Bluetooth Manager" ) );
readConfig();
initGui();
devicesView->setRootIsDecorated(true);
m_iconLoader = new BTIconLoader();
writeToHciConfig();
addConnectedDevices();
readSavedDevices();
addServicesToDevices();
QTimer::singleShot( 3000, this, SLOT( addServicesToDevices() ) );
forwarder = NULL;
- serDevName->setText(tr("/dev/ircomm0"));
- for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) {
- serSpeed->insertItem(speeds[i].str);
- }
- serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1);
- encCheckBox->setChecked(true);
}
/**
* Reads all options from the config file
*/
void BlueBase::readConfig()
{
Config cfg( "bluetoothmanager" );
cfg.setGroup( "bluezsettings" );
m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with
m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak
m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE );
m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE );
m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE );
m_enableInquiryscan = cfg.readBoolEntry( "enableInquiryscan" , TRUE );
}
/**
* Writes all options to the config file
*/
void BlueBase::writeConfig()
{
@@ -232,48 +228,54 @@ void BlueBase::writeSavedDevices()
/*
* if not empty save the List through DeviceHandler
*/
if ( list.isEmpty() )
return;
DeviceHandler handler;
handler.save( list );
}
/**
* Set up the gui
*/
void BlueBase::initGui()
{
StatusLabel->setText( status() ); // maybe move it to getStatus()
cryptCheckBox->setChecked( m_useEncryption );
authCheckBox->setChecked( m_enableAuthentification );
pagescanCheckBox->setChecked( m_enablePagescan );
inquiryscanCheckBox->setChecked( m_enableInquiryscan );
deviceNameLine->setText( m_deviceName );
passkeyLine->setText( m_defaultPasskey );
// set info tab
setInfo();
+ serDevName->setText(tr("/dev/ircomm0"));
+ for (unsigned int i = 0; i < (sizeof(speeds) / sizeof(speeds[0])); i++) {
+ serSpeed->insertItem(speeds[i].str);
+ }
+ serSpeed->setCurrentItem((sizeof(speeds) / sizeof(speeds[0])) - 1);
+ encCheckBox->setChecked(true);
}
/**
* Get the status informations and returns it
* @return QString the status informations gathered
*/
QString BlueBase::status()const
{
QString infoString = tr( "<b>Device name : </b> Ipaq" );
infoString += QString( "<br><b>" + tr( "MAC adress: " ) +"</b> No idea" );
infoString += QString( "<br><b>" + tr( "Class" ) + "</b> PDA" );
return (infoString);
}
/**
* Read the current values from the gui and invoke writeConfig()
*/
void BlueBase::applyConfigChanges()
{
m_deviceName = deviceNameLine->text();
m_defaultPasskey = passkeyLine->text();
@@ -739,25 +741,41 @@ void BlueBase::doForward()
}
/**
* React on the process end
*/
void BlueBase::forwardExit(Opie::Core::OProcess* proc)
{
if (proc->exitStatus() != 0)
QMessageBox::critical(this, tr("Forwarder Error"),
tr("Forwarder start error"));
delete proc;
forwarder = NULL;
runButton->setText("start gateway");
}
/**
* Encrypt entered passkey
* doit - do encryption of the key
*/
void BlueBase::doEncrypt(bool doit)
{
passkeyLine->setEchoMode((doit)? QLineEdit::Password: QLineEdit::Normal);
}
+/**
+ * Start services edit dialog
+ */
+void BlueBase::editServices()
+{
+ QString conf = "/etc/default/bluetooth";
+//// Use for debugging purposes
+//// QString conf = "/mnt/net/opie/bin/bluetooth";
+ ServicesDialog svcEdit(conf, this, "ServicesDialog", true,
+ WStyle_ContextHelp);
+
+ if (QPEApplication::execDialog(&svcEdit) == QDialog::Accepted)
+ {
+ }
+}
+
//eof