1
/* This file is part of the KDE project
2
Copyright (C) 2001 George Staikos <staikos@kde.org>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Library General Public License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to
16
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
Boston, MA 02111-1307, USA.
25
#include "pwdprompt.h"
28
#include <klineedit.h>
30
#include <qpushbutton.h>
33
#include <kmessagebox.h>
35
PasswordPrompt::~PasswordPrompt() {
36
QApplication::restoreOverrideCursor();
40
PasswordPrompt::PasswordPrompt(bool import, QWidget *parent, const char *name)
41
: KDialog(parent, name, true) {
42
_password = QString::null;
45
QGridLayout *grid = new QGridLayout(this, 3, 6, KDialog::marginHint(),
46
KDialog::spacingHint());
48
_pwd = new KLineEdit(this);
50
_prompt = new QLabel(i18n("Enter the passphrase for the document:"), this);
52
_prompt = new QLabel(i18n("Enter a passphrase for the document:"), this);
54
_ok = new QPushButton(i18n("&Ok"), this);
55
_cancel = new QPushButton(i18n("&Cancel"), this);
57
_pwd->setMaxLength(56);
58
grid->addMultiCellWidget(_prompt, 0, 0, 0, 5);
59
grid->addMultiCellWidget(_pwd, 1, 1, 0, 4);
60
grid->addMultiCellWidget(_ok, 2, 2, 3, 3);
61
grid->addMultiCellWidget(_cancel, 2, 2, 4, 4);
64
// display the "approximate strength" indicator and connect
65
// the keyin signal to the updater
72
QApplication::setOverrideCursor(Qt::arrowCursor);
74
connect(_ok, SIGNAL(pressed()), this, SLOT(ok()));
75
connect(_cancel, SIGNAL(pressed()), this, SLOT(cancel()));
76
connect(_pwd, SIGNAL(returnPressed(const QString&)), this, SLOT(doOk(const QString&)));
80
void PasswordPrompt::doOk(const QString&) {
85
void PasswordPrompt::ok() {
87
KMessageBox::information(NULL, "Documents saved with this version of the filter will not be readable in the near future.",
90
_password = _ok->text();
91
emit setPassword(_pwd->text());
96
void PasswordPrompt::cancel() {
97
emit setPassword(QString::null);
102
QString& PasswordPrompt::getPassword() {
108
#include "pwdprompt.moc"