| 1 | /*
|
|---|
| 2 | * passphrasedlg.cpp - class to handle entering of OpenPGP passphrase
|
|---|
| 3 | * Copyright (C) 2003 Justin Karneges
|
|---|
| 4 | *
|
|---|
| 5 | * This program is free software; you can redistribute it and/or
|
|---|
| 6 | * modify it under the terms of the GNU General Public License
|
|---|
| 7 | * as published by the Free Software Foundation; either version 2
|
|---|
| 8 | * of the License, or (at your option) any later version.
|
|---|
| 9 | *
|
|---|
| 10 | * This program is distributed in the hope that it will be useful,
|
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 13 | * GNU General Public License for more details.
|
|---|
| 14 | *
|
|---|
| 15 | * You should have received a copy of the GNU General Public License
|
|---|
| 16 | * along with this library; if not, write to the Free Software
|
|---|
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 18 | *
|
|---|
| 19 | */
|
|---|
| 20 |
|
|---|
| 21 | #include"passphrasedlg.h"
|
|---|
| 22 |
|
|---|
| 23 | #include<qlineedit.h>
|
|---|
| 24 | #include<qradiobutton.h>
|
|---|
| 25 | #include<qpushbutton.h>
|
|---|
| 26 | #include"iconwidget.h"
|
|---|
| 27 |
|
|---|
| 28 | PassphraseDlg::PassphraseDlg(QWidget *parent, const char *name)
|
|---|
| 29 | :PassphraseUI(parent, name, true, WDestructiveClose)
|
|---|
| 30 | {
|
|---|
| 31 | connect(pb_ok, SIGNAL(clicked()), SLOT(doOK()));
|
|---|
| 32 | connect(pb_cancel, SIGNAL(clicked()), SLOT(reject()));
|
|---|
| 33 | resize(minimumSize());
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | PassphraseDlg::~PassphraseDlg()
|
|---|
| 37 | {
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | QString PassphraseDlg::passphrase() const
|
|---|
| 41 | {
|
|---|
| 42 | return le_pass->text();
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | void PassphraseDlg::reject()
|
|---|
| 46 | {
|
|---|
| 47 | rejectPassphrase();
|
|---|
| 48 | QDialog::reject();
|
|---|
| 49 | }
|
|---|
| 50 |
|
|---|
| 51 | void PassphraseDlg::doOK()
|
|---|
| 52 | {
|
|---|
| 53 | le_pass->setEnabled(false);
|
|---|
| 54 | pb_ok->setEnabled(false);
|
|---|
| 55 |
|
|---|
| 56 | submitPassphrase(le_pass->text());
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 | void PassphraseDlg::unblock()
|
|---|
| 60 | {
|
|---|
| 61 | le_pass->setText("");
|
|---|
| 62 | le_pass->setEnabled(true);
|
|---|
| 63 | pb_ok->setEnabled(true);
|
|---|
| 64 | le_pass->setFocus();
|
|---|
| 65 | }
|
|---|