author | ar <ar> | 2004-05-02 17:31:50 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-02 17:31:50 (UTC) |
commit | a210b9a597ba0c929d95c38ffbaf972916c7b8a7 (patch) (unidiff) | |
tree | ce121d5017eb054222c86e0afb6057a28ea7bf8a /core/settings/security | |
parent | 18759e9156c96795831120408a9da0d3b4ec71a4 (diff) | |
download | opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.zip opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.gz opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.bz2 |
- convert qDebug to odebug
-rw-r--r-- | core/settings/security/security.cpp | 58 | ||||
-rw-r--r-- | core/settings/security/security.pro | 14 |
2 files changed, 39 insertions, 33 deletions
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp index 4eddb55..b917aea 100644 --- a/core/settings/security/security.cpp +++ b/core/settings/security/security.cpp | |||
@@ -16,25 +16,31 @@ | |||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "security.h" | 20 | #include "security.h" |
21 | 21 | ||
22 | /* OPIE */ | ||
22 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
24 | #include <qpe/password.h> | 25 | #include <qpe/password.h> |
25 | #include <qpe/qpedialog.h> | 26 | #include <qpe/qpedialog.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <opie2/odebug.h> | ||
27 | 29 | ||
30 | /* QT */ | ||
28 | #include <qcheckbox.h> | 31 | #include <qcheckbox.h> |
29 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
30 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
31 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
32 | #include <qfile.h> | 35 | #include <qfile.h> |
33 | #include <qtextstream.h> | 36 | #include <qtextstream.h> |
34 | 37 | ||
38 | |||
39 | using namespace Opie::Core; | ||
40 | |||
35 | Security::Security( QWidget* parent, const char* name, WFlags fl ) | 41 | Security::Security( QWidget* parent, const char* name, WFlags fl ) |
36 | : SecurityBase( parent, name, TRUE, WStyle_ContextHelp ) | 42 | : SecurityBase( parent, name, TRUE, WStyle_ContextHelp ) |
37 | { | 43 | { |
38 | valid=FALSE; | 44 | valid=FALSE; |
39 | Config cfg("Security"); | 45 | Config cfg("Security"); |
40 | cfg.setGroup("Passcode"); | 46 | cfg.setGroup("Passcode"); |
@@ -115,13 +121,13 @@ void Security::deleteListEntry() | |||
115 | } | 121 | } |
116 | 122 | ||
117 | void Security::restoreDefaults() | 123 | void Security::restoreDefaults() |
118 | { | 124 | { |
119 | QMessageBox unrecbox( | 125 | QMessageBox unrecbox( |
120 | tr("Attention"), | 126 | tr("Attention"), |
121 | tr("<p>All user-defined net ranges will be lost."), | 127 | tr( "<p>All user-defined net ranges will be lost."), |
122 | QMessageBox::Warning, | 128 | QMessageBox::Warning, |
123 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, | 129 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, |
124 | 0, QString::null, TRUE, WStyle_StaysOnTop); | 130 | 0, QString::null, TRUE, WStyle_StaysOnTop); |
125 | unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); | 131 | unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); |
126 | unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); | 132 | unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); |
127 | 133 | ||
@@ -167,22 +173,22 @@ void Security::show() | |||
167 | if ( passcode.isEmpty() ) { | 173 | if ( passcode.isEmpty() ) { |
168 | // could insist... | 174 | // could insist... |
169 | //changePassCode(); | 175 | //changePassCode(); |
170 | //if ( passcode.isEmpty() ) | 176 | //if ( passcode.isEmpty() ) |
171 | //reject(); | 177 | //reject(); |
172 | } else { | 178 | } else { |
173 | if (!valid) // security passcode was not asked yet, so ask now | 179 | if (!valid) // security passcode was not asked yet, so ask now |
174 | { | 180 | { |
175 | QString pc = enterPassCode(tr("Enter passcode")); | 181 | QString pc = enterPassCode(tr("Enter passcode")); |
176 | if ( pc != passcode ) { | 182 | if ( pc != passcode ) { |
177 | QMessageBox::critical(this, tr("Passcode incorrect"), | 183 | QMessageBox::critical(this, tr("Passcode incorrect"), |
178 | tr("The passcode entered is incorrect.\nAccess denied")); | 184 | tr("The passcode entered is incorrect.\nAccess denied")); |
179 | reject(); | 185 | reject(); |
180 | return; | 186 | return; |
181 | } | 187 | } |
182 | } | 188 | } |
183 | } | 189 | } |
184 | setEnabled(TRUE); | 190 | setEnabled(TRUE); |
185 | valid=TRUE; | 191 | valid=TRUE; |
186 | } | 192 | } |
187 | 193 | ||
188 | void Security::accept() | 194 | void Security::accept() |
@@ -213,23 +219,23 @@ void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) | |||
213 | + QString::number((auth_peer>>0)&0xff) + "/" | 219 | + QString::number((auth_peer>>0)&0xff) + "/" |
214 | + QString::number(auth_peer_bits); | 220 | + QString::number(auth_peer_bits); |
215 | } | 221 | } |
216 | 222 | ||
217 | //insert user-defined list of netranges upon start | 223 | //insert user-defined list of netranges upon start |
218 | if (update) { | 224 | if (update) { |
219 | //User selected/active netrange first | 225 | //User selected/active netrange first |
220 | syncnet->insertItem( tr( sn ) ); | 226 | syncnet->insertItem( tr( sn ) ); |
221 | 227 | ||
222 | Config cfg("Security"); | 228 | Config cfg("Security"); |
223 | cfg.setGroup("Sync"); | 229 | cfg.setGroup("Sync"); |
224 | 230 | ||
225 | //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe | 231 | //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe |
226 | QString test = cfg.readEntry("net0",""); | 232 | QString test = cfg.readEntry("net0",""); |
227 | if (test.isEmpty()) { | 233 | if (test.isEmpty()) { |
228 | insertDefaultRanges(); | 234 | insertDefaultRanges(); |
229 | } else { | 235 | } else { |
230 | // 10 ought to be enough for everybody... :) | 236 | // 10 ought to be enough for everybody... :) |
231 | // If you need more, don't forget to edit applySecurity() as well | 237 | // If you need more, don't forget to edit applySecurity() as well |
232 | bool already_there=FALSE; | 238 | bool already_there=FALSE; |
233 | for (int i=0; i<10; i++) { | 239 | for (int i=0; i<10; i++) { |
234 | QString target, netrange; | 240 | QString target, netrange; |
235 | target.sprintf("net%d", i); | 241 | target.sprintf("net%d", i); |
@@ -254,13 +260,13 @@ void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) | |||
254 | for (int i=0; i<syncnet->count(); i++) { | 260 | for (int i=0; i<syncnet->count(); i++) { |
255 | if ( syncnet->text(i).left(sn.length()) == sn ) { | 261 | if ( syncnet->text(i).left(sn.length()) == sn ) { |
256 | syncnet->setCurrentItem(i); | 262 | syncnet->setCurrentItem(i); |
257 | return; | 263 | return; |
258 | } | 264 | } |
259 | } | 265 | } |
260 | qDebug("No match for \"%s\"",sn.latin1()); | 266 | odebug << "No match for \"" << sn << "\"" << oendl; |
261 | } | 267 | } |
262 | 268 | ||
263 | void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) | 269 | void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) |
264 | { | 270 | { |
265 | auth_peer=0; | 271 | auth_peer=0; |
266 | if ( sn == tr("Any") ) { | 272 | if ( sn == tr("Any") ) { |
@@ -337,18 +343,18 @@ void Security::applySecurity() | |||
337 | parseNet(sn,auth_peer,auth_peer_bits); | 343 | parseNet(sn,auth_peer,auth_peer_bits); |
338 | 344 | ||
339 | //this is the *selected* (active) net range | 345 | //this is the *selected* (active) net range |
340 | cfg.writeEntry("auth_peer",auth_peer); | 346 | cfg.writeEntry("auth_peer",auth_peer); |
341 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); | 347 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); |
342 | 348 | ||
343 | //write back all other net ranges in *cleartext* | 349 | //write back all other net ranges in *cleartext* |
344 | for (int i=0; i<10; i++) { | 350 | for (int i=0; i<10; i++) { |
345 | QString target; | 351 | QString target; |
346 | target.sprintf("net%d", i); | 352 | target.sprintf("net%d", i); |
347 | cfg.writeEntry(target,syncnet->text(i)); | 353 | cfg.writeEntry(target,syncnet->text(i)); |
348 | } | 354 | } |
349 | 355 | ||
350 | #ifdef ODP | 356 | #ifdef ODP |
351 | #error "Use 0,1,2 and use Launcher" | 357 | #error "Use 0,1,2 and use Launcher" |
352 | #endif | 358 | #endif |
353 | /* keep the old code so we don't use currentItem directly */ | 359 | /* keep the old code so we don't use currentItem directly */ |
354 | int value = 0x02; | 360 | int value = 0x02; |
diff --git a/core/settings/security/security.pro b/core/settings/security/security.pro index 4a29ee2..4c1e68b 100644 --- a/core/settings/security/security.pro +++ b/core/settings/security/security.pro | |||
@@ -1,10 +1,10 @@ | |||
1 | CONFIG += qt warn_on quick-app | 1 | CONFIG += qt warn_on quick-app |
2 | HEADERS = security.h | 2 | HEADERS = security.h |
3 | SOURCES = security.cpp main.cpp | 3 | SOURCES = security.cpp main.cpp |
4 | INTERFACES= securitybase.ui | 4 | INTERFACES = securitybase.ui |
5 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH+= ../$(OPIEDIR)/include | 6 | DEPENDPATH += ../$(OPIEDIR)/include |
7 | LIBS += -lqpe | 7 | LIBS += -lqpe -lopiecore2 |
8 | TARGET = security | 8 | TARGET = security |
9 | 9 | ||
10 | include ( $(OPIEDIR)/include.pro ) | 10 | include ( $(OPIEDIR)/include.pro ) |