~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to filters/kocrypt/pwdprompt.cc

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of the KDE project
2
 
   Copyright (C) 2001 George Staikos <staikos@kde.org>
3
 
 
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.
8
 
 
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.
13
 
 
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.
18
 
*/
19
 
 
20
 
#include <kapp.h>
21
 
#include <config.h>
22
 
#include <qstring.h>
23
 
#include <kdebug.h>
24
 
 
25
 
#include "pwdprompt.h"
26
 
 
27
 
#include <qlayout.h>
28
 
#include <klineedit.h>
29
 
#include <qlabel.h>
30
 
#include <qpushbutton.h>
31
 
#include <kdialog.h>
32
 
#include <klocale.h>
33
 
#include <kmessagebox.h>
34
 
 
35
 
PasswordPrompt::~PasswordPrompt() {
36
 
   QApplication::restoreOverrideCursor();
37
 
}
38
 
 
39
 
 
40
 
PasswordPrompt::PasswordPrompt(bool import, QWidget *parent, const char *name) 
41
 
: KDialog(parent, name, true) {
42
 
   _password = QString::null;
43
 
   _importer = import;
44
 
 
45
 
QGridLayout *grid = new QGridLayout(this, 3, 6, KDialog::marginHint(),
46
 
                                                KDialog::spacingHint());
47
 
 
48
 
   _pwd = new KLineEdit(this);
49
 
   if (_importer)
50
 
     _prompt = new QLabel(i18n("Enter the passphrase for the document:"), this);
51
 
   else
52
 
     _prompt = new QLabel(i18n("Enter a passphrase for the document:"), this);
53
 
 
54
 
   _ok = new QPushButton(i18n("&Ok"), this);
55
 
   _cancel = new QPushButton(i18n("&Cancel"), this);
56
 
 
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);
62
 
 
63
 
   if (!_importer) {
64
 
      // display the "approximate strength" indicator and connect
65
 
      // the keyin signal to the updater
66
 
   }
67
 
 
68
 
   grid->activate();
69
 
 
70
 
   _pwd->setFocus();
71
 
 
72
 
   QApplication::setOverrideCursor(Qt::arrowCursor);
73
 
 
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&)));
77
 
}
78
 
 
79
 
 
80
 
void PasswordPrompt::doOk(const QString&) {
81
 
   ok();
82
 
}
83
 
 
84
 
 
85
 
void PasswordPrompt::ok() {
86
 
   if (!_importer) {
87
 
      KMessageBox::information(NULL, "Documents saved with this version of the filter will not be readable in the near future.",
88
 
                           "Cryptofilter");
89
 
   }
90
 
   _password = _ok->text();
91
 
   emit setPassword(_pwd->text());
92
 
   accept();
93
 
}
94
 
 
95
 
 
96
 
void PasswordPrompt::cancel() {
97
 
   emit setPassword(QString::null);
98
 
   reject();
99
 
}
100
 
 
101
 
 
102
 
QString& PasswordPrompt::getPassword() {
103
 
  return _password;
104
 
}
105
 
 
106
 
 
107
 
 
108
 
#include "pwdprompt.moc"
109