summaryrefslogtreecommitdiff
path: root/core/settings/security
Side-by-side diff
Diffstat (limited to 'core/settings/security') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/security/security.cpp58
-rw-r--r--core/settings/security/security.pro14
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 @@
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "security.h"
+/* OPIE */
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/password.h>
#include <qpe/qpedialog.h>
#include <qpe/qcopenvelope_qws.h>
+#include <opie2/odebug.h>
+/* QT */
#include <qcheckbox.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qtextstream.h>
+
+using namespace Opie::Core;
+
Security::Security( QWidget* parent, const char* name, WFlags fl )
: SecurityBase( parent, name, TRUE, WStyle_ContextHelp )
{
valid=FALSE;
Config cfg("Security");
cfg.setGroup("Passcode");
@@ -115,13 +121,13 @@ void Security::deleteListEntry()
}
void Security::restoreDefaults()
{
QMessageBox unrecbox(
tr("Attention"),
- tr( "<p>All user-defined net ranges will be lost."),
+ tr( "<p>All user-defined net ranges will be lost."),
QMessageBox::Warning,
QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton,
0, QString::null, TRUE, WStyle_StaysOnTop);
unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel"));
unrecbox.setButtonText(QMessageBox::Yes, tr("Ok"));
@@ -167,22 +173,22 @@ void Security::show()
if ( passcode.isEmpty() ) {
// could insist...
//changePassCode();
//if ( passcode.isEmpty() )
//reject();
} else {
- if (!valid) // security passcode was not asked yet, so ask now
- {
- QString pc = enterPassCode(tr("Enter passcode"));
- if ( pc != passcode ) {
- QMessageBox::critical(this, tr("Passcode incorrect"),
- tr("The passcode entered is incorrect.\nAccess denied"));
- reject();
- return;
- }
- }
+ if (!valid) // security passcode was not asked yet, so ask now
+ {
+ QString pc = enterPassCode(tr("Enter passcode"));
+ if ( pc != passcode ) {
+ QMessageBox::critical(this, tr("Passcode incorrect"),
+ tr("The passcode entered is incorrect.\nAccess denied"));
+ reject();
+ return;
+ }
+ }
}
setEnabled(TRUE);
valid=TRUE;
}
void Security::accept()
@@ -213,23 +219,23 @@ void Security::selectNet(int auth_peer,int auth_peer_bits, bool update)
+ QString::number((auth_peer>>0)&0xff) + "/"
+ QString::number(auth_peer_bits);
}
//insert user-defined list of netranges upon start
if (update) {
- //User selected/active netrange first
- syncnet->insertItem( tr( sn ) );
+ //User selected/active netrange first
+ syncnet->insertItem( tr( sn ) );
- Config cfg("Security");
- cfg.setGroup("Sync");
+ Config cfg("Security");
+ cfg.setGroup("Sync");
- //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe
- QString test = cfg.readEntry("net0","");
- if (test.isEmpty()) {
+ //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe
+ QString test = cfg.readEntry("net0","");
+ if (test.isEmpty()) {
insertDefaultRanges();
- } else {
+ } else {
// 10 ought to be enough for everybody... :)
// If you need more, don't forget to edit applySecurity() as well
bool already_there=FALSE;
for (int i=0; i<10; i++) {
QString target, netrange;
target.sprintf("net%d", i);
@@ -254,13 +260,13 @@ void Security::selectNet(int auth_peer,int auth_peer_bits, bool update)
for (int i=0; i<syncnet->count(); i++) {
if ( syncnet->text(i).left(sn.length()) == sn ) {
syncnet->setCurrentItem(i);
return;
}
}
- qDebug("No match for \"%s\"",sn.latin1());
+ odebug << "No match for \"" << sn << "\"" << oendl;
}
void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits)
{
auth_peer=0;
if ( sn == tr("Any") ) {
@@ -337,18 +343,18 @@ void Security::applySecurity()
parseNet(sn,auth_peer,auth_peer_bits);
//this is the *selected* (active) net range
cfg.writeEntry("auth_peer",auth_peer);
cfg.writeEntry("auth_peer_bits",auth_peer_bits);
- //write back all other net ranges in *cleartext*
- for (int i=0; i<10; i++) {
- QString target;
- target.sprintf("net%d", i);
- cfg.writeEntry(target,syncnet->text(i));
- }
+ //write back all other net ranges in *cleartext*
+ for (int i=0; i<10; i++) {
+ QString target;
+ target.sprintf("net%d", i);
+ cfg.writeEntry(target,syncnet->text(i));
+ }
#ifdef ODP
#error "Use 0,1,2 and use Launcher"
#endif
/* keep the old code so we don't use currentItem directly */
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 @@
-CONFIG += qt warn_on quick-app
-HEADERS = security.h
-SOURCES = security.cpp main.cpp
-INTERFACES = securitybase.ui
+CONFIG += qt warn_on quick-app
+HEADERS = security.h
+SOURCES = security.cpp main.cpp
+INTERFACES = securitybase.ui
INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += ../$(OPIEDIR)/include
-LIBS += -lqpe
-TARGET = security
+DEPENDPATH += ../$(OPIEDIR)/include
+LIBS += -lqpe -lopiecore2
+TARGET = security
include ( $(OPIEDIR)/include.pro )