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

@ -18,6 +18,7 @@
#include "ChangeMasterKeyWidget.h"
#include "ui_ChangeMasterKeyWidget.h"
#include "core/FilePath.h"
#include "keys/FileKey.h"
#include "keys/PasswordKey.h"
#include "gui/FileDialog.h"
@ -31,7 +32,9 @@ ChangeMasterKeyWidget::ChangeMasterKeyWidget(QWidget* parent)
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(generateKey()));
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject()));
connect(m_ui->togglePasswordButton, SIGNAL(toggled(bool)), SLOT(togglePassword(bool)));
m_ui->togglePasswordButton->setIcon(filePath()->onOffIcon("actions", "password-show"));
connect(m_ui->togglePasswordButton, SIGNAL(toggled(bool)), m_ui->enterPasswordEdit, SLOT(setShowPassword(bool)));
m_ui->repeatPasswordEdit->enableVerifyMode(m_ui->enterPasswordEdit);
connect(m_ui->createKeyFileButton, SIGNAL(clicked()), SLOT(createKeyFile()));
connect(m_ui->browseKeyFileButton, SIGNAL(clicked()), SLOT(browseKeyFile()));
}
@ -40,12 +43,6 @@ ChangeMasterKeyWidget::~ChangeMasterKeyWidget()
{
}
void ChangeMasterKeyWidget::togglePassword(bool checked)
{
m_ui->enterPasswordEdit->setEchoMode(checked ? QLineEdit::Password : QLineEdit::Normal);
m_ui->repeatPasswordEdit->setEchoMode(checked ? QLineEdit::Password : QLineEdit::Normal);
}
void ChangeMasterKeyWidget::createKeyFile()
{
QString filters = QString("%1 (*.key);;%2 (*)").arg(tr("Key files"), tr("All files"));
@ -77,7 +74,7 @@ void ChangeMasterKeyWidget::clearForms()
{
m_key.clear();
m_ui->passwordGroup->setChecked(true);
m_ui->passwordGroup->setChecked(false);
m_ui->enterPasswordEdit->setText("");
m_ui->repeatPasswordEdit->setText("");
m_ui->keyFileGroup->setChecked(false);