X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2FUserInterface%2FUtils%2FPasswordDialog.cpp;h=778d32ab937febea9b4d7f619688f5cef96d96df;hb=c7e1f3b242a6e5d1b381db0b88fad5b79ae72fd4;hp=332b0b69ed053fd706692f09a171c52055152d43;hpb=9ee999fe4a7de48abc3b4f950699cd4564d16562;p=qtmeetings diff --git a/src/UserInterface/Utils/PasswordDialog.cpp b/src/UserInterface/Utils/PasswordDialog.cpp index 332b0b6..778d32a 100644 --- a/src/UserInterface/Utils/PasswordDialog.cpp +++ b/src/UserInterface/Utils/PasswordDialog.cpp @@ -7,18 +7,12 @@ #include #include -PasswordDialog::PasswordDialog( QWidget *aParent, const QString &aPassword, const QString &aText, const QString &aTitle ) : +PasswordDialog::PasswordDialog( const QString &aPassword, const QString &aText, const QString &aTitle, QWidget *aParent ) : QDialog( aParent ) { setWindowTitle( aTitle.isNull() ? tr( "Enter password" ) : aTitle ); setModal( true ); - // Store the password hash to iPasswordHash - // ( aPassword should be allready encoded ) -// QCryptographicHash *hash = new QCryptographicHash( QCryptographicHash::Md5 ); -// hash->addData( aPassword.toUtf8() ); -// iPasswordHash = hash->result(); -// delete hash; iPasswordHash = aPassword.toUtf8(); /* Create the layout: @@ -75,8 +69,10 @@ void PasswordDialog::okButtonPressed() QCryptographicHash *hash = new QCryptographicHash( QCryptographicHash::Md5 ); hash->addData( iPasswordEdit->text().toUtf8() ); QByteArray userpw = hash->result(); - delete hash; + delete hash; + close(); + // Compare the password hashes and emit corresponding signal tellin if the password was correct if ( iPasswordHash == userpw.toHex() ) { @@ -88,25 +84,13 @@ void PasswordDialog::okButtonPressed() emit passwordEntered( PasswordDialog::Incorrect ); qDebug() << "Incorrect password!"; } - - // Close the dialog - close(); } void PasswordDialog::cancelButtonPressed() { qDebug() << "PasswordDialog::cancelButtonPressed()"; - - emit passwordEntered( PasswordDialog::Canceled ); - + close(); -} - -PasswordDialog * PasswordDialog::query( QWidget *aParent, const QString &aPassword, const QString &aText, const QString &aTitle ) -{ - // Create a PasswordDialog instance and show it - PasswordDialog* dlg = new PasswordDialog( aParent, aPassword, aText, aTitle ); - dlg->show(); - return dlg; + emit passwordEntered( PasswordDialog::Canceled ); }