summaryrefslogtreecommitdiff
path: root/library/password.cpp
Side-by-side diff
Diffstat (limited to 'library/password.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/password.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/library/password.cpp b/library/password.cpp
index 6d126c4..25fb1b8 100644
--- a/library/password.cpp
+++ b/library/password.cpp
@@ -72,25 +72,25 @@ static QString qcrypt(const QString& k, const char *salt)
PasswordDialog::PasswordDialog( QWidget* parent, const char* name, WFlags fl )
: PasswordBase( parent, name, fl )
{
QRect desk = qApp->desktop()->geometry();
if ( desk.width() < 220 ) {
QFont f( font() );
f.setPointSize( 18 );
setFont( f );
f.setPointSize( 12 );
prompt->setFont( f );
}
-
+
button_0->installEventFilter( this );
button_1->installEventFilter( this );
button_2->installEventFilter( this );
button_3->installEventFilter( this );
button_4->installEventFilter( this );
button_5->installEventFilter( this );
button_6->installEventFilter( this );
button_7->installEventFilter( this );
button_8->installEventFilter( this );
button_9->installEventFilter( this );
button_OK->installEventFilter( this );
setFocus();
@@ -207,51 +207,52 @@ public:
{
if ( !modl )
qApp->exit_loop();
QDialog::accept();
}
PasswordDialog *passw;
bool modl;
};
class OwnerDlg : public QDialog
{
+ Q_OBJECT
public:
OwnerDlg( QWidget *parent, const char * name, Contact c,
bool modal, bool fullscreen = FALSE )
- : QDialog( parent, name, modal,
- fullscreen ?
+ : QDialog( parent, name, modal,
+ fullscreen ?
WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop : 0 )
{
if ( fullscreen ) {
QRect desk = qApp->desktop()->geometry();
setGeometry( 0, 0, desk.width(), desk.height() );
}
// set up contents.
QString text = "<H1>" + tr("Owner Information") + "</H1>";
text += c.toRichText();
tv = new QTextView(this);
tv->setText(text);
tv->viewport()->installEventFilter(this);
}
void resizeEvent( QResizeEvent * )
{
tv->resize( size() );
}
-
+
bool eventFilter(QObject *o, QEvent *e)
{
if (e->type() == QEvent::KeyPress || e->type() == QEvent::MouseButtonPress ) {
accept();
return TRUE;
}
return QWidget::eventFilter(o, e);
}
void mousePressEvent( QMouseEvent * ) { accept(); }
private:
@@ -280,34 +281,34 @@ QString Password::getPassword( const QString& prompt )
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).
*/
@@ -315,25 +316,25 @@ void Password::authenticate(bool at_poweron)
{
Config cfg("Security");
cfg.setGroup("Passcode");
QString passcode = cfg.readEntry("passcode");
if ( !passcode.isEmpty()
&& (!at_poweron || cfg.readNumEntry("passcode_poweron",0)) )
{
// Do it as a fullscreen modal dialog
PasswdDlg pd(0,0,TRUE,TRUE);
// see if there is contact information.
OwnerDlg *oi = 0;
- QString vfilename = Global::applicationFileName("addressbook",
+ QString vfilename = Global::applicationFileName("addressbook",
"businesscard.vcf");
if (QFile::exists(vfilename)) {
Contact c;
c = Contact::readVCard( vfilename )[0];
oi = new OwnerDlg(0, 0, c, TRUE, TRUE);
}
pd.reset();
pd.exec();
while (qcrypt(pd.passw->text, "a0") != passcode) {
if (oi)