Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index c905ea3..e3b9e53 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -1,165 +1,167 @@ | |||
1 | /* | 1 | /* |
2 | * bluebase.cpp * | 2 | * bluebase.cpp * |
3 | * --------------------- | 3 | * --------------------- |
4 | * | 4 | * |
5 | * begin : Sun 10 17:20:00 CEST 2002 | 5 | * begin : Sun 10 17:20:00 CEST 2002 |
6 | * copyright : (c) 2002 by Maximilian Reiß | 6 | * copyright : (c) 2002 by Maximilian Reiß |
7 | * email : max.reiss@gmx.de | 7 | * email : max.reiss@gmx.de |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | /*************************************************************************** | 10 | /*************************************************************************** |
11 | * * | 11 | * * |
12 | * This program is free software; you can redistribute it and/or modify * | 12 | * This program is free software; you can redistribute it and/or modify * |
13 | * it under the terms of the GNU General Public License as published by * | 13 | * it under the terms of the GNU General Public License as published by * |
14 | * the Free Software Foundation; either version 2 of the License, or * | 14 | * the Free Software Foundation; either version 2 of the License, or * |
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * |
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #include "bluebase.h" | 19 | #include "bluebase.h" |
20 | #include "scandialog.h" | 20 | #include "scandialog.h" |
21 | 21 | ||
22 | #include <qframe.h> | 22 | #include <qframe.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | #include <qvariant.h> | 26 | #include <qvariant.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qimage.h> | 28 | #include <qimage.h> |
29 | #include <qpixmap.h> | 29 | #include <qpixmap.h> |
30 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
31 | #include <qscrollview.h> | 31 | #include <qscrollview.h> |
32 | #include <qvbox.h> | 32 | #include <qvbox.h> |
33 | #include <qmessagebox.h> | 33 | #include <qmessagebox.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qcheckbox.h> | 35 | #include <qcheckbox.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | 37 | ||
38 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
39 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | 40 | ||
41 | 41 | ||
42 | namespace OpieTooth { | 42 | namespace OpieTooth { |
43 | 43 | ||
44 | 44 | ||
45 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | 45 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
46 | : BluetoothBase( parent, name, fl ) { | 46 | : BluetoothBase( parent, name, fl ) { |
47 | 47 | ||
48 | 48 | ||
49 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); | 49 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); |
50 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); | 50 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); |
51 | 51 | ||
52 | QPalette pal = this->palette(); | 52 | QPalette pal = this->palette(); |
53 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | 53 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); |
54 | pal.setColor(QPalette::Active, QColorGroup::Button, col); | 54 | pal.setColor(QPalette::Active, QColorGroup::Button, col); |
55 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); | 55 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); |
56 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); | 56 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); |
57 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); | 57 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); |
58 | this->setPalette(pal); | 58 | this->setPalette(pal); |
59 | 59 | ||
60 | setCaption( tr( "Bluetooth Manager" ) ); | ||
61 | |||
60 | readConfig(); | 62 | readConfig(); |
61 | initGui(); | 63 | initGui(); |
62 | } | 64 | } |
63 | 65 | ||
64 | /** | 66 | /** |
65 | * Reads all options from the config file | 67 | * Reads all options from the config file |
66 | */ | 68 | */ |
67 | void BlueBase::readConfig() { | 69 | void BlueBase::readConfig() { |
68 | 70 | ||
69 | Config cfg("bluetoothmanager"); | 71 | Config cfg("bluetoothmanager"); |
70 | cfg.setGroup("bluezsettings"); | 72 | cfg.setGroup("bluezsettings"); |
71 | 73 | ||
72 | 74 | ||
73 | deviceName = cfg.readEntry("name", "No name"); // name the device should identify with | 75 | deviceName = cfg.readEntry("name", "No name"); // name the device should identify with |
74 | defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak | 76 | defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak |
75 | useEncryption = cfg.readNumEntry("useEncryption", 1); | 77 | useEncryption = cfg.readNumEntry("useEncryption", 1); |
76 | enableAuthentification = cfg.readNumEntry("enableAuthentification", 1); | 78 | enableAuthentification = cfg.readNumEntry("enableAuthentification", 1); |
77 | enablePagescan = cfg.readNumEntry("enablePagescan",1); | 79 | enablePagescan = cfg.readNumEntry("enablePagescan",1); |
78 | enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1); | 80 | enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1); |
79 | 81 | ||
80 | } | 82 | } |
81 | 83 | ||
82 | /** | 84 | /** |
83 | * Writes all options to the config file | 85 | * Writes all options to the config file |
84 | */ | 86 | */ |
85 | void BlueBase::writeConfig() { | 87 | void BlueBase::writeConfig() { |
86 | 88 | ||
87 | 89 | ||
88 | Config cfg("bluetoothmanager"); | 90 | Config cfg("bluetoothmanager"); |
89 | cfg.setGroup("bluezsettings"); | 91 | cfg.setGroup("bluezsettings"); |
90 | 92 | ||
91 | 93 | ||
92 | cfg.writeEntry("name", deviceName); | 94 | cfg.writeEntry("name", deviceName); |
93 | cfg.writeEntryCrypt("passkey", defaultPasskey); | 95 | cfg.writeEntryCrypt("passkey", defaultPasskey); |
94 | cfg.writeEntry("useEncryption", useEncryption); | 96 | cfg.writeEntry("useEncryption", useEncryption); |
95 | cfg.writeEntry("enableAuthentification", enableAuthentification); | 97 | cfg.writeEntry("enableAuthentification", enableAuthentification); |
96 | cfg.writeEntry("enablePagescan",enablePagescan); | 98 | cfg.writeEntry("enablePagescan",enablePagescan); |
97 | cfg.writeEntry("enableInquiryscan", enableInquiryscan); | 99 | cfg.writeEntry("enableInquiryscan", enableInquiryscan); |
98 | } | 100 | } |
99 | 101 | ||
100 | 102 | ||
101 | /** | 103 | /** |
102 | * Set up the gui | 104 | * Set up the gui |
103 | */ | 105 | */ |
104 | void BlueBase::initGui() { | 106 | void BlueBase::initGui() { |
105 | 107 | ||
106 | StatusLabel->setText(getStatus()); // maybe move it to getStatus() | 108 | StatusLabel->setText(getStatus()); // maybe move it to getStatus() |
107 | 109 | ||
108 | cryptCheckBox->setChecked(useEncryption); | 110 | cryptCheckBox->setChecked(useEncryption); |
109 | authCheckBox->setChecked(enableAuthentification); | 111 | authCheckBox->setChecked(enableAuthentification); |
110 | pagescanCheckBox->setChecked(enablePagescan); | 112 | pagescanCheckBox->setChecked(enablePagescan); |
111 | inquiryscanCheckBox->setChecked(enableInquiryscan); | 113 | inquiryscanCheckBox->setChecked(enableInquiryscan); |
112 | deviceNameLine->setText(deviceName); | 114 | deviceNameLine->setText(deviceName); |
113 | passkeyLine->setText(defaultPasskey); | 115 | passkeyLine->setText(defaultPasskey); |
114 | } | 116 | } |
115 | 117 | ||
116 | 118 | ||
117 | /** | 119 | /** |
118 | * Get the status informations and returns it | 120 | * Get the status informations and returns it |
119 | * @return QString the status informations gathered | 121 | * @return QString the status informations gathered |
120 | */ | 122 | */ |
121 | QString BlueBase::getStatus(){ | 123 | QString BlueBase::getStatus(){ |
122 | 124 | ||
123 | return ("manger.h need also a status method"); | 125 | return ("manger.h need also a status method"); |
124 | 126 | ||
125 | } | 127 | } |
126 | 128 | ||
127 | 129 | ||
128 | /** | 130 | /** |
129 | * Read the current values from the gui and invoke writeConfig() | 131 | * Read the current values from the gui and invoke writeConfig() |
130 | */ | 132 | */ |
131 | void BlueBase::applyConfigChanges() { | 133 | void BlueBase::applyConfigChanges() { |
132 | 134 | ||
133 | deviceName = deviceNameLine->text(); | 135 | deviceName = deviceNameLine->text(); |
134 | defaultPasskey = passkeyLine->text(); | 136 | defaultPasskey = passkeyLine->text(); |
135 | useEncryption = cryptCheckBox->isChecked(); | 137 | useEncryption = cryptCheckBox->isChecked(); |
136 | enableAuthentification = authCheckBox->isChecked(); | 138 | enableAuthentification = authCheckBox->isChecked(); |
137 | enablePagescan = pagescanCheckBox->isChecked(); | 139 | enablePagescan = pagescanCheckBox->isChecked(); |
138 | enableInquiryscan = inquiryscanCheckBox->isChecked(); | 140 | enableInquiryscan = inquiryscanCheckBox->isChecked(); |
139 | 141 | ||
140 | writeConfig(); | 142 | writeConfig(); |
141 | 143 | ||
142 | QMessageBox* box = new QMessageBox(this, "Test"); | 144 | QMessageBox* box = new QMessageBox(this, "Test"); |
143 | box->setText(tr("Changes applied")); | 145 | box->setText(tr("Changes applied")); |
144 | box->show(); | 146 | box->show(); |
145 | 147 | ||
146 | // falls nötig hcid killhupen - die funktionalität adden | 148 | // falls nötig hcid killhupen - die funktionalität adden |
147 | } | 149 | } |
148 | 150 | ||
149 | 151 | ||
150 | /** | 152 | /** |
151 | * Open the "scan for devices" dialog | 153 | * Open the "scan for devices" dialog |
152 | */ | 154 | */ |
153 | void BlueBase::startScan() { | 155 | void BlueBase::startScan() { |
154 | ScanDialog *scan = new ScanDialog( this, "", true); | 156 | ScanDialog *scan = new ScanDialog( this, "", true); |
155 | scan->exec(); | 157 | scan->showMaximized(); |
156 | } | 158 | } |
157 | 159 | ||
158 | /** | 160 | /** |
159 | * Decontructor | 161 | * Decontructor |
160 | */ | 162 | */ |
161 | BlueBase::~BlueBase(){ | 163 | BlueBase::~BlueBase(){ |
162 | } | 164 | } |
163 | 165 | ||
164 | } | 166 | } |
165 | 167 | ||