summaryrefslogtreecommitdiff
path: root/library
Side-by-side diff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/password.cpp24
-rw-r--r--library/password.h1
2 files changed, 23 insertions, 2 deletions
diff --git a/library/password.cpp b/library/password.cpp
index 4b22b65..6d126c4 100644
--- a/library/password.cpp
+++ b/library/password.cpp
@@ -18,25 +18,25 @@
**
**********************************************************************/
#include "password.h"
#include "config.h"
#include "global.h"
#include "backend/contact.h"
#include <qlabel.h>
#include <qlineedit.h>
#include <qtextview.h>
#include <qstring.h>
#include <qapplication.h>
#include <qfile.h>
-#include <qwindowsystem_qws.h>
+//#include <qwindowsystem_qws.h>
#include <qdialog.h>
#include <unistd.h> //for sleep
#include "passwordbase_p.h"
class PasswordDialog : public PasswordBase
{
Q_OBJECT
public:
PasswordDialog( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
@@ -276,24 +276,43 @@ QString Password::getPassword( const QString& prompt )
if ( r == QDialog::Accepted ) {
if (pd.passw->text.isEmpty())
return "";
else
return qcrypt(pd.passw->text,"a0");
} else {
return QString::null;
}
}
/*!
+ Return if a prompt for the user's passcode is needed.
+
+ If \a at_poweron is TRUE, the dialog is only used if the user's
+ preference request it at poweron
+
+ Opie extension to speed up suspend/resume.
+*/
+
+bool Password::needToAuthenticate(bool at_poweron)
+{
+ Config cfg("Security");
+ cfg.setGroup("Passcode");
+ QString passcode = cfg.readEntry("passcode");
+
+ return ( !passcode.isEmpty()
+ && (!at_poweron || cfg.readNumEntry("passcode_poweron",0)) );
+}
+
+/*!
Prompt, fullscreen, for the user's passcode until they get it right.
If \a at_poweron is TRUE, the dialog is only used if the user's
preference request it at poweron; either way, the screen is always repainted
by this function. (this functionality may move to the caller of this function).
*/
void Password::authenticate(bool at_poweron)
{
Config cfg("Security");
cfg.setGroup("Passcode");
QString passcode = cfg.readEntry("passcode");
@@ -315,19 +334,20 @@ void Password::authenticate(bool at_poweron)
}
pd.reset();
pd.exec();
while (qcrypt(pd.passw->text, "a0") != passcode) {
if (oi)
oi->exec();
pd.reset();
pd.exec();
}
} else if ( at_poweron ) {
// refresh screen #### should probably be in caller
- // Not needed (we took away the screen blacking)
+ // Not needed (we took away the screen blacking) TT
+ // Not needed (we have intelligent screen blacking) sandman
//if ( qwsServer )
//qwsServer->refresh();
}
}
#include "password.moc"
diff --git a/library/password.h b/library/password.h
index a3a3e45..a2f2c3c 100644
--- a/library/password.h
+++ b/library/password.h
@@ -16,17 +16,18 @@
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef PASSWORD_H
#define PASSWORD_H
#include <qstring.h>
class Password
{
public:
+ static bool needToAuthenticate(bool atpoweron=FALSE); // Opie extension to speed up suspend/resume (sandman)
static void authenticate(bool atpoweron=FALSE);
static QString getPassword( const QString& prompt );
};
#endif // PASSWORD_H