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
8 changes: 8 additions & 0 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3150,6 +3150,14 @@ Would you like to correct it?</source>
<source>Reveal</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Copy text into clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Attachments</source>
<translation type="unfinished"></translation>
Expand Down
21 changes: 21 additions & 0 deletions src/gui/entry/EditEntryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/gui/entry/EditEntryWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ private slots:
void updateCurrentAttribute();
void protectCurrentAttribute(bool state);
void toggleCurrentAttributeVisibility();
void copyAttributeText();
void updateAutoTypeEnabled();
void openAutotypeHelp();
void insertAutoTypeAssoc();
Expand Down
24 changes: 17 additions & 7 deletions src/gui/entry/EditEntryWidgetAdvanced.ui
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<item>
<widget class="QSplitter" name="attributesSplitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
Expand All @@ -48,10 +48,10 @@
<string>Attribute selection</string>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
<enum>QAbstractScrollArea::SizeAdjustPolicy::AdjustToContents</enum>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
<enum>QListView::ResizeMode::Adjust</enum>
</property>
</widget>
<widget class="QPlainTextEdit" name="attributesEdit">
Expand Down Expand Up @@ -117,7 +117,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -146,6 +146,16 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="copyTextButton">
<property name="accessibleName">
<string>Copy text into clipboard</string>
</property>
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="revealAttributeButton">
<property name="enabled">
Expand Down Expand Up @@ -236,10 +246,10 @@
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
<enum>QSizePolicy::Policy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -284,7 +294,7 @@
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down
Loading