Don't escape notification title text

Notifications don't support markup in title text, so escaping it causes
unintended HTML entities like & to show up instead of the actual
text.


(cherry picked from commit 26a8ca7fe9)
This commit is contained in:
Bharadwaj Raju 2021-02-02 12:54:16 +00:00 committed by Nicolas Fella
parent fbc827e373
commit 893ede6960

View file

@ -88,15 +88,16 @@ void Notification::createKNotification(const NetworkPacket& np)
}
QString escapedTitle = m_title.toHtmlEscaped();
// notification title text does not have markup, but in some cases below it is used in body text so we escape it
QString escapedText = m_text.toHtmlEscaped();
QString escapedTicker = m_ticker.toHtmlEscaped();
if (NotificationServerInfo::instance().supportedHints().testFlag(NotificationServerInfo::X_KDE_DISPLAY_APPNAME)) {
m_notification->setTitle(escapedTitle);
m_notification->setTitle(m_title);
m_notification->setText(escapedText);
m_notification->setHint(QStringLiteral("x-kde-display-appname"), m_appName.toHtmlEscaped());
} else {
m_notification->setTitle(m_appName.toHtmlEscaped());
m_notification->setTitle(m_appName);
if (m_title.isEmpty() && m_text.isEmpty()) {
m_notification->setText(escapedTicker);