Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion share/translations/keepassxc_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7369,6 +7369,10 @@ Do you want to overwrite it?</source>
<source>Toggle Password (%1)</source>
<translation>Conmutar contraseña (%1)</translation>
</message>
<message>
<source>Copy Password</source>
<translation>Copiar contraseña</translation>
</message>
<message>
<source>Generate Password (%1)</source>
<translation>Generar contraseña (%1)</translation>
Expand Down Expand Up @@ -10668,4 +10672,4 @@ Ejemplo: JBSWY3DPEHPK3PXP</translation>
<translation>Desconocido</translation>
</message>
</context>
</TS>
</TS>
13 changes: 13 additions & 0 deletions src/gui/PasswordWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "ui_PasswordWidget.h"

#include "core/Config.h"
#include "gui/Clipboard.h"
#include "core/PasswordHealth.h"
#include "gui/Font.h"
#include "gui/Icons.h"
Expand Down Expand Up @@ -83,6 +84,13 @@ PasswordWidget::PasswordWidget(QWidget* parent)
m_ui->passwordEdit->addAction(m_passwordGeneratorAction, QLineEdit::TrailingPosition);
m_passwordGeneratorAction->setVisible(false);

m_copyToClipboardAction = new QAction(
icons()->icon("edit-copy"),
tr("Copy Password"),
this);
m_ui->passwordEdit->addAction(m_copyToClipboardAction, QLineEdit::TrailingPosition);
connect(m_copyToClipboardAction, &QAction::triggered, this, &PasswordWidget::copyPasswordToClipboard);

m_capslockAction =
new QAction(icons()->icon("dialog-warning", true, StateColorPalette().color(StateColorPalette::Error)),
tr("Warning: Caps Lock enabled!"),
Expand Down Expand Up @@ -185,6 +193,11 @@ bool PasswordWidget::isPasswordVisible() const
return m_ui->passwordEdit->echoMode() == QLineEdit::Normal;
}

void PasswordWidget::copyPasswordToClipboard()
{
clipboard()->setText(m_ui->passwordEdit->text());
}

void PasswordWidget::popupPasswordGenerator()
{
auto generator = PasswordGeneratorWidget::popupGenerator(this);
Expand Down
2 changes: 2 additions & 0 deletions src/gui/PasswordWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private slots:
void popupPasswordGenerator();
void updateRepeatStatus();
void updatePasswordStrength(const QString& password);
void copyPasswordToClipboard();

private:
void checkCapslockState();
Expand All @@ -74,6 +75,7 @@ private slots:
QPointer<QAction> m_correctAction;
QPointer<QAction> m_toggleVisibleAction;
QPointer<QAction> m_passwordGeneratorAction;
QPointer<QAction> m_copyToClipboardAction;
QPointer<QAction> m_capslockAction;
QPointer<PasswordWidget> m_repeatPasswordWidget;
QPointer<PasswordWidget> m_parentPasswordWidget;
Expand Down