Escape HTML tags in window caption in Aurorae and Killer

The unescaped tags are interpreted as HTML by Aurorae decorations
and the KWin killer. Escaping the tags ensures that the text is not
rendered incorrectly.

BUG: 293657
FIXED-IN: 4.9.0
REVIEW: 104989
This commit is contained in:
Martin Gräßlin 2012-05-19 10:20:03 +02:00
parent 4643b59b0f
commit ea8db29c2b
2 changed files with 6 additions and 0 deletions

View file

@ -151,6 +151,7 @@ Decoration {
Text { Text {
id: caption id: caption
text: decoration.caption text: decoration.caption
textFormat: Text.PlainText
horizontalAlignment: auroraeTheme.horizontalAlignment horizontalAlignment: auroraeTheme.horizontalAlignment
verticalAlignment: auroraeTheme.verticalAlignment verticalAlignment: auroraeTheme.verticalAlignment
elide: Text.ElideRight elide: Text.ElideRight

View file

@ -32,6 +32,8 @@ DEALINGS IN THE SOFTWARE.
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <QX11Info> #include <QX11Info>
#include <QProcess> #include <QProcess>
// TODO: remove with Qt 5, only for HTML escaping the caption
#include <QTextDocument>
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
@ -66,6 +68,9 @@ int main(int argc, char* argv[])
KCmdLineArgs::usageError(i18n("This helper utility is not supposed to be called directly.")); KCmdLineArgs::usageError(i18n("This helper utility is not supposed to be called directly."));
return 1; return 1;
} }
if (Qt::mightBeRichText(caption)) {
caption = Qt::escape(caption);
}
QString question = i18n( QString question = i18n(
"<p>The window \"<b>%2</b>\" is not responding. " "<p>The window \"<b>%2</b>\" is not responding. "
"It belongs to the application <b>%1</b> (Process ID = %3, hostname = %4).</p>" "It belongs to the application <b>%1</b> (Process ID = %3, hostname = %4).</p>"