From e8dfa9cfa1ce72fdb0b85e5f62ad98fd0173364e Mon Sep 17 00:00:00 2001 From: Michel D'HOOGE Date: Sat, 19 Dec 2020 10:49:53 -0500 Subject: [PATCH] Fix display issues of entry attributes in preview pane * Fix #5755 - HTML escape attributes prior to preview * Place attribute preview into a table and convert line breaks --- src/gui/EntryPreviewWidget.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp index 38afbcf24..45a71a348 100644 --- a/src/gui/EntryPreviewWidget.cpp +++ b/src/gui/EntryPreviewWidget.cpp @@ -286,14 +286,18 @@ void EntryPreviewWidget::updateEntryAdvancedTab() setTabEnabled(m_ui->entryTabWidget, m_ui->entryAdvancedTab, hasAttributes || hasAttachments); if (hasAttributes) { - QString attributesText; + QString attributesText(""); for (const QString& key : customAttributes) { - QString value = m_currentEntry->attributes()->value(key); + QString value; if (m_currentEntry->attributes()->isProtected(key)) { value = "" + tr("[PROTECTED]") + ""; + } else { + value = m_currentEntry->attributes()->value(key).toHtmlEscaped(); + value.replace('\n', QLatin1String("
")); } - attributesText.append(tr("%1: %2", "attributes line").arg(key, value).append("
")); + attributesText.append(tr("", "attributes line").arg(key, value)); } + attributesText.append("
%1:%2
"); m_ui->entryAttributesEdit->setText(attributesText); }