Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (show 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 | |||
@@ -32,6 +32,9 @@ | |||
32 | #include <qvbox.h> | 32 | #include <qvbox.h> |
33 | #include <qmessagebox.h> | ||
33 | #include <qapplication.h> | 34 | #include <qapplication.h> |
34 | #include <qcheckbox.h> | 35 | #include <qcheckbox.h> |
36 | #include <qlineedit.h> | ||
35 | 37 | ||
36 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
39 | #include <qpe/config.h> | ||
37 | 40 | ||
@@ -42,2 +45,3 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | |||
42 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); | 45 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); |
46 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); | ||
43 | 47 | ||
@@ -50,2 +54,60 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | |||
50 | this->setPalette(pal); | 54 | this->setPalette(pal); |
55 | |||
56 | readConfig(); | ||
57 | initGui(); | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * Reads all options from the config file | ||
62 | */ | ||
63 | void BlueBase::readConfig() { | ||
64 | |||
65 | Config cfg("bluetoothmanager"); | ||
66 | cfg.setGroup("bluezsettings"); | ||
67 | |||
68 | |||
69 | deviceName = cfg.readEntry("name", "No name"); // name the device should identify with | ||
70 | defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak | ||
71 | useEncryption = cfg.readNumEntry("useEncryption", 1); | ||
72 | enableAuthentification = cfg.readNumEntry("enableAuthentification", 1); | ||
73 | enablePagescan = cfg.readNumEntry("enablePagescan",1); | ||
74 | enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1); | ||
75 | |||
76 | } | ||
77 | |||
78 | /** | ||
79 | * Writes all options to the config file | ||
80 | */ | ||
81 | void BlueBase::writeConfig() { | ||
82 | |||
83 | |||
84 | Config cfg("bluetoothmanager"); | ||
85 | cfg.setGroup("bluezsettings"); | ||
86 | |||
87 | |||
88 | cfg.writeEntry("name", deviceName); | ||
89 | cfg.writeEntryCrypt("passkey", defaultPasskey); | ||
90 | cfg.writeEntry("useEncryption", useEncryption); | ||
91 | cfg.writeEntry("enableAuthentification", enableAuthentification); | ||
92 | cfg.writeEntry("enablePagescan",enablePagescan); | ||
93 | cfg.writeEntry("enableInquiryscan", enableInquiryscan); | ||
94 | |||
95 | |||
96 | } | ||
97 | |||
98 | |||
99 | /** | ||
100 | * Set up the gui | ||
101 | */ | ||
102 | void BlueBase::initGui() { | ||
103 | |||
104 | StatusLabel->setText(getStatus()); // maybe move it to getStatus() | ||
105 | |||
106 | cryptCheckBox->setChecked(useEncryption); | ||
107 | authCheckBox->setChecked(enableAuthentification); | ||
108 | pagescanCheckBox->setChecked(enablePagescan); | ||
109 | inquiryscanCheckBox->setChecked(enableInquiryscan); | ||
110 | deviceNameLine->setText(deviceName); | ||
111 | passkeyLine->setText(defaultPasskey); | ||
112 | |||
51 | } | 113 | } |
@@ -53,4 +115,42 @@ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | |||
53 | 115 | ||
116 | /** | ||
117 | * Get the status informations and returns it | ||
118 | * @return QString the status informations gathered | ||
119 | */ | ||
120 | QString BlueBase::getStatus(){ | ||
121 | |||
122 | return ("manger.h need also a status method"); | ||
123 | |||
124 | } | ||
125 | |||
126 | |||
127 | /** | ||
128 | * Read the current values from the gui and invoke writeConfig() | ||
129 | */ | ||
130 | void BlueBase::applyConfigChanges() { | ||
131 | |||
132 | deviceName = deviceNameLine->text(); | ||
133 | defaultPasskey = passkeyLine->text(); | ||
134 | useEncryption = cryptCheckBox->isChecked(); | ||
135 | enableAuthentification = authCheckBox->isChecked(); | ||
136 | enablePagescan = pagescanCheckBox->isChecked(); | ||
137 | enableInquiryscan = inquiryscanCheckBox->isChecked(); | ||
138 | |||
139 | writeConfig(); | ||
140 | |||
141 | QMessageBox* box = new QMessageBox(this, "Test"); | ||
142 | box->setText(tr("Changes applied")); | ||
143 | box->show(); | ||
144 | |||
145 | // falls nötig hcid killhupen - die funktionalität adden | ||
146 | |||
147 | |||
148 | } | ||
149 | |||
150 | |||
151 | /** | ||
152 | * Open the "scan for devices" dialog | ||
153 | */ | ||
54 | void BlueBase::startScan() { | 154 | void BlueBase::startScan() { |
55 | Form3 *scan = new Form3( this, "", true); | 155 | ScanDialog *scan = new ScanDialog( this, "", true); |
56 | scan->exec(); | 156 | scan->exec(); |
@@ -58,2 +158,5 @@ void BlueBase::startScan() { | |||
58 | 158 | ||
159 | /** | ||
160 | * Decontructor | ||
161 | */ | ||
59 | BlueBase::~BlueBase(){ | 162 | BlueBase::~BlueBase(){ |