Commit 73fc361d authored by Martin Flöser's avatar Martin Flöser
Browse files

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
parent e36a3c8c
...@@ -24,6 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ...@@ -24,6 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "tabboxconfig.h" #include "tabboxconfig.h"
#include "tabboxhandler.h" #include "tabboxhandler.h"
// Qt // Qt
// TODO: remove with Qt 5, only for HTML escaping the caption
#include <QTextDocument>
#include <QTextStream> #include <QTextStream>
// KDE // KDE
#include <KLocale> #include <KLocale>
...@@ -69,8 +71,13 @@ QVariant ClientModel::data(const QModelIndex& index, int role) const ...@@ -69,8 +71,13 @@ QVariant ClientModel::data(const QModelIndex& index, int role) const
} }
switch(role) { switch(role) {
case Qt::DisplayRole: case Qt::DisplayRole:
case CaptionRole: case CaptionRole: {
return client->caption(); QString caption = client->caption();
if (Qt::mightBeRichText(caption)) {
caption = Qt::escape(caption);
}
return caption;
}
case ClientRole: case ClientRole:
return qVariantFromValue((void*)client.data()); return qVariantFromValue((void*)client.data());
case DesktopNameRole: { case DesktopNameRole: {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment