[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasma-workspace] dataengines/notifications: Escape ampersands in notifications
From: Kai Uwe Broulik <kde () privat ! broulik ! de>
Date: 2014-11-30 20:33:21
Message-ID: E1XvBBJ-0002VA-Tn () scm ! kde ! org
[Download RAW message or body]
Git commit b68652358f433b5be42e2055c8b7eb7432e3b7a4 by Kai Uwe Broulik.
Committed on 30/11/2014 at 20:32.
Pushed by broulik into branch 'master'.
Escape ampersands in notifications
REVIEW: 121296
M +5 -1 dataengines/notifications/notificationsengine.cpp
http://commits.kde.org/plasma-workspace/b68652358f433b5be42e2055c8b7eb7432e3b7a4
diff --git a/dataengines/notifications/notificationsengine.cpp \
b/dataengines/notifications/notificationsengine.cpp index 8bc50e7..d4b7f19 100644
--- a/dataengines/notifications/notificationsengine.cpp
+++ b/dataengines/notifications/notificationsengine.cpp
@@ -215,8 +215,12 @@ uint NotificationsEngine::Notify(const QString &app_name, uint \
replaces_id,
const QString source = QString("notification %1").arg(id);
- QString bodyFinal = partOf == 0 ? body : _body;
+ QString bodyFinal = (partOf == 0 ? body : _body);
bodyFinal = bodyFinal.replace(QLatin1String("\n"), QLatin1String("<br/>"));
+ // This fancy RegExp escapes every occurence of & since QtQuick Text will \
blatantly cut off + // text where it finds a stray ampersand.
+ // Only &{apos, quot, gt, lt, amp}; as well as { character references will \
be allowed + bodyFinal.replace(QRegularExpression("&(?!(?:apos|quot|[gl]t|amp);|#)"), \
QLatin1String("&"));
Plasma::DataEngine::Data notificationData;
notificationData.insert("id", QString::number(id));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic