Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 105 |
1 files changed, 104 insertions, 1 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index c17271f..3d446f0 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -21,42 +21,145 @@ #include <qframe.h> #include <qlabel.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qwhatsthis.h> #include <qimage.h> #include <qpixmap.h> #include <qtabwidget.h> #include <qscrollview.h> #include <qvbox.h> +#include <qmessagebox.h> #include <qapplication.h> #include <qcheckbox.h> +#include <qlineedit.h> #include <qpe/resource.h> +#include <qpe/config.h> BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) : BluetoothBase( parent, name, fl ) { QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); + QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); 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); + + readConfig(); + initGui(); +} + +/** + * Reads all options from the config file + */ +void BlueBase::readConfig() { + + Config cfg("bluetoothmanager"); + cfg.setGroup("bluezsettings"); + + + deviceName = cfg.readEntry("name", "No name"); // name the device should identify with + defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak + useEncryption = cfg.readNumEntry("useEncryption", 1); + enableAuthentification = cfg.readNumEntry("enableAuthentification", 1); + enablePagescan = cfg.readNumEntry("enablePagescan",1); + enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1); + +} + +/** + * Writes all options to the config file + */ +void BlueBase::writeConfig() { + + + Config cfg("bluetoothmanager"); + cfg.setGroup("bluezsettings"); + + + cfg.writeEntry("name", deviceName); + cfg.writeEntryCrypt("passkey", defaultPasskey); + cfg.writeEntry("useEncryption", useEncryption); + cfg.writeEntry("enableAuthentification", enableAuthentification); + cfg.writeEntry("enablePagescan",enablePagescan); + cfg.writeEntry("enableInquiryscan", enableInquiryscan); + + +} + + +/** + * Set up the gui + */ +void BlueBase::initGui() { + + StatusLabel->setText(getStatus()); // maybe move it to getStatus() + + cryptCheckBox->setChecked(useEncryption); + authCheckBox->setChecked(enableAuthentification); + pagescanCheckBox->setChecked(enablePagescan); + inquiryscanCheckBox->setChecked(enableInquiryscan); + deviceNameLine->setText(deviceName); + passkeyLine->setText(defaultPasskey); + +} + + +/** + * Get the status informations and returns it + * @return QString the status informations gathered + */ +QString BlueBase::getStatus(){ + + return ("manger.h need also a status method"); + +} + + +/** + * Read the current values from the gui and invoke writeConfig() + */ +void BlueBase::applyConfigChanges() { + + deviceName = deviceNameLine->text(); + defaultPasskey = passkeyLine->text(); + useEncryption = cryptCheckBox->isChecked(); + enableAuthentification = authCheckBox->isChecked(); + enablePagescan = pagescanCheckBox->isChecked(); + enableInquiryscan = inquiryscanCheckBox->isChecked(); + + writeConfig(); + + QMessageBox* box = new QMessageBox(this, "Test"); + box->setText(tr("Changes applied")); + box->show(); + + // falls nötig hcid killhupen - die funktionalität adden + + } +/** + * Open the "scan for devices" dialog + */ void BlueBase::startScan() { - Form3 *scan = new Form3( this, "", true); + ScanDialog *scan = new ScanDialog( this, "", true); scan->exec(); } +/** + * Decontructor + */ BlueBase::~BlueBase(){ } |