summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/.cvsignore4
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp30
-rw-r--r--noncore/net/opietooth/manager/bluebase.h1
-rw-r--r--noncore/net/opietooth/manager/bluetoothbase.ui43
-rw-r--r--noncore/net/opietooth/manager/btconfhandler.cpp391
-rw-r--r--noncore/net/opietooth/manager/btconfhandler.h126
-rw-r--r--noncore/net/opietooth/manager/manager.pro9
-rw-r--r--noncore/net/opietooth/manager/servicesdialog.cpp120
-rw-r--r--noncore/net/opietooth/manager/servicesdialog.h30
-rw-r--r--noncore/net/opietooth/manager/servicesdialogbase.ui658
10 files changed, 1387 insertions, 25 deletions
diff --git a/noncore/net/opietooth/manager/.cvsignore b/noncore/net/opietooth/manager/.cvsignore
index 019226e..ca2d996 100644
--- a/noncore/net/opietooth/manager/.cvsignore
+++ b/noncore/net/opietooth/manager/.cvsignore
@@ -1,15 +1,19 @@
Makefile
Makefile.in
bluetoothbase.cpp
bluetoothbase.h
devicedialog.cpp
devicedialog.h
moc_*
scandialog.cpp
scandialog.h
rfcommassigndialogbase.cpp
rfcommassigndialogbase.h
rfcommdialogitembase.cpp
rfcommdialogitembase.h
+servicesdialogbase.cpp
+servicesdialogbase.h
+obexftpdialogbase.cpp
+obexftpdialogbase.h
.moc*
.obj
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 @@
/*
* 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>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qlistview.h>
#include <qdir.h>
#include <qpopupmenu.h>
#include <qtimer.h>
#include <qlist.h>
#include <qfile.h>
/* STD */
#include <remotedevice.h>
#include <services.h>
#include <stdlib.h>
using namespace OpieTooth;
//Array of possible speeds of the serial port
struct SerSpeed {
const char* str; //string value
int val; //value itself
} speeds[] = {
{ "150", B150 }, { "300", B300 }, { "600", B600 }, { "1200", B1200 },
{ "2400", B2400 }, { "4800", B4800 }, { "9600", B9600 },
{ "19200", B19200 }, { "38400", B38400 }, { "57600", B57600 },
{ "115200", B115200}
};
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()
{
Config cfg( "bluetoothmanager" );
cfg.setGroup( "bluezsettings" );
cfg.writeEntry( "name" , m_deviceName );
cfg.writeEntryCrypt( "passkey" , m_defaultPasskey );
cfg.writeEntry( "useEncryption" , m_useEncryption );
cfg.writeEntry( "enableAuthentification" , m_enableAuthentification );
cfg.writeEntry( "enablePagescan" , m_enablePagescan );
cfg.writeEntry( "enableInquiryscan" , m_enableInquiryscan );
writeToHciConfig();
}
/**
* Modify the hcid.conf file to our needs
*/
void BlueBase::writeToHciConfig()
{
QFile pinFile("/etc/bluetooth/pin"); // /etc/bluetooth/pin file
owarn << "writeToHciConfig" << oendl;
//Write /etc/bluetooth/hcid.conf file
HciConfWrapper hciconf ( "/etc/bluetooth/hcid.conf" );
hciconf.load();
@@ -208,96 +204,102 @@ void BlueBase::readSavedDevices()
loadedDevices = handler.load();
addSearchedDevices( loadedDevices );
}
/**
* Write the list of already known devices
*/
void BlueBase::writeSavedDevices()
{
QListViewItemIterator it( devicesView );
BTListItem* item;
BTDeviceItem* device;
RemoteDevice::ValueList list;
for ( ; it.current(); ++it )
{
item = (BTListItem*)it.current();
if(item->typeId() != BTListItem::Device )
continue;
device = (BTDeviceItem*)item;
list.append( device->remoteDevice() );
}
/*
* 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();
m_useEncryption = cryptCheckBox->isChecked();
m_enableAuthentification = authCheckBox->isChecked();
m_enablePagescan = pagescanCheckBox->isChecked();
m_enableInquiryscan = inquiryscanCheckBox->isChecked();
writeConfig();
QMessageBox::information( this, tr("Test") , tr("Changes were applied.") );
}
/**
* Launch Rfcomm Bind dialog
*
*/
void BlueBase::rfcommDialog()
{
RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted )
{
rfcommAssign.saveConfig();
}
}
@@ -715,49 +717,65 @@ bool BlueBase::find( const RemoteDevice& rem )
}
/**
* Start process of the cell phone forwarding
*/
void BlueBase::doForward()
{
if (forwarder && forwarder->isRunning()) {
runButton->setText("start gateway");
forwarder->stop();
delete forwarder;
forwarder = NULL;
return;
}
QString str = serDevName->text();
forwarder = new SerialForwarder(str, speeds[serSpeed->currentItem()].val);
connect(forwarder, SIGNAL(processExited(Opie::Core::OProcess*)),
this, SLOT(forwardExited(Opie::Core::OProcess*)));
if (forwarder->start(OProcess::NotifyOnExit) < 0) {
QMessageBox::critical(this, tr("Forwarder Error"),
tr("Forwarder start error:") + tr(strerror(errno)));
return;
}
runButton->setText("stop gateway");
}
/**
* 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
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index 9cbea56..d3e21f4 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -51,57 +51,58 @@ namespace OpieTooth {
void startScan();
private:
bool find( const RemoteDevice& device );
void readConfig();
void writeConfig();
void readSavedDevices();
void writeSavedDevices();
void writeToHciConfig();
QString status()const;
void initGui();
void setInfo();
PopupHelper m_popHelper;
Manager *m_localDevice;
QMap<QString,BTDeviceItem*> m_deviceList;
void deviceActive( const RemoteDevice &device );
QString m_deviceName;
QString m_defaultPasskey;
bool m_useEncryption;
bool m_enableAuthentification;
bool m_enablePagescan;
bool m_enableInquiryscan;
QPixmap m_offPix;
QPixmap m_onPix;
QPixmap m_findPix;
BTIconLoader *m_iconLoader;
SerialForwarder* forwarder;
private slots:
void addSearchedDevices( const QValueList<RemoteDevice> &newDevices );
void addServicesToDevices();
void addServicesToDevice( BTDeviceItem *item );
void addServicesToDevice( const QString& device, Services::ValueList );
void addConnectedDevices();
void addConnectedDevices( ConnectionState::ValueList );
void startServiceActionClicked( QListViewItem *item );
void startServiceActionHold( QListViewItem *, const QPoint &, int );
void deviceActive( const QString& mac, bool connected );
void applyConfigChanges();
void doForward();
void doEncrypt(bool);
void forwardExit(Opie::Core::OProcess* proc);
+ void editServices();
void addSignalStrength();
void addSignalStrength( const QString& mac, const QString& strengh );
void rfcommDialog();
};
}
#endif
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui
index 5539181..350da63 100644
--- a/noncore/net/opietooth/manager/bluetoothbase.ui
+++ b/noncore/net/opietooth/manager/bluetoothbase.ui
@@ -1,62 +1,62 @@
<!DOCTYPE UI><UI>
<class>BluetoothBase</class>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>BluetoothBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>273</width>
+ <width>269</width>
<height>368</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Form1</string>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>0</number>
</property>
<widget>
<class>QTabWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Status</cstring>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Devices</string>
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
<number>4</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget>
@@ -149,117 +149,106 @@
<bool>true</bool>
</property>
</column>
<column>
<property>
<name>text</name>
<string>Connection type</string>
</property>
<property>
<name>clickable</name>
<bool>true</bool>
</property>
<property>
<name>resizeable</name>
<bool>true</bool>
</property>
</column>
<column>
<property>
<name>text</name>
<string>Signal</string>
</property>
<property>
<name>clickable</name>
<bool>true</bool>
</property>
<property>
<name>resizeable</name>
<bool>true</bool>
</property>
</column>
<property stdset="1">
<name>name</name>
<cstring>connectionsView</cstring>
</property>
</widget>
</vbox>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Config</string>
</attribute>
- <grid>
+ <vbox>
<property stdset="1">
<name>margin</name>
- <number>4</number>
+ <number>2</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
- <widget row="1" column="0" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>rfcommBindButton</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&amp;Edit RFCOMM Bind Table</string>
- </property>
- </widget>
- <widget row="0" column="0" >
+ <widget>
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>GroupBox1</cstring>
</property>
<property stdset="1">
<name>title</name>
<string>Bluetooth Basic Config</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>4</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>2</number>
</property>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>deviceNameLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Device Name</string>
</property>
</widget>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>passkeyLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Default Passkey</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QLineEdit</class>
@@ -302,97 +291,119 @@
</property>
</widget>
<widget row="4" column="0" rowspan="1" colspan="2" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>cryptCheckBox</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>enable encryption</string>
</property>
</widget>
<widget row="5" column="0" rowspan="1" colspan="2" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>pagescanCheckBox</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Enable Page scan</string>
</property>
</widget>
<widget row="6" column="0" rowspan="1" colspan="2" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>inquiryscanCheckBox</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Enable Inquiry scan</string>
</property>
</widget>
<widget row="7" column="0" rowspan="1" colspan="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>configApplyButton</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Apply</string>
</property>
</widget>
</grid>
</widget>
- </grid>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>servicesEditButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Edit Services Configuration</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rfcommBindButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;Edit RFCOMM Bind Table</string>
+ </property>
+ </widget>
+ </vbox>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Status</string>
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>0</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>StatusLabel</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Status Label</string>
</property>
</widget>
</vbox>
</widget>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Phone</string>
</attribute>
<vbox>
<property stdset="1">
<name>margin</name>
<number>4</number>
</property>
diff --git a/noncore/net/opietooth/manager/btconfhandler.cpp b/noncore/net/opietooth/manager/btconfhandler.cpp
new file mode 100644
index 0000000..0048993
--- a/dev/null
+++ b/noncore/net/opietooth/manager/btconfhandler.cpp
@@ -0,0 +1,391 @@
+/* $Id$ */
+/* Bluetooth services configuration file handler */
+/***************************************************************************
+ * *
+ * 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 "btconfhandler.h"
+#include <string.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <opie2/odebug.h>
+
+//Keywords
+static QCString k_hcidEnable("HCID_ENABLE=");
+static QCString k_hiddEnable("HIDD_ENABLE=");
+static QCString k_sdpdEnable("SDPD_ENABLE=");
+static QCString k_rfcommEnable("RFCOMM_ENABLE=");
+static QCString k_dundEnable("DUND_ENABLE=");
+static QCString k_pandEnable("PAND_ENABLE=");
+static QCString k_pandOpts("PAND_OPTIONS=");
+static QCString k_dundOpts("DUND_OPTIONS=");
+
+const struct option pandCLOpts[] = //Pand command line options
+{
+ { "listen", 0, NULL, 's' },
+ { "encrypt", 0, NULL, 'E' },
+ { "secure", 0, NULL, 'S' },
+ { "master", 0, NULL, 'M' },
+ { "nosdp", 0, NULL, 'D' },
+ { "role", 1, NULL, 'r' },
+ { "persist", 0, NULL, 'p' },
+ { "cache", 0, NULL, 'C' },
+ { NULL, 0, NULL, 0 } //Marker of the end
+};
+
+const struct option dundCLOpts[] = //Pand command line options
+{
+ { "listen", 0, NULL, 's' },
+ { "nosdp", 0, NULL, 'D' },
+ { "persist", 0, NULL, 'p' },
+ { "cache", 0, NULL, 'C' },
+ { "msdun", 0, NULL, 'X' },
+ { "channel", 1, NULL, 'P' },
+ { "pppd", 1, NULL, 'd' },
+ { NULL, 0, NULL, 0 } //Marker of the end
+};
+
+using namespace OpieTooth;
+BTConfHandler::BTConfHandler(const QString& conf): confName(conf)
+{
+ hcidEnable = false;
+ hiddEnable = false;
+ sdpdEnable = false;
+ rfcommEnable = false;
+
+ //dund parameters
+ dundEnable = false;
+ dundDisableSDP = false;
+ dundPersist = false;
+ dundPersistPeriod = "";
+ dundCache = false;
+ dundCachePeriod = "";
+ dundMsdun = false;
+ dundMsdunTimeout = "";
+ dundChannel = "1";
+ dundPPPd = false;
+ dundPPPdPath = "";
+ dundPPPdOptions = "";
+
+ //pandparameters
+ pandEnable = false;
+ pandEncrypt = false;
+ pandSecure = false;
+ pandMaster = false;
+ pandDisableSDP = false;
+ pandRole = "";
+ pandPersist = false;
+ pandPersistPeriod = "";
+ pandCache = false;
+ pandCachePeriod = "";
+
+ readConfig(confName);
+}
+
+BTConfHandler::~BTConfHandler()
+{
+}
+
+/**
+ * getBoolArg
+ * Gets boolean argument from a string str with a keyword key
+ */
+bool BTConfHandler::getBoolArg(QString& str, QCString& keyword)
+{
+ QString arg = str.mid(keyword.length(), str.length() - keyword.length());
+ return (bool)(arg == "true");
+}
+
+/**
+ * getStringArg
+ * Gets string argument from a string str with a keyword key
+ */
+QString BTConfHandler::getStringArg(QString& str, QCString& keyword)
+{
+ QString arg = str.mid(keyword.length(), str.length() - keyword.length());
+ if (arg.left(1) == "\"")
+ arg.remove(0, 1);
+ if (arg.right(1) == "\"")
+ arg.remove(arg.length() - 1, 1);
+ return arg;
+}
+
+/**
+ * parsePanParameters
+ * Function gets PAND parameters from the command line conf
+ */
+void BTConfHandler::parsePanParameters(const QString& conf)
+{
+ int i; //just an index variable
+ int argc;
+ QStringList panList = QStringList::split(" ", conf);
+ argc = panList.count();
+ char* argv[argc + 1];
+ int shOpt;
+ i = 1;
+ optind = 0;
+ argv[0] = strdup("pand");
+ for (QStringList::Iterator arg = panList.begin();
+ arg != panList.end() && i < argc + 1; arg++, i++) {
+ argv[i] = strdup((*arg));
+ }
+ do {
+ shOpt = getopt_long(argc + 1, argv, "sESMDr:p:C:", pandCLOpts, NULL);
+ switch(shOpt) {
+ case 'E':
+ pandEncrypt = true;
+ break;
+ case 'S':
+ pandSecure = true;
+ break;
+ case 'M':
+ pandMaster = true;
+ break;
+ case 'D':
+ pandDisableSDP = true;
+ break;
+ case 'r':
+ if (optarg)
+ pandRole = optarg;
+ else
+ pandRole = "NG";
+ break;
+ case 'p':
+ pandPersist = true;
+ if (optarg)
+ pandPersistPeriod = optarg;
+ break;
+ case 'C':
+ pandCache = true;
+ if (optarg)
+ pandCachePeriod = optarg;
+ break;
+ case 's':
+ case '?':
+ default:
+ break;
+ }
+ } while (shOpt != -1);
+ for (i = 0; i < argc + 1; i++) {
+ free(argv[i]);
+ }
+}
+
+/**
+ * parseDunParameters
+ * Function gets PAND parameters from the command line conf
+ */
+void BTConfHandler::parseDunParameters(const QString& conf)
+{
+ int i; //just an index variable
+ int argc;
+ QStringList dunList = QStringList::split(" ", conf);
+ argc = dunList.count();
+ char* argv[argc + 1];
+ int shOpt;
+ i = 1;
+ optind = 0;
+ argv[0] = strdup("dund");
+ for (QStringList::Iterator arg = dunList.begin();
+ arg != dunList.end() && i < argc + 1; arg++, i++) {
+ argv[i] = strdup((*arg));
+ }
+ do {
+ shOpt = getopt_long(argc + 1, argv, "sDp:C:X:P:d:", dundCLOpts, NULL);
+ switch(shOpt) {
+ case 'D':
+ dundDisableSDP = true;
+ break;
+ case 'p':
+ dundPersist = true;
+ if (optarg)
+ dundPersistPeriod = optarg;
+ break;
+ case 'C':
+ dundCache = true;
+ if (optarg)
+ dundCachePeriod = optarg;
+ break;
+ case 'X':
+ dundMsdun = true;
+ if (optarg)
+ dundMsdunTimeout = optarg;
+ break;
+ case 'P':
+ if (optarg)
+ dundChannel = optarg;
+ else
+ dundChannel = "1";
+ break;
+ case 'd':
+ dundPPPd = true;
+ if (optarg)
+ dundPPPdPath = optarg;
+ break;
+ case 's':
+ case '?':
+ default:
+ break;
+ }
+ } while (shOpt != -1);
+ if (optind < argc + 1) {
+ for (i = optind; i < argc + 1; i++) {
+ if (!dundPPPdOptions.isEmpty())
+ dundPPPdOptions += " ";
+ dundPPPdOptions += argv[i];
+ }
+ }
+ for (i = 0; i < argc + 1; i++) {
+ free(argv[i]);
+ }
+}
+
+/**
+ * readConfig
+ * Reads configuration file with conf as a file name
+ * return true on success and false on failure
+ */
+bool BTConfHandler::readConfig(const QString& conf)
+{
+ QFile btConf(conf); //File we read
+ QString tmp; //temporary string
+ if (btConf.open(IO_ReadOnly)) {
+ QTextStream inStream(&btConf);
+ list = QStringList::split("\n", inStream.read(), true);
+ for (QStringList::Iterator line = list.begin();
+ line != list.end(); line++) {
+ QString tmpLine = (*line).simplifyWhiteSpace();
+ if (tmpLine.startsWith("#"))
+ continue;
+ else if (tmpLine.startsWith(k_hcidEnable))
+ hcidEnable = getBoolArg(tmpLine, k_hcidEnable);
+ else if (tmpLine.startsWith(k_hiddEnable))
+ hiddEnable = getBoolArg(tmpLine, k_hiddEnable);
+ else if (tmpLine.startsWith(k_sdpdEnable))
+ sdpdEnable = getBoolArg(tmpLine, k_sdpdEnable);
+ else if (tmpLine.startsWith(k_rfcommEnable))
+ rfcommEnable = getBoolArg(tmpLine, k_rfcommEnable);
+ else if (tmpLine.startsWith(k_dundEnable))
+ dundEnable = getBoolArg(tmpLine, k_dundEnable);
+ else if (tmpLine.startsWith(k_pandEnable))
+ pandEnable = getBoolArg(tmpLine, k_pandEnable);
+ else if (tmpLine.startsWith(k_pandOpts)) {
+ tmp = getStringArg(tmpLine, k_pandOpts);
+ parsePanParameters(tmp);
+ }
+ else if (tmpLine.startsWith(k_dundOpts)) {
+ tmp = getStringArg(tmpLine, k_dundOpts);
+ parseDunParameters(tmp);
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+/**
+ * writeConfig
+ * Writes configuration file with conf as a file name
+ * return true on success and false on failure
+ */
+bool BTConfHandler::saveConfig()
+{
+ QFile btConf(confName); //File we read
+ if (!btConf.open(IO_WriteOnly))
+ return false;
+ QTextStream stream(&btConf);
+ for (QStringList::Iterator line = list.begin();
+ line != list.end(); line++) {
+ QString tmpLine = (*line).simplifyWhiteSpace();
+ if (tmpLine.startsWith(k_hcidEnable))
+ (*line) = k_hcidEnable + ((hcidEnable)? "true": "false");
+ else if (tmpLine.startsWith(k_hiddEnable))
+ (*line) = k_hiddEnable + ((hiddEnable)? "true": "false");
+ else if (tmpLine.startsWith(k_sdpdEnable))
+ (*line) = k_sdpdEnable + ((sdpdEnable)? "true": "false");
+ else if (tmpLine.startsWith(k_rfcommEnable))
+ (*line) = k_rfcommEnable + ((rfcommEnable)? "true": "false");
+ else if (tmpLine.startsWith(k_dundEnable))
+ (*line) = k_dundEnable + ((dundEnable)? "true": "false");
+ else if (tmpLine.startsWith(k_pandEnable))
+ (*line) = k_pandEnable + ((pandEnable)? "true": "false");
+ else if (tmpLine.startsWith(k_pandOpts)) {
+ (*line) = k_pandOpts + "\"--listen";
+ (*line) += " --role " + pandRole;
+ if (pandEncrypt)
+ (*line) += " --encrypt";
+ if (pandSecure)
+ (*line) += " --secure";
+ if (pandMaster)
+ (*line) += " --master";
+ if (pandDisableSDP)
+ (*line) += " --nosdp";
+ if (pandPersist) {
+ if (pandPersistPeriod.isEmpty())
+ (*line) += " --persist";
+ else {
+ (*line) += " -p ";
+ (*line) += pandPersistPeriod;
+ }
+ }
+ if (pandCache) {
+ if (pandCachePeriod.isEmpty())
+ (*line) += " --cache";
+ else {
+ (*line) += " -C ";
+ (*line) += pandCachePeriod;
+ }
+ }
+ (*line) += "\"";
+ }
+ else if (tmpLine.startsWith(k_dundOpts)) {
+ (*line) = k_dundOpts + "\"--listen";
+ (*line) += " --channel " + dundChannel;
+ if (dundDisableSDP)
+ (*line) += " --nosdp";
+ if (dundPersist) {
+ if (dundPersistPeriod.isEmpty())
+ (*line) += " --persist";
+ else {
+ (*line) += " -p ";
+ (*line) += dundPersistPeriod;
+ }
+ }
+ if (dundCache) {
+ if (dundCachePeriod.isEmpty())
+ (*line) += " --cache";
+ else {
+ (*line) += " -C ";
+ (*line) += dundCachePeriod;
+ }
+ }
+ if (dundPPPd)
+ (*line) += " --pppd " + dundPPPdPath;
+ if (dundMsdun) {
+ if (dundMsdunTimeout.isEmpty())
+ (*line) += " --msdun";
+ else {
+ (*line) += " -X ";
+ (*line) += dundMsdunTimeout;
+ }
+ }
+ if (!dundPPPdOptions.isEmpty()) {
+ (*line) += " ";
+ (*line) += dundPPPdOptions;
+ }
+ (*line) += "\"";
+ }
+ stream << (*line) << endl;
+ }
+ return true;
+}
+
+//eof
diff --git a/noncore/net/opietooth/manager/btconfhandler.h b/noncore/net/opietooth/manager/btconfhandler.h
new file mode 100644
index 0000000..5638d00
--- a/dev/null
+++ b/noncore/net/opietooth/manager/btconfhandler.h
@@ -0,0 +1,126 @@
+/* $Id$ */
+/* Bluetooth services configuration file handler */
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+#ifndef _BTCONFHANDLER_H_
+#define _BTCONFHANDLER_H_
+#include <qstring.h>
+#include <qstringlist.h>
+
+namespace OpieTooth {
+ class BTConfHandler {
+ public:
+ BTConfHandler(const QString& conf);
+ ~BTConfHandler();
+ bool saveConfig();
+
+ bool getHcidEnable() { return hcidEnable; }
+ void setHcidEnable(bool arg) { hcidEnable = arg; }
+
+ bool getHiddEnable() { return hiddEnable; }
+ void setHiddEnable(bool arg) { hiddEnable = arg; }
+
+ bool getSdpdEnable() { return sdpdEnable; }
+ void setSdpdEnable(bool arg) { sdpdEnable = arg; }
+
+ bool getRfcommEnable() { return rfcommEnable; }
+ void setRfcommEnable(bool arg) { rfcommEnable = arg; }
+
+ //DUND parameter
+ bool getDundEnable() { return dundEnable; }
+ void setDundEnable(bool arg) { dundEnable = arg; }
+ bool getDunDisableSDP() { return dundDisableSDP; }
+ void setDunDisableSDP(bool arg) { dundDisableSDP = arg; }
+ bool getDunPersist() { return dundPersist; }
+ void setDunPersist(bool arg) { dundPersist = arg; }
+ QString getDunPersistPeriod() { return dundPersistPeriod; }
+ void setDunPersistPeriod(QString& arg) { dundPersistPeriod = arg; }
+ bool getDunCache() { return dundCache; }
+ void setDunCache(bool arg) { dundCache = arg; }
+ QString getDunCachePeriod() { return dundCachePeriod; }
+ void setDunCachePeriod(QString& arg) { dundCachePeriod = arg; }
+ bool getDunMsdun() { return dundMsdun; }
+ void setDunMsdun(bool arg) { dundMsdun = arg; }
+ QString getDunMsdunTimeout() { return dundMsdunTimeout; }
+ void setDunMsdunTimeout(QString& arg) { dundMsdunTimeout = arg; }
+ QString getDunChannel() { return dundChannel; }
+ void setDunChannel(QString& arg) { dundChannel = arg; }
+ bool getDunPPPd() { return dundPPPd; }
+ void setDunPPPd(bool arg) { dundPPPd = arg; }
+ QString getDunPPPdPath() { return dundPPPdPath; }
+ void setDunPPPdPath(QString& arg) { dundPPPdPath = arg; }
+ QString getDunPPPdOptions() { return dundPPPdOptions; }
+ void setDunPPPdOptions(QString& arg) { dundPPPdOptions = arg; }
+
+ //PAND parameters
+ bool getPanEnable() { return pandEnable; }
+ void setPanEnable(bool arg) { pandEnable = arg; }
+ bool getPanEncrypt() { return pandEncrypt; }
+ void setPanEncrypt(bool arg) { pandEncrypt = arg; }
+ bool getPanSecure() { return pandSecure; }
+ void setPanSecure(bool arg) { pandSecure = arg; }
+ bool getPanMaster() { return pandMaster; }
+ void setPanMaster(bool arg) { pandMaster = arg; }
+ bool getPanDisableSDP() { return pandDisableSDP; }
+ void setPanDisableSDP(bool arg) { pandDisableSDP = arg; }
+ QString getPanRole() { return pandRole; }
+ void setPanRole(QString& arg) { pandRole = arg; }
+ bool getPanPersist() { return pandPersist; }
+ void setPanPersist(bool arg) { pandPersist = arg; }
+ QString getPanPersistPeriod() { return pandPersistPeriod; }
+ void setPanPersistPeriod(QString& arg) { pandPersistPeriod = arg; }
+ bool getPanCache() { return pandCache; }
+ void setPanCache(bool arg) { pandCache = arg; }
+ QString getPanCachePeriod() { return pandCachePeriod; }
+ void setPanCachePeriod(QString& arg) { pandCachePeriod = arg; }
+
+ QString& getConfName() { return confName; }
+ protected:
+ bool getBoolArg(QString& str, QCString& keyword);
+ QString getStringArg(QString& str, QCString& keyword);
+ bool readConfig(const QString& conf);
+ void parsePanParameters(const QString& conf);
+ void parseDunParameters(const QString& conf);
+ protected:
+ bool hcidEnable;
+ bool hiddEnable;
+ bool sdpdEnable;
+ bool rfcommEnable;
+ //DUND parameters
+ bool dundEnable;
+ bool dundDisableSDP;
+ bool dundPersist;
+ QString dundPersistPeriod;
+ bool dundCache;
+ QString dundCachePeriod;
+ bool dundMsdun;
+ QString dundMsdunTimeout;
+ QString dundChannel;
+ bool dundPPPd;
+ QString dundPPPdPath;
+ QString dundPPPdOptions;
+
+ //PAND parameters
+ bool pandEnable;
+ bool pandEncrypt;
+ bool pandSecure;
+ bool pandMaster;
+ bool pandDisableSDP;
+ bool pandPersist;
+ QString pandPersistPeriod;
+ bool pandCache;
+ QString pandCachePeriod;
+ QString pandRole;
+ QStringList list; //list of strings we read from configuration file
+ QString confName; //Configuration filename
+ };
+};
+#endif
+//eof
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index dc43f40..09bd10e 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -1,42 +1,45 @@
CONFIG = qt warn_on quick-app
HEADERS = btconnectionitem.h btdeviceitem.h \
btserviceitem.h stdpopups.h \
popuphelper.h bluebase.h \
scandialog.h btlistitem.h filistitem.h \
hciconfwrapper.h bticonloader.h \
pppdialog.h dundialog.h pandialog.h \
obexdialog.h obexftpdialog.h \
rfcommassigndialogimpl.h rfcommassigndialogitem.h \
devicehandler.h rfcpopup.h obexpopup.h obexftpopup.h \
- rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h
+ rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h \
+ servicesdialog.h btconfhandler.h
SOURCES = btconnectionitem.cpp btdeviceitem.cpp \
btserviceitem.cpp filelistitem.cpp stdpopups.cpp \
popuphelper.cpp main.cpp \
bluebase.cpp scandialog.cpp \
btlistitem.cpp hciconfwrapper.cpp \
bticonloader.cpp pppdialog.cpp dundialog.cpp pandialog.cpp \
rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \
obexdialog.cpp devicehandler.cpp \
rfcpopup.cpp obexpopup.cpp obexftpopup.cpp obexftpdialog.cpp \
- rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp
+ rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp \
+ servicesdialog.cpp btconfhandler.cpp
INCLUDEPATH += $(OPIEDIR)/include
INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lbluetooth -lopietooth1 -lopiecore2 -lopieui2 -lopenobex
INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui \
- rfcommdialogitembase.ui obexftpdialogbase.ui
+ rfcommdialogitembase.ui obexftpdialogbase.ui \
+ servicesdialogbase.ui
TARGET = bluetooth-manager
include( $(OPIEDIR)/include.pro )
!isEmpty( LIBOBEXFTP_INC_DIR ) {
INCLUDEPATH += $$LIBOBEXFTP_INC_DIR
}
!isEmpty( LIBOBEXFTP_LIB_DIR ) {
LIBS += $$LIBOBEXFTP_LIB_DIR/libobexftp.a
LIBS += $$LIBOBEXFTP_LIB_DIR/libmulticobex.a
LIBS += $$LIBOBEXFTP_LIB_DIR/libbfb.a
}
diff --git a/noncore/net/opietooth/manager/servicesdialog.cpp b/noncore/net/opietooth/manager/servicesdialog.cpp
new file mode 100644
index 0000000..114c360
--- a/dev/null
+++ b/noncore/net/opietooth/manager/servicesdialog.cpp
@@ -0,0 +1,120 @@
+/* $Id$ */
+/* Bluetooth services configuration dialog */
+/***************************************************************************
+ * *
+ * 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 "servicesdialog.h"
+#include "btconfhandler.h"
+#include <opie2/odebug.h>
+#include <qstring.h>
+#include <qcheckbox.h>
+#include <qlineedit.h>
+#include <qcombobox.h>
+using namespace Opie::Core;
+
+using namespace OpieTooth;
+
+ServicesDialog::ServicesDialog(const QString& conf,
+ QWidget* parent, const char* name, bool modal, WFlags fl) :
+ ServicesDialogBase(parent, name, modal, fl),
+ cfg(conf)
+{
+ int i; //just an index
+ QString role;
+ hcidEnableCBox->setChecked(cfg.getHcidEnable());
+ hiddEnableCBox->setChecked(cfg.getHiddEnable());
+ sdpdEnableCBox->setChecked(cfg.getSdpdEnable());
+ rfcommEnableCBox->setChecked(cfg.getRfcommEnable());
+ dundEnableCBox->setChecked(cfg.getDundEnable());
+ dundDisableSDPCBox->setChecked(cfg.getDunDisableSDP());
+ dundPersistCBox->setChecked(cfg.getDunPersist());
+ dundPersistEdit->setText(cfg.getDunPersistPeriod());
+ dundCacheCBox->setChecked(cfg.getDunCache());
+ dundCacheEdit->setText(cfg.getDunCachePeriod());
+ for (i = 1; i < 32; i++)
+ dundChannelCBox->insertItem(QString::number(i));
+ role = cfg.getDunChannel();
+ for (i = 0; i < dundChannelCBox->count(); i++) {
+ if (role == dundChannelCBox->text(i)) {
+ dundChannelCBox->setCurrentItem(i);
+ break;
+ }
+ }
+ dundMsdunCBox->setChecked(cfg.getDunMsdun());
+ dundMsdunTimeoutEdit->setText(cfg.getDunMsdunTimeout());
+ dundPPPdCBox->setChecked(cfg.getDunPPPd());
+ dundPPPdPathEdit->setText(cfg.getDunPPPdPath());
+ dundPPPdOptionsEdit->setText(cfg.getDunPPPdOptions());
+
+ pandEnableCBox->setChecked(cfg.getPanEnable());
+ pandEncryptCBox->setChecked(cfg.getPanEncrypt());
+ pandSecureCBox->setChecked(cfg.getPanSecure());
+ pandMasterCBox->setChecked(cfg.getPanMaster());
+ role = cfg.getPanRole();
+ for (i = 0; i < pandRoleComboBox->count(); i++) {
+ if (role == pandRoleComboBox->text(i)) {
+ pandRoleComboBox->setCurrentItem(i);
+ break;
+ }
+ }
+ pandDisableSDPCBox->setChecked(cfg.getPanDisableSDP());
+ pandPersistCBox->setChecked(cfg.getPanPersist());
+ pandPersistEdit->setText(cfg.getPanPersistPeriod());
+ pandCacheCBox->setChecked(cfg.getPanCache());
+ pandCacheEdit->setText(cfg.getPanCachePeriod());
+}
+
+ServicesDialog::~ServicesDialog()
+{
+}
+
+void ServicesDialog::accept()
+{
+ QString tmp;
+ odebug << "save configuration" << oendl;
+ cfg.setHcidEnable(hcidEnableCBox->isChecked());
+ cfg.setHiddEnable(hiddEnableCBox->isChecked());
+ cfg.setSdpdEnable(sdpdEnableCBox->isChecked());
+ cfg.setRfcommEnable(rfcommEnableCBox->isChecked());
+ cfg.setDundEnable(dundEnableCBox->isChecked());
+ cfg.setDunDisableSDP(dundDisableSDPCBox->isChecked());
+ cfg.setDunPersist(dundPersistCBox->isChecked());
+ tmp = dundPersistEdit->text();
+ cfg.setDunPersistPeriod(tmp);
+ cfg.setDunCache(dundCacheCBox->isChecked());
+ tmp = dundCacheEdit->text();
+ cfg.setDunCachePeriod(tmp);
+ tmp = dundChannelCBox->currentText();
+ cfg.setDunChannel(tmp);
+ cfg.setDunMsdun(dundMsdunCBox->isChecked());
+ tmp = dundMsdunTimeoutEdit->text();
+ cfg.setDunMsdunTimeout(tmp);
+ cfg.setDunPPPd(dundPPPdCBox->isChecked());
+ tmp = dundPPPdPathEdit->text();
+ cfg.setDunPPPdPath(tmp);
+ tmp = dundPPPdOptionsEdit->text();
+ cfg.setDunPPPdOptions(tmp);
+
+ cfg.setPanEnable(pandEnableCBox->isChecked());
+ cfg.setPanEncrypt(pandEncryptCBox->isChecked());
+ cfg.setPanSecure(pandSecureCBox->isChecked());
+ cfg.setPanMaster(pandMasterCBox->isChecked());
+ cfg.setPanDisableSDP(pandDisableSDPCBox->isChecked());
+ tmp = pandRoleComboBox->currentText();
+ cfg.setPanRole(tmp);
+ cfg.setPanPersist(pandPersistCBox->isChecked());
+ tmp = pandPersistEdit->text();
+ cfg.setPanPersistPeriod(tmp);
+ cfg.setPanCache(pandCacheCBox->isChecked());
+ tmp = pandCacheEdit->text();
+ cfg.setPanCachePeriod(tmp);
+ cfg.saveConfig();
+ ServicesDialogBase::accept();
+}
+
+//eof
diff --git a/noncore/net/opietooth/manager/servicesdialog.h b/noncore/net/opietooth/manager/servicesdialog.h
new file mode 100644
index 0000000..b42f290
--- a/dev/null
+++ b/noncore/net/opietooth/manager/servicesdialog.h
@@ -0,0 +1,30 @@
+/* $Id$ */
+/* Bluetooth services configuration dialog */
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+#ifndef _SERVICESDIALOG_H_
+#define _SERVICESDIALOG_H_
+#include "servicesdialogbase.h"
+#include "btconfhandler.h"
+namespace OpieTooth {
+ class ServicesDialog : public ServicesDialogBase {
+ Q_OBJECT
+ public:
+ ServicesDialog(const QString& conf,
+ QWidget* parent = 0, const char* name = 0, bool modal = TRUE,
+ WFlags fl = 0);
+ ~ServicesDialog();
+ public:
+ BTConfHandler cfg; //configuration file
+ protected slots:
+ virtual void accept();
+ };
+};
+#endif
+//eof
diff --git a/noncore/net/opietooth/manager/servicesdialogbase.ui b/noncore/net/opietooth/manager/servicesdialogbase.ui
new file mode 100644
index 0000000..410e513
--- a/dev/null
+++ b/noncore/net/opietooth/manager/servicesdialogbase.ui
@@ -0,0 +1,658 @@
+<!DOCTYPE UI><UI>
+<class>ServicesDialogBase</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ServicesDialogBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>258</width>
+ <height>368</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>baseSize</name>
+ <size>
+ <width>240</width>
+ <height>320</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Configure Services</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QTabWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>servicesTab</cstring>
+ </property>
+ <property stdset="1">
+ <name>tabShape</name>
+ <enum>Rounded</enum>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>HCID</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox3</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Host Controller Interface</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>hcidEnableCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>SDPD</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox4</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Service Discovery Protocol </string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>sdpdEnableCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>HIDD</string>
+ </attribute>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox6</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Human Interface Devices</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>hiddEnableCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>RFCOMM</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox5</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>RFCOMM</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>rfcommEnableCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>DUND</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox7</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>DialUp Network</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>4</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget row="0" column="0" rowspan="1" colspan="3" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundEnableCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable</string>
+ </property>
+ </widget>
+ <widget row="1" column="3" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundCacheCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Cache</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" rowspan="1" colspan="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundPersistCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Persist</string>
+ </property>
+ </widget>
+ <widget row="1" column="2" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundPersistEdit</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="4" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundCacheEdit</cstring>
+ </property>
+ </widget>
+ <widget row="0" column="3" rowspan="1" colspan="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundDisableSDPCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Disable SDP</string>
+ </property>
+ </widget>
+ <widget row="2" column="0" rowspan="1" colspan="5" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundPPPdLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>PPPD Options:</string>
+ </property>
+ </widget>
+ <widget row="3" column="0" rowspan="1" colspan="5" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundPPPdOptionsEdit</cstring>
+ </property>
+ </widget>
+ <widget row="4" column="0" rowspan="1" colspan="5" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundPPPdCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Specify pppd path</string>
+ </property>
+ </widget>
+ <widget row="7" column="1" rowspan="1" colspan="4" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundMsdunTimeoutEdit</cstring>
+ </property>
+ </widget>
+ <widget row="7" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundMsdunLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Timeout: </string>
+ </property>
+ </widget>
+ <widget row="6" column="0" rowspan="1" colspan="5" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundMsdunCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable Microsoft dialup networking</string>
+ </property>
+ </widget>
+ <widget row="5" column="0" rowspan="1" colspan="5" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundPPPdPathEdit</cstring>
+ </property>
+ </widget>
+ <widget row="8" column="0" rowspan="1" colspan="2" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundChannelLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Channel:</string>
+ </property>
+ </widget>
+ <widget row="8" column="2" rowspan="1" colspan="3" >
+ <class>QComboBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>dundChannelCBox</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>PAND</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>0</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox6_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Personal Area Network</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>4</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget row="0" column="0" rowspan="1" colspan="3" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandEnableCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enable</string>
+ </property>
+ </widget>
+ <widget row="1" column="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandSecureCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Secure</string>
+ </property>
+ </widget>
+ <widget row="2" column="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandDisableSDPCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Disable SDP</string>
+ </property>
+ </widget>
+ <widget row="3" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandPersistCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Persist</string>
+ </property>
+ </widget>
+ <widget row="3" column="1" rowspan="1" colspan="2" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandPersistEdit</cstring>
+ </property>
+ </widget>
+ <widget row="4" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandCacheCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Cache</string>
+ </property>
+ </widget>
+ <widget row="4" column="1" rowspan="1" colspan="2" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandCacheEdit</cstring>
+ </property>
+ </widget>
+ <widget row="2" column="0" rowspan="1" colspan="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandMasterCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Master</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandEncryptCBox</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Encrypt</string>
+ </property>
+ </widget>
+ <widget row="5" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandRoleLabel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Role: </string>
+ </property>
+ </widget>
+ <widget row="5" column="1" rowspan="1" colspan="2" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>PANU</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>NAP</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>GN</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>pandRoleComboBox</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
+ </widget>
+ </vbox>
+</widget>
+</UI>