#include <passworddialog.h>
Public Member Functions | |
YAPET::Key * | getKey () const |
Returns the key generated from the password. | |
PasswordDialog (PWTYPE pt, std::string fn) throw (YAPETUI::UIException) | |
Constructor. | |
void | refresh () throw (YAPETUI::UIException) |
void | resize () throw (YAPETUI::UIException) |
void | run () throw (YAPETUI::UIException) |
Displays the password dialog. | |
~PasswordDialog () | |
Private Types | |
enum | { HEIGHT_NEW = 9, HEIGHT_EX = 7 } |
Private Member Functions | |
void | createWindow () throw (YAPETUI::UIException) |
int | getHeight () const |
int | getStartX () const |
int | getStartY () const |
int | getWidth () const |
const PasswordDialog & | operator= (const PasswordDialog &) |
PasswordDialog (const PasswordDialog &) | |
Private Attributes | |
YAPETUI::Button * | cancelbutton |
std::string | filename |
YAPET::Key * | key |
YAPETUI::Button * | okbutton |
YAPETUI::PasswordWidget * | pwidget1 |
YAPETUI::PasswordWidget * | pwidget2 |
PWTYPE | pwtype |
WINDOW * | window |
PWTYPE
, it shows either one or two password input widgets. If PWTYPE
is NEW_PW
, it shows two input widgets, one for the password and the other to confirm the password. If the passwords matches and the user doesn't cancel the dialog, a Key
is generated and put on the heap. The pointer to the key can be obtained by calling getKey()
. The memory occupied by this key is NOT freed by this class.
If PWTYPE
is EXISTING_PW
, only one widget for entering the password is displayed. The same rules as for NEW_PW
apply in regard to the key.
Definition at line 81 of file passworddialog.h.
anonymous enum [private] |
PasswordDialog::PasswordDialog | ( | const PasswordDialog & | ) | [inline, private] |
Definition at line 98 of file passworddialog.h.
PasswordDialog::PasswordDialog | ( | PWTYPE | pt, | |
std::string | fn | |||
) | throw (YAPETUI::UIException) |
Sets up the dialog, but does not show it. Use run()
to display the dialog to the user.
pt | the type of the dialog. NEW_PW for asking for a new password with confirmation, or EXISTING_PW for asking for an existing password. | |
fn | the filename of the file for which the password is asked. |
Definition at line 50 of file passworddialog.cc.
References createWindow().
PasswordDialog::~PasswordDialog | ( | ) |
Definition at line 62 of file passworddialog.cc.
References cancelbutton, NEW_PW, okbutton, pwidget1, pwidget2, pwtype, and window.
void PasswordDialog::createWindow | ( | ) | throw (YAPETUI::UIException) [private] |
Definition at line 24 of file passworddialog.cc.
References cancelbutton, getHeight(), YAPETUI::Button::getLength(), getStartX(), getStartY(), getWidth(), NEW_PW, okbutton, pwidget1, pwidget2, pwtype, and window.
Referenced by PasswordDialog(), and resize().
int PasswordDialog::getHeight | ( | ) | const [inline, private] |
Definition at line 105 of file passworddialog.h.
References HEIGHT_EX, HEIGHT_NEW, NEW_PW, and pwtype.
Referenced by createWindow(), and getStartY().
YAPET::Key* PasswordDialog::getKey | ( | ) | const [inline] |
Use this function to get the key generated from the password entered. If the dialog has been canceled or the passwords do not match in case of entering a fresh password, NULL
is returned.
The caller is responsible for freeing the memory occupied by the key.
NULL
if no key was/could be generated. The memory occupied by the key has to be freed by the caller. Definition at line 159 of file passworddialog.h.
References key.
Referenced by MainWindow::changePassword(), MainWindow::createFile(), MainWindow::lockScreen(), and MainWindow::openFile().
int PasswordDialog::getStartX | ( | ) | const [inline, private] |
Definition at line 112 of file passworddialog.h.
References getWidth(), and YAPETUI::BaseWindow::maxX().
Referenced by createWindow().
int PasswordDialog::getStartY | ( | ) | const [inline, private] |
Definition at line 116 of file passworddialog.h.
References getHeight(), and YAPETUI::BaseWindow::maxY().
Referenced by createWindow().
int PasswordDialog::getWidth | ( | ) | const [inline, private] |
Definition at line 101 of file passworddialog.h.
References YAPETUI::BaseWindow::maxX().
Referenced by createWindow(), and getStartX().
const PasswordDialog& PasswordDialog::operator= | ( | const PasswordDialog & | ) | [inline, private] |
Definition at line 99 of file passworddialog.h.
void PasswordDialog::refresh | ( | ) | throw (YAPETUI::UIException) [virtual] |
Implements YAPETUI::BaseWindow.
Definition at line 163 of file passworddialog.cc.
References box(), cancelbutton, filename, YAPETUI::MESSAGEBOX, NEW_PW, okbutton, pwidget1, pwidget2, pwtype, YAPETUI::Button::refresh(), YAPETUI::PasswordWidget::refresh(), YAPETUI::Colors::setcolor(), and window.
Referenced by run().
void PasswordDialog::resize | ( | ) | throw (YAPETUI::UIException) [virtual] |
Implements YAPETUI::BaseWindow.
Definition at line 139 of file passworddialog.cc.
References cancelbutton, YAPETUI::InputWidget::clearText(), createWindow(), NEW_PW, okbutton, pwidget1, pwidget2, pwtype, and window.
void PasswordDialog::run | ( | ) | throw (YAPETUI::UIException) |
Displays the password dialog. Use getKey()
for obtaining the key generated from the password.
Definition at line 73 of file passworddialog.cc.
References cancelbutton, YAPETUI::InputWidget::clearText(), YAPETUI::Button::focus(), YAPETUI::InputWidget::focus(), YAPETUI::InputWidget::getText(), key, NEW_PW, okbutton, pwidget1, pwidget2, pwtype, refresh(), YAPETUI::BaseWindow::resizeAll(), YAPETUI::MessageBox::run(), and YAPETUI::InputWidget::setText().
Referenced by MainWindow::changePassword(), MainWindow::createFile(), MainWindow::lockScreen(), and MainWindow::openFile().
YAPETUI::Button* PasswordDialog::cancelbutton [private] |
Definition at line 92 of file passworddialog.h.
Referenced by createWindow(), refresh(), resize(), run(), and ~PasswordDialog().
std::string PasswordDialog::filename [private] |
YAPET::Key* PasswordDialog::key [private] |
YAPETUI::Button* PasswordDialog::okbutton [private] |
Definition at line 91 of file passworddialog.h.
Referenced by createWindow(), refresh(), resize(), run(), and ~PasswordDialog().
YAPETUI::PasswordWidget* PasswordDialog::pwidget1 [private] |
Definition at line 89 of file passworddialog.h.
Referenced by createWindow(), refresh(), resize(), run(), and ~PasswordDialog().
YAPETUI::PasswordWidget* PasswordDialog::pwidget2 [private] |
Definition at line 90 of file passworddialog.h.
Referenced by createWindow(), refresh(), resize(), run(), and ~PasswordDialog().
PWTYPE PasswordDialog::pwtype [private] |
Definition at line 93 of file passworddialog.h.
Referenced by createWindow(), getHeight(), refresh(), resize(), run(), and ~PasswordDialog().
WINDOW* PasswordDialog::window [private] |
Definition at line 88 of file passworddialog.h.
Referenced by createWindow(), refresh(), resize(), and ~PasswordDialog().