Merge pull request #606 from hifi/add-copy-to-pwgen

Add copy button to password generator (#595)
This commit is contained in:
TheZ3ro 2017-06-04 20:44:04 +02:00 committed by GitHub
commit 3c51455fa3
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">