Diffstat (limited to 'noncore/net/opietooth/manager/bluebase.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 3d446f0..c905ea3 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -38,78 +38,79 @@ | |||
38 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
39 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | 40 | ||
41 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) | ||
42 | : BluetoothBase( parent, name, fl ) { | ||
43 | 41 | ||
42 | namespace OpieTooth { | ||
44 | 43 | ||
45 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); | ||
46 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); | ||
47 | 44 | ||
48 | QPalette pal = this->palette(); | 45 | BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) |
49 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | 46 | : BluetoothBase( parent, name, fl ) { |
50 | pal.setColor(QPalette::Active, QColorGroup::Button, col); | ||
51 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); | ||
52 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); | ||
53 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); | ||
54 | this->setPalette(pal); | ||
55 | 47 | ||
56 | readConfig(); | ||
57 | initGui(); | ||
58 | } | ||
59 | 48 | ||
60 | /** | 49 | QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan())); |
50 | QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges())); | ||
51 | |||
52 | QPalette pal = this->palette(); | ||
53 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | ||
54 | pal.setColor(QPalette::Active, QColorGroup::Button, col); | ||
55 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); | ||
56 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); | ||
57 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); | ||
58 | this->setPalette(pal); | ||
59 | |||
60 | readConfig(); | ||
61 | initGui(); | ||
62 | } | ||
63 | |||
64 | /** | ||
61 | * Reads all options from the config file | 65 | * Reads all options from the config file |
62 | */ | 66 | */ |
63 | void BlueBase::readConfig() { | 67 | void BlueBase::readConfig() { |
64 | 68 | ||
65 | Config cfg("bluetoothmanager"); | 69 | Config cfg("bluetoothmanager"); |
66 | cfg.setGroup("bluezsettings"); | 70 | cfg.setGroup("bluezsettings"); |
67 | |||
68 | 71 | ||
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 | 72 | ||
76 | } | 73 | 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 | ||
75 | useEncryption = cfg.readNumEntry("useEncryption", 1); | ||
76 | enableAuthentification = cfg.readNumEntry("enableAuthentification", 1); | ||
77 | enablePagescan = cfg.readNumEntry("enablePagescan",1); | ||
78 | enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1); | ||
79 | |||
80 | } | ||
77 | 81 | ||
78 | /** | 82 | /** |
79 | * Writes all options to the config file | 83 | * Writes all options to the config file |
80 | */ | 84 | */ |
81 | void BlueBase::writeConfig() { | 85 | void BlueBase::writeConfig() { |
82 | |||
83 | 86 | ||
84 | Config cfg("bluetoothmanager"); | ||
85 | cfg.setGroup("bluezsettings"); | ||
86 | |||
87 | 87 | ||
88 | cfg.writeEntry("name", deviceName); | 88 | Config cfg("bluetoothmanager"); |
89 | cfg.writeEntryCrypt("passkey", defaultPasskey); | 89 | cfg.setGroup("bluezsettings"); |
90 | cfg.writeEntry("useEncryption", useEncryption); | ||
91 | cfg.writeEntry("enableAuthentification", enableAuthentification); | ||
92 | cfg.writeEntry("enablePagescan",enablePagescan); | ||
93 | cfg.writeEntry("enableInquiryscan", enableInquiryscan); | ||
94 | 90 | ||
95 | 91 | ||
92 | cfg.writeEntry("name", deviceName); | ||
93 | cfg.writeEntryCrypt("passkey", defaultPasskey); | ||
94 | cfg.writeEntry("useEncryption", useEncryption); | ||
95 | cfg.writeEntry("enableAuthentification", enableAuthentification); | ||
96 | cfg.writeEntry("enablePagescan",enablePagescan); | ||
97 | cfg.writeEntry("enableInquiryscan", enableInquiryscan); | ||
96 | } | 98 | } |
97 | 99 | ||
98 | 100 | ||
99 | /** | 101 | /** |
100 | * Set up the gui | 102 | * Set up the gui |
101 | */ | 103 | */ |
102 | void BlueBase::initGui() { | 104 | void BlueBase::initGui() { |
103 | 105 | ||
104 | StatusLabel->setText(getStatus()); // maybe move it to getStatus() | 106 | 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 | 107 | ||
108 | cryptCheckBox->setChecked(useEncryption); | ||
109 | authCheckBox->setChecked(enableAuthentification); | ||
110 | pagescanCheckBox->setChecked(enablePagescan); | ||
111 | inquiryscanCheckBox->setChecked(enableInquiryscan); | ||
112 | deviceNameLine->setText(deviceName); | ||
113 | passkeyLine->setText(defaultPasskey); | ||
113 | } | 114 | } |
114 | 115 | ||
115 | 116 | ||
@@ -117,49 +118,48 @@ void BlueBase::initGui() { | |||
117 | * Get the status informations and returns it | 118 | * Get the status informations and returns it |
118 | * @return QString the status informations gathered | 119 | * @return QString the status informations gathered |
119 | */ | 120 | */ |
120 | QString BlueBase::getStatus(){ | 121 | QString BlueBase::getStatus(){ |
121 | 122 | ||
122 | return ("manger.h need also a status method"); | 123 | return ("manger.h need also a status method"); |
123 | 124 | ||
124 | } | 125 | } |
125 | 126 | ||
126 | 127 | ||
127 | /** | 128 | /** |
128 | * Read the current values from the gui and invoke writeConfig() | 129 | * Read the current values from the gui and invoke writeConfig() |
129 | */ | 130 | */ |
130 | void BlueBase::applyConfigChanges() { | 131 | void BlueBase::applyConfigChanges() { |
131 | 132 | ||
132 | deviceName = deviceNameLine->text(); | 133 | deviceName = deviceNameLine->text(); |
133 | defaultPasskey = passkeyLine->text(); | 134 | defaultPasskey = passkeyLine->text(); |
134 | useEncryption = cryptCheckBox->isChecked(); | 135 | useEncryption = cryptCheckBox->isChecked(); |
135 | enableAuthentification = authCheckBox->isChecked(); | 136 | enableAuthentification = authCheckBox->isChecked(); |
136 | enablePagescan = pagescanCheckBox->isChecked(); | 137 | enablePagescan = pagescanCheckBox->isChecked(); |
137 | enableInquiryscan = inquiryscanCheckBox->isChecked(); | 138 | enableInquiryscan = inquiryscanCheckBox->isChecked(); |
138 | 139 | ||
139 | writeConfig(); | 140 | writeConfig(); |
140 | 141 | ||
141 | QMessageBox* box = new QMessageBox(this, "Test"); | 142 | QMessageBox* box = new QMessageBox(this, "Test"); |
142 | box->setText(tr("Changes applied")); | 143 | box->setText(tr("Changes applied")); |
143 | box->show(); | 144 | box->show(); |
144 | 145 | ||
145 | // falls nötig hcid killhupen - die funktionalität adden | 146 | // falls nötig hcid killhupen - die funktionalität adden |
146 | |||
147 | |||
148 | } | 147 | } |
149 | 148 | ||
150 | 149 | ||
151 | /** | 150 | /** |
152 | * Open the "scan for devices" dialog | 151 | * Open the "scan for devices" dialog |
153 | */ | 152 | */ |
154 | void BlueBase::startScan() { | 153 | void BlueBase::startScan() { |
155 | ScanDialog *scan = new ScanDialog( this, "", true); | 154 | ScanDialog *scan = new ScanDialog( this, "", true); |
156 | scan->exec(); | 155 | scan->exec(); |
157 | } | 156 | } |
158 | 157 | ||
159 | /** | 158 | /** |
160 | * Decontructor | 159 | * Decontructor |
161 | */ | 160 | */ |
162 | BlueBase::~BlueBase(){ | 161 | BlueBase::~BlueBase(){ |
163 | } | 162 | } |
164 | 163 | ||
164 | } | ||
165 | 165 | ||