Add copy button to password generator (#595)

This commit is contained in:
Toni Spets 2017-05-28 20:47:33 +03:00
parent 9fc83c7cd5
commit 398201f592
3 changed files with 15 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include "core/Config.h"
#include "core/PasswordGenerator.h"
#include "core/FilePath.h"
#include "gui/Clipboard.h"
PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
: QWidget(parent)
@ -40,6 +41,7 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
connect(m_ui->editNewPassword, SIGNAL(textChanged(QString)), SLOT(updatePasswordStrength(QString)));
connect(m_ui->togglePasswordButton, SIGNAL(toggled(bool)), SLOT(togglePasswordShown(bool)));
connect(m_ui->buttonApply, SIGNAL(clicked()), SLOT(applyPassword()));
connect(m_ui->buttonCopy, SIGNAL(clicked()), SLOT(copyPassword()));
connect(m_ui->buttonGenerate, SIGNAL(clicked()), SLOT(regeneratePassword()));
connect(m_ui->sliderLength, SIGNAL(valueChanged(int)), SLOT(passwordSliderMoved()));
@ -193,6 +195,11 @@ void PasswordGeneratorWidget::applyPassword()
emit dialogTerminated();
}
void PasswordGeneratorWidget::copyPassword()
{
clipboard()->setText(m_ui->editNewPassword->text());
}
void PasswordGeneratorWidget::passwordSliderMoved()
{
if (m_updatingSpinBox) {

View File

@ -57,6 +57,7 @@ signals:
private slots:
void applyPassword();
void copyPassword();
void updateApplyEnabled(const QString& password);
void updatePasswordStrength(const QString& password);
void togglePasswordShown(bool hidden);

View File

@ -612,6 +612,13 @@ QProgressBar::chunk {
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonCopy">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonApply">
<property name="enabled">