From 6f908433654da368df0c4e3faba5a166734867a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 23 Nov 2012 08:23:34 +0100 Subject: [PATCH] Escape HTML command in window caption before passing to QML Escaping is performed in the model instead of the UI as each of the QML files needed to be fixed and it is likeley that the issue would come up again. In the model it's hopefully fixed for good. BUG: 309960 FIXED-IN: 4.9.4 REVIEW: 107431 --- tabbox/clientmodel.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tabbox/clientmodel.cpp b/tabbox/clientmodel.cpp index 388180a438..daa063af05 100644 --- a/tabbox/clientmodel.cpp +++ b/tabbox/clientmodel.cpp @@ -24,6 +24,8 @@ along with this program. If not, see . #include "tabboxconfig.h" #include "tabboxhandler.h" // Qt +// TODO: remove with Qt 5, only for HTML escaping the caption +#include #include // KDE #include @@ -69,8 +71,13 @@ QVariant ClientModel::data(const QModelIndex& index, int role) const } switch(role) { case Qt::DisplayRole: - case CaptionRole: - return client->caption(); + case CaptionRole: { + QString caption = client->caption(); + if (Qt::mightBeRichText(caption)) { + caption = Qt::escape(caption); + } + return caption; + } case ClientRole: return qVariantFromValue((void*)client.data()); case DesktopNameRole: {