diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts
index f974db170b..ad8d98c8a9 100644
--- a/share/translations/keepassxc_en.ts
+++ b/share/translations/keepassxc_en.ts
@@ -3150,6 +3150,14 @@ Would you like to correct it?
Reveal
+
+ Copy
+
+
+
+ Copy text into clipboard
+
+
Attachments
diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp
index e8a72db1a1..258625b975 100644
--- a/src/gui/entry/EditEntryWidget.cpp
+++ b/src/gui/entry/EditEntryWidget.cpp
@@ -246,6 +246,7 @@ void EditEntryWidget::setupAdvanced()
connect(m_advancedUi->removeAttributeButton, SIGNAL(clicked()), SLOT(removeCurrentAttribute()));
connect(m_advancedUi->protectAttributeButton, SIGNAL(toggled(bool)), SLOT(protectCurrentAttribute(bool)));
connect(m_advancedUi->revealAttributeButton, SIGNAL(clicked(bool)), SLOT(toggleCurrentAttributeVisibility()));
+ connect(m_advancedUi->copyTextButton, SIGNAL(clicked(bool)), SLOT(copyAttributeText()));
connect(m_advancedUi->attributesView->selectionModel(),
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
SLOT(updateCurrentAttribute()));
@@ -995,6 +996,7 @@ void EditEntryWidget::setForms(Entry* entry, bool restore)
m_advancedUi->addAttributeButton->setEnabled(!m_history);
m_advancedUi->editAttributeButton->setEnabled(false);
m_advancedUi->removeAttributeButton->setEnabled(false);
+ m_advancedUi->copyTextButton->setEnabled(false);
m_advancedUi->attributesEdit->setReadOnly(m_history);
QAbstractItemView::EditTriggers editTriggers;
if (m_history) {
@@ -1495,12 +1497,15 @@ void EditEntryWidget::displayAttribute(QModelIndex index, bool showProtected)
m_advancedUi->protectAttributeButton->setEnabled(!m_history);
m_advancedUi->editAttributeButton->setEnabled(!m_history);
m_advancedUi->removeAttributeButton->setEnabled(!m_history);
+
+ m_advancedUi->copyTextButton->setEnabled(true);
} else {
m_advancedUi->attributesEdit->setPlainText("");
m_advancedUi->attributesEdit->setEnabled(false);
m_advancedUi->revealAttributeButton->setEnabled(false);
m_advancedUi->protectAttributeButton->setChecked(false);
m_advancedUi->protectAttributeButton->setEnabled(false);
+ m_advancedUi->copyTextButton->setEnabled(false);
m_advancedUi->editAttributeButton->setEnabled(false);
m_advancedUi->removeAttributeButton->setEnabled(false);
}
@@ -1545,6 +1550,22 @@ void EditEntryWidget::toggleCurrentAttributeVisibility()
}
}
+void EditEntryWidget::copyAttributeText()
+{
+ QString value;
+ if (m_advancedUi->attributesEdit->isEnabled()) {
+ value = m_advancedUi->attributesEdit->toPlainText();
+ } else {
+ QModelIndex index = m_advancedUi->attributesView->currentIndex();
+ if (index.isValid()) {
+ QString key = m_attributesModel->keyByIndex(index);
+ value = m_entryAttributes->value(key);
+ }
+ }
+
+ clipboard()->setText(value);
+}
+
void EditEntryWidget::updateAutoTypeEnabled()
{
bool autoTypeEnabled = m_autoTypeUi->enableButton->isChecked();
diff --git a/src/gui/entry/EditEntryWidget.h b/src/gui/entry/EditEntryWidget.h
index 3fce4d56d0..ba5a4e307c 100644
--- a/src/gui/entry/EditEntryWidget.h
+++ b/src/gui/entry/EditEntryWidget.h
@@ -107,6 +107,7 @@ private slots:
void updateCurrentAttribute();
void protectCurrentAttribute(bool state);
void toggleCurrentAttributeVisibility();
+ void copyAttributeText();
void updateAutoTypeEnabled();
void openAutotypeHelp();
void insertAutoTypeAssoc();
diff --git a/src/gui/entry/EditEntryWidgetAdvanced.ui b/src/gui/entry/EditEntryWidgetAdvanced.ui
index 044145226d..e13c3c2754 100644
--- a/src/gui/entry/EditEntryWidgetAdvanced.ui
+++ b/src/gui/entry/EditEntryWidgetAdvanced.ui
@@ -32,7 +32,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
false
@@ -48,10 +48,10 @@
Attribute selection
- QAbstractScrollArea::AdjustToContents
+ QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents
- QListView::Adjust
+ QListView::ResizeMode::Adjust
@@ -117,7 +117,7 @@
-
- Qt::Vertical
+ Qt::Orientation::Vertical
@@ -146,6 +146,16 @@
+ -
+
+
+ Copy text into clipboard
+
+
+ Copy
+
+
+
-
@@ -236,10 +246,10 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal
- QSizePolicy::Maximum
+ QSizePolicy::Policy::Maximum
@@ -284,7 +294,7 @@
-
- Qt::Horizontal
+ Qt::Orientation::Horizontal