From 38946b6ef966a154d979d7dd254cf463f6dadbe5 Mon Sep 17 00:00:00 2001 From: harlekin Date: Wed, 05 Jun 2002 21:51:49 +0000 Subject: update --- (limited to 'noncore/net') 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 @@ -30,16 +30,20 @@ #include #include #include +#include #include #include +#include #include +#include 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); @@ -48,14 +52,113 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) 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(){ } diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h index 29c45be..fb1844c 100644 --- a/noncore/net/opietooth/manager/bluebase.h +++ b/noncore/net/opietooth/manager/bluebase.h @@ -31,6 +31,23 @@ protected: private slots: void startScan(); + private: + void readConfig(); + void writeConfig(); + QString getStatus(); + void initGui(); + + + QString deviceName; + QString defaultPasskey; + int useEncryption; + int enableAuthentification; + int enablePagescan; + int enableInquiryscan; + + private slots: + + void applyConfigChanges(); }; diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index 61cb95f..61e2bcf 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui @@ -11,8 +11,8 @@ 0 0 - 596 - 480 + 228 + 320 @@ -44,33 +44,6 @@ title Devices - - QPushButton - - name - PushButton2 - - - geometry - - 50 - 260 - 154 - 31 - - - - sizePolicy - - 0 - 0 - - - - text - Scan for Devices - - name @@ -164,13 +137,40 @@ geometry - 8 - 3 - 240 - 140 + 0 + 0 + 230 + 230 + + QPushButton + + name + PushButton2 + + + geometry + + 40 + 231 + 154 + 30 + + + + sizePolicy + + 0 + 0 + + + + text + Scan for Devices + + QWidget @@ -219,10 +219,10 @@ geometry - 8 - 3 - 241 - 301 + 0 + 0 + 240 + 240 @@ -241,14 +241,14 @@ QLabel name - TextLabel6 + deviceNameLabel geometry 10 - 20 - 121 + 10 + 70 20 @@ -261,14 +261,14 @@ QLabel name - TextLabel7 + passkeyLabel geometry 10 50 - 120 + 80 20 @@ -281,32 +281,20 @@ QLineEdit name - LineEdit4 + passkeyLine geometry - 128 + 98 53 120 22 - - - QLineEdit - name - LineEdit5 - - - geometry - - 128 - 13 - 120 - 22 - + echoMode + Password @@ -321,7 +309,7 @@ 10 100 188 - 104 + 120 @@ -337,7 +325,7 @@ QCheckBox name - CheckBox1 + authCheckBox text @@ -348,7 +336,7 @@ QCheckBox name - CheckBox2 + cryptCheckBox text @@ -359,7 +347,7 @@ QCheckBox name - CheckBox5 + pagescanCheckBox text @@ -370,7 +358,7 @@ QCheckBox name - CheckBox6 + inquiryscanCheckBox text @@ -379,6 +367,42 @@ + + QLineEdit + + name + deviceNameLine + + + geometry + + 98 + 13 + 120 + 22 + + + + + QPushButton + + name + configApplyButton + + + geometry + + 60 + 230 + 99 + 32 + + + + text + Apply + + QWidget @@ -394,15 +418,15 @@ QLabel name - StutusLabel + StatusLabel geometry 10 10 - 240 - 300 + 220 + 250 diff --git a/noncore/net/opietooth/manager/devicedialog.ui b/noncore/net/opietooth/manager/devicedialog.ui index 121fdf0..e5750ed 100644 --- a/noncore/net/opietooth/manager/devicedialog.ui +++ b/noncore/net/opietooth/manager/devicedialog.ui @@ -1,17 +1,17 @@ -Form2 +DeviceDialog QDialog name - Form2 + DeviceDialog geometry 0 0 - 592 + 584 480 @@ -48,10 +48,10 @@ geometry - 0 - 20 + -10 + 0 240 - 290 + 320 diff --git a/noncore/net/opietooth/manager/scandialog.ui b/noncore/net/opietooth/manager/scandialog.ui index c8d018f..37847ba 100644 --- a/noncore/net/opietooth/manager/scandialog.ui +++ b/noncore/net/opietooth/manager/scandialog.ui @@ -1,17 +1,17 @@ -Form3 +ScanDialog QDialog name - Form3 + ScanDialog geometry 0 0 - 368 + 360 392 -- cgit v0.9.0.2