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, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotOk()) ); 99 Kleo::PassphraseDialog::~PassphraseDialog() { 103 const char * Kleo::PassphraseDialog::passphrase() const { 104 return d->lineedit->password(); 107 void Kleo::PassphraseDialog::slotOk() { 108 const char * pass = passphrase(); 109 emit finished( pass ? pass : "" ); 110 KDialogBase::slotOk(); 113 void Kleo::PassphraseDialog::slotCancel() { 115 KDialogBase::slotCancel(); 119 void Kleo::PassphraseDialog::virtual_hook( int id, void * data ) { 120 return KDialogBase::virtual_hook( id, data ); 123 #include "passphrasedialog.moc"
|