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
This commit is contained in:
parent
3183b98012
commit
6f90843365
1 changed files with 9 additions and 2 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
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: {
|
||||||
|
|
Loading…
Reference in a new issue