From fce7a143353e2bdd41d878c6f0a1224e0f2a158e Mon Sep 17 00:00:00 2001 From: korovkin Date: Thu, 20 Apr 2006 12:37:33 +0000 Subject: Added services configuration dialog. --- (limited to 'noncore/net') 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 #include #include @@ -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 @@ 0 0 - 273 + 269 368 @@ -194,27 +194,16 @@ title Config - + margin - 4 + 2 spacing 2 - - QPushButton - - name - rfcommBindButton - - - text - &Edit RFCOMM Bind Table - - - + QGroupBox name @@ -347,7 +336,29 @@ - + + QPushButton + + name + servicesEditButton + + + text + Edit Services Configuration + + + + QPushButton + + name + rfcommBindButton + + + text + &Edit RFCOMM Bind Table + + + QWidget 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 +#include +#include +#include +#include +#include +#include +#include + +//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 +#include + +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 +#include +#include +#include +#include +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 @@ + +ServicesDialogBase + + QDialog + + name + ServicesDialogBase + + + geometry + + 0 + 0 + 258 + 368 + + + + sizePolicy + + 7 + 7 + + + + baseSize + + 240 + 320 + + + + caption + Configure Services + + + layoutMargin + + + layoutSpacing + + + + margin + 0 + + + spacing + 0 + + + QTabWidget + + name + servicesTab + + + tabShape + Rounded + + + layoutMargin + + + layoutSpacing + + + QWidget + + name + tab + + + title + HCID + + + + margin + 0 + + + spacing + 0 + + + QGroupBox + + name + GroupBox3 + + + title + Host Controller Interface + + + layoutMargin + + + layoutSpacing + + + + margin + 11 + + + spacing + 6 + + + QCheckBox + + name + hcidEnableCBox + + + text + Enable + + + + + + + + QWidget + + name + tab + + + title + SDPD + + + + margin + 0 + + + spacing + 0 + + + QGroupBox + + name + GroupBox4 + + + title + Service Discovery Protocol + + + + margin + 11 + + + spacing + 6 + + + QCheckBox + + name + sdpdEnableCBox + + + text + Enable + + + + + + + + QWidget + + name + tab + + + title + HIDD + + + + margin + 0 + + + spacing + 0 + + + QGroupBox + + name + GroupBox6 + + + title + Human Interface Devices + + + + margin + 11 + + + spacing + 6 + + + QCheckBox + + name + hiddEnableCBox + + + text + Enable + + + + + + + + QWidget + + name + tab + + + title + RFCOMM + + + + margin + 0 + + + spacing + 0 + + + QGroupBox + + name + GroupBox5 + + + title + RFCOMM + + + layoutMargin + + + layoutSpacing + + + + margin + 11 + + + spacing + 6 + + + QCheckBox + + name + rfcommEnableCBox + + + text + Enable + + + + + + + + QWidget + + name + tab + + + title + DUND + + + + margin + 0 + + + spacing + 0 + + + QGroupBox + + name + GroupBox7 + + + title + DialUp Network + + + layoutMargin + + + layoutSpacing + + + + margin + 4 + + + spacing + 2 + + + QCheckBox + + name + dundEnableCBox + + + text + Enable + + + + QCheckBox + + name + dundCacheCBox + + + text + Cache + + + + QCheckBox + + name + dundPersistCBox + + + text + Persist + + + + QLineEdit + + name + dundPersistEdit + + + + QLineEdit + + name + dundCacheEdit + + + + QCheckBox + + name + dundDisableSDPCBox + + + text + Disable SDP + + + + QLabel + + name + dundPPPdLabel + + + text + PPPD Options: + + + + QLineEdit + + name + dundPPPdOptionsEdit + + + + QCheckBox + + name + dundPPPdCBox + + + text + Specify pppd path + + + + QLineEdit + + name + dundMsdunTimeoutEdit + + + + QLabel + + name + dundMsdunLabel + + + text + Timeout: + + + + QCheckBox + + name + dundMsdunCBox + + + text + Enable Microsoft dialup networking + + + + QLineEdit + + name + dundPPPdPathEdit + + + + QLabel + + name + dundChannelLabel + + + text + Channel: + + + + QComboBox + + name + dundChannelCBox + + + + + + + + QWidget + + name + tab + + + title + PAND + + + + margin + 0 + + + spacing + 0 + + + QGroupBox + + name + GroupBox6_2 + + + title + Personal Area Network + + + layoutMargin + + + layoutSpacing + + + + margin + 4 + + + spacing + 2 + + + QCheckBox + + name + pandEnableCBox + + + text + Enable + + + + QCheckBox + + name + pandSecureCBox + + + text + Secure + + + + QCheckBox + + name + pandDisableSDPCBox + + + text + Disable SDP + + + + QCheckBox + + name + pandPersistCBox + + + text + Persist + + + + QLineEdit + + name + pandPersistEdit + + + + QCheckBox + + name + pandCacheCBox + + + text + Cache + + + + QLineEdit + + name + pandCacheEdit + + + + QCheckBox + + name + pandMasterCBox + + + text + Master + + + + QCheckBox + + name + pandEncryptCBox + + + text + Encrypt + + + + QLabel + + name + pandRoleLabel + + + text + Role: + + + + QComboBox + + + text + PANU + + + + + text + NAP + + + + + text + GN + + + + name + pandRoleComboBox + + + + + + + + + + -- cgit v0.9.0.2