Use an icon for the button that shows/masks passwords.

Closes #38

Additionally make use of the new PasswordEdit class where possible.
This commit is contained in:
Felix Geyer 2014-01-12 17:08:36 +01:00
parent 8b437821a2
commit 223c5a1651
12 changed files with 39 additions and 77 deletions

View file

@ -20,6 +20,7 @@
#include "core/Config.h"
#include "core/Database.h"
#include "core/FilePath.h"
#include "gui/FileDialog.h"
#include "gui/MessageBox.h"
#include "format/KeePass2Reader.h"
@ -40,7 +41,9 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
connect(m_ui->buttonTogglePassword, SIGNAL(toggled(bool)), SLOT(togglePassword(bool)));
m_ui->buttonTogglePassword->setIcon(filePath()->onOffIcon("actions", "password-show"));
connect(m_ui->buttonTogglePassword, SIGNAL(toggled(bool)),
m_ui->editPassword, SLOT(setShowPassword(bool)));
connect(m_ui->buttonBrowseFile, SIGNAL(clicked()), SLOT(browseKeyFile()));
connect(m_ui->editPassword, SIGNAL(textChanged(QString)), SLOT(activatePassword()));
@ -155,11 +158,6 @@ void DatabaseOpenWidget::reject()
Q_EMIT editFinished(false);
}
void DatabaseOpenWidget::togglePassword(bool checked)
{
m_ui->editPassword->setEchoMode(checked ? QLineEdit::Password : QLineEdit::Normal);
}
void DatabaseOpenWidget::activatePassword()
{
m_ui->checkPassword->setChecked(true);