- Re-factored the code so that Engine is now the main class that owns WindowManager...
[qtmeetings] / src / UserInterface / Utils / PasswordDialog.cpp
index 332b0b6..778d32a 100644 (file)
@@ -7,18 +7,12 @@
 #include <QtDebug>
 #include <QLabel>
 
-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 );
 }