Don't let HTML-like filenames be interpreted as HTML strings

So that filenames that look like HTML don't get fancy-formatted when
we show info about them (i.e. on hover)

This patch fixes the same issue in two places:
 - dolphin, by setting Qt::PlainText on the status bar's label
 - konqueror, by escaping setStatusBarText strings emitted by
   DolphinPart

BUG: 321778
FIXED-IN: 4.11.0
REVIEW: 111746
This commit is contained in:
Fabio D'Urso 2013-07-01 02:02:21 +02:00
parent bf2618d7cf
commit 4450f8449a
2 changed files with 4 additions and 1 deletions

View file

@ -58,6 +58,7 @@
#include <QApplication> #include <QApplication>
#include <QClipboard> #include <QClipboard>
#include <QDir> #include <QDir>
#include <QTextDocument>
K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();) K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();)
K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin")) K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
@ -355,7 +356,8 @@ void DolphinPart::slotRequestItemInfo(const KFileItem& item)
if (item.isNull()) { if (item.isNull()) {
updateStatusBar(); updateStatusBar();
} else { } else {
ReadOnlyPart::setStatusBarText(item.getStatusBarInfo()); const QString escapedText = Qt::escape(item.getStatusBarInfo());
ReadOnlyPart::setStatusBarText(QString("<qt>%1</qt>").arg(escapedText));
} }
} }

View file

@ -62,6 +62,7 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent) :
// Initialize text label // Initialize text label
m_label = new QLabel(this); m_label = new QLabel(this);
m_label->setWordWrap(true); m_label->setWordWrap(true);
m_label->setTextFormat(Qt::PlainText);
m_label->installEventFilter(this); m_label->installEventFilter(this);
// Initialize zoom widget // Initialize zoom widget