53 #include "passphrasedialog.h"
56 #include <kiconloader.h>
57 #include <tdelocale.h>
61 #include <tqfontmetrics.h>
63 struct Kleo::PassphraseDialog::Private {
64 KPasswordEdit * lineedit;
68 Kleo::PassphraseDialog::PassphraseDialog( const TQString & msg, const TQString & caption,
69 TQWidget * parent, const char * name, bool modal )
70 : KDialogBase( parent, name, modal, caption, Ok|Cancel, Ok ), d( 0 )
74 TQWidget * w = new TQWidget( this );
77 TQHBoxLayout * hlay = new TQHBoxLayout( w, 0, spacingHint() );
79 TQLabel * label = new TQLabel( w );
80 label->setPixmap( DesktopIcon( "pgp-keys", TDEIcon::SizeMedium ) );
81 hlay->addWidget( label, 0, AlignTop );
83 TQVBoxLayout * vlay = new TQVBoxLayout( hlay );
85 vlay->addWidget( new TQLabel( msg.isEmpty() ? i18n( "Please enter your passphrase:") : msg, w ) );
87 d->lineedit = new KPasswordEdit( KPasswordEdit::OneStar, w, "d->lineedit" );
88 d->lineedit->setMinimumWidth( fontMetrics().width( "*") * 20 );
89 d->lineedit->setFocus();
91 vlay->addWidget( d->lineedit );
93 connect( d->lineedit, TQ_SIGNAL(returnPressed()), TQ_SLOT(slotOk()) );
99 Kleo::PassphraseDialog::~PassphraseDialog() {
103 TQString Kleo::PassphraseDialog::passphrase() const {
104 return d->lineedit->password();
107 void Kleo::PassphraseDialog::slotOk() {
108 emit finished( passphrase() );
109 KDialogBase::slotOk();
112 void Kleo::PassphraseDialog::slotCancel() {
114 KDialogBase::slotCancel();
118 void Kleo::PassphraseDialog::virtual_hook( int id, void * data ) {
119 return KDialogBase::virtual_hook( id, data );
122 #include "passphrasedialog.moc"
|