author | korovkin <korovkin> | 2006-04-20 12:37:33 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-04-20 12:37:33 (UTC) |
commit | fce7a143353e2bdd41d878c6f0a1224e0f2a158e (patch) (side-by-side diff) | |
tree | 41fc68d13e148b8979dde51401ce160f10197a6c /noncore | |
parent | 6d3a8eaf3b92f8eec9908eed91568342fac5de1d (diff) | |
download | opie-fce7a143353e2bdd41d878c6f0a1224e0f2a158e.zip opie-fce7a143353e2bdd41d878c6f0a1224e0f2a158e.tar.gz opie-fce7a143353e2bdd41d878c6f0a1224e0f2a158e.tar.bz2 |
Added services configuration dialog.
-rw-r--r-- | noncore/net/opietooth/manager/.cvsignore | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 30 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 1 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluetoothbase.ui | 43 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/btconfhandler.cpp | 391 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/btconfhandler.h | 126 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/manager.pro | 9 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/servicesdialog.cpp | 120 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/servicesdialog.h | 30 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/servicesdialogbase.ui | 658 |
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 @@ -11,5 +11,9 @@ 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 @@ -22,6 +22,7 @@ #include "btconnectionitem.h" #include "rfcommassigndialogimpl.h" #include "forwarder.h" +#include "servicesdialog.h" #include <termios.h> #include <string.h> #include <errno.h> @@ -96,6 +97,7 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 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); @@ -127,12 +129,6 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 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); } /** @@ -253,6 +249,12 @@ void BlueBase::initGui() 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); } @@ -760,4 +762,20 @@ 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 @@ -96,6 +96,7 @@ namespace OpieTooth { 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(); 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 @@ -11,7 +11,7 @@ <rect> <x>0</x> <y>0</y> - <width>273</width> + <width>269</width> <height>368</height> </rect> </property> @@ -194,27 +194,16 @@ <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>&Edit RFCOMM Bind Table</string> - </property> - </widget> - <widget row="0" column="0" > + <widget> <class>QGroupBox</class> <property stdset="1"> <name>name</name> @@ -347,7 +336,29 @@ </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>&Edit RFCOMM Bind Table</string> + </property> + </widget> + </vbox> </widget> <widget> <class>QWidget</class> 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 @@ -8,7 +8,8 @@ HEADERS = btconnectionitem.h btdeviceitem.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 \ @@ -19,13 +20,15 @@ SOURCES = btconnectionitem.cpp btdeviceitem.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 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> |