summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-10-14 17:00:35 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-10-14 17:00:35 +0200
commit8893e39a048a68864770403e4b99feda67464d70 (patch)
treece09e8888caebaa88ede5724fff72777e97adf6b /src
parentFix crash on private mode store/restore (diff)
downloadrekonq-8893e39a048a68864770403e4b99feda67464d70.tar.xz
Sanitizing strings...
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp7
-rw-r--r--src/protocolhandler.cpp5
2 files changed, 8 insertions, 4 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index abd5455a..23ccf25d 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -99,6 +99,7 @@
#include <QtWebKit/QWebHistory>
#include <QSignalMapper>
+#include <QTextDocument>
MainWindow::MainWindow()
@@ -1196,6 +1197,8 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
break;
}
+ QString msgToShow = Qt::escape(msg);
+
// useful values
WebTab *tab = m_view->currentWebTab();
@@ -1208,13 +1211,13 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
// Set Popup size
QFontMetrics fm = m_popup->fontMetrics();
- QSize labelSize(fm.width(msg) + 2 * margin, fm.height() + 2 * margin);
+ QSize labelSize(fm.width(msgToShow) + 2 * margin, fm.height() + 2 * margin);
if (labelSize.width() > halfWidth)
labelSize.setWidth(halfWidth);
m_popup->setFixedSize(labelSize);
- m_popup->setText(fm.elidedText(msg, Qt::ElideMiddle, labelSize.width() - 2 * margin));
+ m_popup->setText(fm.elidedText(msgToShow, Qt::ElideMiddle, labelSize.width() - 2 * margin));
const bool horizontalScrollbarIsVisible = tab->page()->currentFrame()->scrollBarMaximum(Qt::Horizontal);
const bool verticalScrollbarIsVisible = tab->page()->currentFrame()->scrollBarMaximum(Qt::Vertical);
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index 2af4214f..9bd029f2 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -55,6 +55,7 @@
// Qt Includes
#include <QtNetwork/QNetworkRequest>
#include <QtWebKit/QWebFrame>
+#include <QTextDocument>
static bool fileItemListLessThan(const KFileItem &s1, const KFileItem &s2)
@@ -298,14 +299,14 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list)
Q_FOREACH(const KFileItem & item, orderedList)
{
msg += "<tr>";
- QString fullPath = item.url().prettyUrl();
+ QString fullPath = Qt::escape(item.url().prettyUrl());
QString iconName = item.iconName();
QString icon = QString("file://") + KIconLoader::global()->iconPath(iconName, KIconLoader::Small);
msg += "<td width=\"70%\">";
msg += "<img src=\"" + icon + "\" alt=\"" + iconName + "\" /> ";
- msg += "<a href=\"" + fullPath + "\">" + item.name() + "</a>";
+ msg += "<a href=\"" + fullPath + "\">" + Qt::escape(item.name()) + "</a>";
msg += "</td>";
msg += "<td align=\"right\">";