#include "passwordcheck.h"

PasswordCheck::PasswordCheck( QWidget *parent ) : QWidget( parent )
{
  QVBoxLayout *vLayout = new QVBoxLayout( this );
  QLabel *msg = new QLabel( tr( "Please enter the right password!" ) );
  vLayout->addWidget( msg );
  pass = new QLineEdit();
  pass->setEchoMode( QLineEdit::Password );
  vLayout->addWidget( pass );
  QPushButton *enter = new QPushButton( tr( "Enter password" ) );
  vLayout->addWidget( enter );
  connect( pass, SIGNAL( returnPressed() ), this, SLOT( checkPassword() ) );
  connect( enter, SIGNAL( clicked( bool ) ), this, SLOT( checkPassword() ) );
}

void PasswordCheck::checkPassword( void )
{
  if( pass->text() == "admin" )
    emit enteredRightPassword();
  close();
}
