1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file './passwddialogbase.ui'
**
** Created: Sat Jul 14 05:38:24 2001
** by: The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "passwddialogbase.h"
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a PasswdDialogBase which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
PasswdDialogBase::PasswdDialogBase( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "PasswdDialogBase" );
resize( 420, 160 );
setCaption( i18n( "Password Dialog" ) );
setMinimumSize( QSize( 420, 160 ) );
setMaximumSize( QSize( 420, 160 ) );
setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sizePolicy().hasHeightForWidth() ) );
QToolTip::add( this, i18n( "Please edit the password and press the OK button or the Enter key for setting it." ) );
QWhatsThis::add( this, i18n( "A dialog for setting the account password." ) );
passwdLabel = new QLabel( this, "passwdLabel" );
passwdLabel->setGeometry( QRect( 30, 60, 60, 20 ) );
passwdLabel->setText( i18n( "Password:" ) );
passwdLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, passwdLabel->sizePolicy().hasHeightForWidth() ) );
okButton = new QPushButton( this, "okButton" );
okButton->setGeometry( QRect( 80, 110, 91, 31 ) );
okButton->setText( i18n( "OK" ) );
okButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, okButton->sizePolicy().hasHeightForWidth() ) );
QToolTip::add( okButton, i18n( "The OK button sets the password" ) );
QWhatsThis::add( okButton, i18n( "The button sets the password and close the dialog." ) );
cancelButton = new QPushButton( this, "cancelButton" );
cancelButton->setGeometry( QRect( 240, 110, 91, 31 ) );
cancelButton->setText( i18n( "Cancel" ) );
cancelButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, cancelButton->sizePolicy().hasHeightForWidth() ) );
QToolTip::add( cancelButton, i18n( "The Cancel button will close the dialog and it doesn't set the password." ) );
QWhatsThis::add( cancelButton, i18n( "The button close the dialog without setting the password." ) );
accountLabel = new QLabel( this, "accountLabel" );
accountLabel->setGeometry( QRect( 30, 20, 60, 20 ) );
accountLabel->setText( i18n( "Account:" ) );
accountLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, accountLabel->sizePolicy().hasHeightForWidth() ) );
accountLabel->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignLeft ) );
accountNameLabel = new QLabel( this, "accountNameLabel" );
accountNameLabel->setGeometry( QRect( 110, 20, 281, 21 ) );
accountNameLabel->setText( i18n( "default" ) );
accountNameLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, accountNameLabel->sizePolicy().hasHeightForWidth() ) );
QFont accountNameLabel_font( accountNameLabel->font() );
accountNameLabel_font.setPointSize( 12 );
accountNameLabel_font.setBold( TRUE );
accountNameLabel->setFont( accountNameLabel_font );
passwdEdit = new QLineEdit( this, "passwdEdit" );
passwdEdit->setGeometry( QRect( 110, 60, 280, 22 ) );
passwdEdit->setEchoMode( QLineEdit::Password );
passwdEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, passwdEdit->sizePolicy().hasHeightForWidth() ) );
// signals and slots connections
connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( passwdEdit, SIGNAL( returnPressed() ), this, SLOT( accept() ) );
// tab order
setTabOrder( passwdEdit, okButton );
setTabOrder( okButton, cancelButton );
}
/*
* Destroys the object and frees any allocated resources
*/
PasswdDialogBase::~PasswdDialogBase()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Main event handler. Reimplemented to handle application
* font changes
*/
bool PasswdDialogBase::event( QEvent* ev )
{
bool ret = QDialog::event( ev );
if ( ev->type() == QEvent::ApplicationFontChange ) {
QFont accountNameLabel_font( accountNameLabel->font() );
accountNameLabel_font.setPointSize( 12 );
accountNameLabel_font.setBold( TRUE );
accountNameLabel->setFont( accountNameLabel_font );
}
return ret;
}
#include "passwddialogbase.moc"
|