]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Don't let HTML-like filenames be interpreted as HTML strings
authorFabio D'Urso <fabiodurso@hotmail.it>
Mon, 1 Jul 2013 00:02:21 +0000 (02:02 +0200)
committerFabio D'Urso <fabiodurso@hotmail.it>
Mon, 29 Jul 2013 09:21:55 +0000 (11:21 +0200)
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

src/dolphinpart.cpp
src/statusbar/dolphinstatusbar.cpp

index e8138eb8e9f2d54554e37eeb2f0d9e8439dc4234..fc7b74dc0cca431c89003f1b22ea203a7651de16 100644 (file)
@@ -58,6 +58,7 @@
 #include <QApplication>
 #include <QClipboard>
 #include <QDir>
 #include <QApplication>
 #include <QClipboard>
 #include <QDir>
+#include <QTextDocument>
 
 K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();)
 K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
 
 K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();)
 K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
@@ -355,7 +356,8 @@ void DolphinPart::slotRequestItemInfo(const KFileItem& item)
     if (item.isNull()) {
         updateStatusBar();
     } else {
     if (item.isNull()) {
         updateStatusBar();
     } else {
-        ReadOnlyPart::setStatusBarText(item.getStatusBarInfo());
+        const QString escapedText = Qt::escape(item.getStatusBarInfo());
+        ReadOnlyPart::setStatusBarText(QString("<qt>%1</qt>").arg(escapedText));
     }
 }
 
     }
 }
 
index 6f734ed4d544478ada354ad41f3a679c85427a2c..14891917208ed4ef665c5f79e27d93694a8d8b48 100644 (file)
@@ -62,6 +62,7 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent) :
     // Initialize text label
     m_label = new QLabel(this);
     m_label->setWordWrap(true);
     // Initialize text label
     m_label = new QLabel(this);
     m_label->setWordWrap(true);
+    m_label->setTextFormat(Qt::PlainText);
     m_label->installEventFilter(this);
 
     // Initialize zoom widget
     m_label->installEventFilter(this);
 
     // Initialize zoom widget