mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-03-11 08:54:48 +00:00
add a button to copy the text of entry attributes
This commit is contained in:
parent
5bd42c4725
commit
210cd13d5f
7 changed files with 74 additions and 10 deletions
|
|
@ -3151,6 +3151,14 @@ Korrigieren?</translation>
|
|||
<source>Reveal</source>
|
||||
<translation>Zeigen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy</source>
|
||||
<translation>Kopieren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy text into clipboard</source>
|
||||
<translation>Text in die Zwischenablage kopieren</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Attachments</source>
|
||||
<translation>Anhänge</translation>
|
||||
|
|
@ -10671,4 +10679,4 @@ Beispiel: JBSWY3DPEHPK3PXP</translation>
|
|||
<translation>Unbekannt</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
</TS>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -3150,6 +3150,14 @@ Would you like to correct it?</translation>
|
|||
<source>Reveal</source>
|
||||
<translation>Reveal</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy</source>
|
||||
<translation>Copy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy text into clipboard</source>
|
||||
<translation>Copy text into clipboard</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Attachments</source>
|
||||
<translation>Attachments</translation>
|
||||
|
|
@ -10671,4 +10679,4 @@ Example: JBSWY3DPEHPK3PXP</translation>
|
|||
<translation>Unknown</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
</TS>
|
||||
|
|
|
|||
|
|
@ -3150,6 +3150,14 @@ Would you like to correct it?</translation>
|
|||
<source>Reveal</source>
|
||||
<translation>Reveal</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy</source>
|
||||
<translation>Copy</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy text into clipboard</source>
|
||||
<translation>Copy text into clipboard</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Attachments</source>
|
||||
<translation>Attachments</translation>
|
||||
|
|
@ -10671,4 +10679,4 @@ Example: JBSWY3DPEHPK3PXP</translation>
|
|||
<translation>Unknown</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
</TS>
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
|
|
@ -989,6 +990,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) {
|
||||
|
|
@ -1518,12 +1520,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);
|
||||
}
|
||||
|
|
@ -1568,6 +1573,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();
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ private slots:
|
|||
void updateCurrentAttribute();
|
||||
void protectCurrentAttribute(bool state);
|
||||
void toggleCurrentAttributeVisibility();
|
||||
void copyAttributeText();
|
||||
void updateAutoTypeEnabled();
|
||||
void openAutotypeHelp();
|
||||
void insertAutoTypeAssoc();
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -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">
|
||||
|
|
@ -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>
|
||||
|
|
@ -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">
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue