-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 105 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.h | 17 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluetoothbase.ui | 156 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/devicedialog.ui | 12 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.ui | 6 |
5 files changed, 220 insertions, 76 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 @@ -1,62 +1,165 @@ /* * bluebase.cpp * * --------------------- * * begin : Sun 10 17:20:00 CEST 2002 * 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 <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(){ } 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 @@ -1,39 +1,56 @@ #ifndef BLUEBASE_H #define BLUEBASE_H #include <qvariant.h> #include <qwidget.h> #include <qscrollview.h> #include <qsplitter.h> #include "bluetoothbase.h" class QVBox; class QHBoxLayout; class QGridLayout; class QFrame; class QLabel; class QPushButton; class QTabWidget; class QCheckBox; class BlueBase : public BluetoothBase { Q_OBJECT public: BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~BlueBase(); 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(); }; #endif 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 @@ -1,416 +1,440 @@ <!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>596</width> - <height>480</height> + <width>228</width> + <height>320</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Form1</string> </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>Status</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> <width>260</width> <height>350</height> </rect> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Devices</string> </attribute> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>PushButton2</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>50</x> - <y>260</y> - <width>154</width> - <height>31</height> - </rect> - </property> - <property stdset="1"> - <name>sizePolicy</name> - <sizepolicy> - <hsizetype>0</hsizetype> - <vsizetype>0</vsizetype> - </sizepolicy> - </property> - <property stdset="1"> - <name>text</name> - <string>Scan for Devices</string> - </property> - </widget> <spacer> <property> <name>name</name> <cstring>Spacer3</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <spacer> <property> <name>name</name> <cstring>Spacer1</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Fixed</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget> <class>QListView</class> <column> <property> <name>text</name> <string>Active</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>Device Name</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>Type</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>ListView2</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> - <x>8</x> - <y>3</y> - <width>240</width> - <height>140</height> + <x>0</x> + <y>0</y> + <width>230</width> + <height>230</height> </rect> </property> </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>PushButton2</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>40</x> + <y>231</y> + <width>154</width> + <height>30</height> + </rect> + </property> + <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> + <name>text</name> + <string>Scan for Devices</string> + </property> + </widget> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Connections</string> </attribute> <widget> <class>QListView</class> <column> <property> <name>text</name> <string>Device Name</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>Connection type</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>ListView4</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> - <x>8</x> - <y>3</y> - <width>241</width> - <height>301</height> + <x>0</x> + <y>0</y> + <width>240</width> + <height>240</height> </rect> </property> </widget> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Config</string> </attribute> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>TextLabel6</cstring> + <cstring>deviceNameLabel</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>10</x> - <y>20</y> - <width>121</width> + <y>10</y> + <width>70</width> <height>20</height> </rect> </property> <property stdset="1"> <name>text</name> <string>Device Name</string> </property> </widget> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>TextLabel7</cstring> + <cstring>passkeyLabel</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>10</x> <y>50</y> - <width>120</width> + <width>80</width> <height>20</height> </rect> </property> <property stdset="1"> <name>text</name> <string>Default Passkey</string> </property> </widget> <widget> <class>QLineEdit</class> <property stdset="1"> <name>name</name> - <cstring>LineEdit4</cstring> + <cstring>passkeyLine</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> - <x>128</x> + <x>98</x> <y>53</y> <width>120</width> <height>22</height> </rect> </property> - </widget> - <widget> - <class>QLineEdit</class> <property stdset="1"> - <name>name</name> - <cstring>LineEdit5</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>128</x> - <y>13</y> - <width>120</width> - <height>22</height> - </rect> + <name>echoMode</name> + <enum>Password</enum> </property> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout5</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>10</x> <y>100</y> <width>188</width> - <height>104</height> + <height>120</height> </rect> </property> <vbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> - <cstring>CheckBox1</cstring> + <cstring>authCheckBox</cstring> </property> <property stdset="1"> <name>text</name> <string>enable authentification</string> </property> </widget> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> - <cstring>CheckBox2</cstring> + <cstring>cryptCheckBox</cstring> </property> <property stdset="1"> <name>text</name> <string>enable encryption</string> </property> </widget> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> - <cstring>CheckBox5</cstring> + <cstring>pagescanCheckBox</cstring> </property> <property stdset="1"> <name>text</name> <string>Enable Page scan</string> </property> </widget> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> - <cstring>CheckBox6</cstring> + <cstring>inquiryscanCheckBox</cstring> </property> <property stdset="1"> <name>text</name> <string>Enable Inquiry scan</string> </property> </widget> </vbox> </widget> + <widget> + <class>QLineEdit</class> + <property stdset="1"> + <name>name</name> + <cstring>deviceNameLine</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>98</x> + <y>13</y> + <width>120</width> + <height>22</height> + </rect> + </property> + </widget> + <widget> + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>configApplyButton</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>60</x> + <y>230</y> + <width>99</width> + <height>32</height> + </rect> + </property> + <property stdset="1"> + <name>text</name> + <string>Apply</string> + </property> + </widget> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Status</string> </attribute> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>StutusLabel</cstring> + <cstring>StatusLabel</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>10</x> <y>10</y> - <width>240</width> - <height>300</height> + <width>220</width> + <height>250</height> </rect> </property> <property stdset="1"> <name>text</name> <string>Status Label</string> </property> </widget> </widget> </widget> </widget> </UI> 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,150 +1,150 @@ <!DOCTYPE UI><UI> -<class>Form2</class> +<class>DeviceDialog</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> - <cstring>Form2</cstring> + <cstring>DeviceDialog</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>592</width> + <width>584</width> <height>480</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Form2</string> </property> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel4</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> <width>170</width> <height>20</height> </rect> </property> <property stdset="1"> <name>text</name> <string>Devicename</string> </property> </widget> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>TabWidget7</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> - <x>0</x> - <y>20</y> + <x>-10</x> + <y>0</y> <width>240</width> - <height>290</height> + <height>320</height> </rect> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Services</string> </attribute> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton5</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>50</x> <y>200</y> <width>129</width> <height>31</height> </rect> </property> <property stdset="1"> <name>text</name> <string>change settings</string> </property> </widget> <widget> <class>QListView</class> <column> <property> <name>text</name> <string>active</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>service name</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>ListView1</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>10</x> <y>10</y> <width>220</width> <height>180</height> </rect> </property> </widget> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Settings</string> </attribute> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel5</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> 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,110 +1,110 @@ <!DOCTYPE UI><UI> -<class>Form3</class> +<class>ScanDialog</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> - <cstring>Form3</cstring> + <cstring>ScanDialog</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>368</width> + <width>360</width> <height>392</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Form3</string> </property> <widget> <class>QFrame</class> <property stdset="1"> <name>name</name> <cstring>Frame7</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> <width>240</width> <height>331</height> </rect> </property> <property stdset="1"> <name>frameShape</name> <enum>StyledPanel</enum> </property> <property stdset="1"> <name>frameShadow</name> <enum>Raised</enum> </property> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout11</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>10</x> <y>9</y> <width>221</width> <height>310</height> </rect> </property> <grid> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="0" rowspan="1" colspan="2" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel10</cstring> </property> <property stdset="1"> <name>text</name> <string>ersetzen durch qprogressbar</string> </property> </widget> <widget row="2" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton13</cstring> </property> <property stdset="1"> <name>text</name> <string>Start</string> </property> </widget> <widget row="2" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton6</cstring> </property> <property stdset="1"> <name>text</name> <string>Stop</string> </property> </widget> <widget row="0" column="0" rowspan="1" colspan="2" > <class>QListView</class> <column> <property> <name>text</name> <string>In List</string> </property> <property> <name>clickable</name> |