Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rendering & and " in password preview #11594

Merged
merged 1 commit into from
Jan 6, 2025
Merged
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: 4 additions & 2 deletions src/gui/EntryPreviewWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void EntryPreviewWidget::updateEntryHeaderLine()
{
Q_ASSERT(m_currentEntry);
const QString title = m_currentEntry->resolveMultiplePlaceholders(m_currentEntry->title());
m_ui->entryTitleLabel->setRawText(hierarchy(m_currentEntry->group(), title.toHtmlEscaped()));
m_ui->entryTitleLabel->setRawText(hierarchy(m_currentEntry->group(), title));
m_ui->entryIcon->setPixmap(Icons::entryIconPixmap(m_currentEntry, IconSize::Large));
}

Expand Down Expand Up @@ -302,10 +302,12 @@ void EntryPreviewWidget::setPasswordVisible(bool state)
html += "<span style=\"color: " + QString(color) + ";\">" + QString(c).toHtmlEscaped() + "</span>";
}
// clang-format on
m_ui->entryPasswordLabel->setTextFormat(Qt::RichText);
m_ui->entryPasswordLabel->setText(html);
} else {
// No color
m_ui->entryPasswordLabel->setText(password.toHtmlEscaped());
m_ui->entryPasswordLabel->setTextFormat(Qt::PlainText);
m_ui->entryPasswordLabel->setText(password);
}
} else if (password.isEmpty() && !config()->get(Config::Security_PasswordEmptyPlaceholder).toBool()) {
m_ui->entryPasswordLabel->setText("");
Expand Down
11 changes: 10 additions & 1 deletion src/gui/EntryPreviewWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<enum>Qt::ClickFocus</enum>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
Expand Down Expand Up @@ -279,6 +279,9 @@
</property>
<item>
<widget class="QLabel" name="entryPasswordLabel">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
<property name="text">
<string notr="true">TextLabel</string>
</property>
Expand Down Expand Up @@ -316,6 +319,9 @@
<property name="text">
<string notr="true">https://example.com</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
Expand Down Expand Up @@ -504,6 +510,9 @@
<property name="text">
<string notr="true">expired</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
Expand Down
Loading