1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Always encoding query when showing url in locationbar.

This commit is contained in:
nowrep 2012-02-21 21:28:19 +01:00
parent 38b5a32bb9
commit da3d929763
4 changed files with 14 additions and 4 deletions

View File

@ -36,6 +36,7 @@
#include "goicon.h" #include "goicon.h"
#include "rssicon.h" #include "rssicon.h"
#include "downicon.h" #include "downicon.h"
#include "globalfunctions.h"
LocationBar::LocationBar(QupZilla* mainClass) LocationBar::LocationBar(QupZilla* mainClass)
: LineEdit() : LineEdit()
@ -199,7 +200,7 @@ void LocationBar::showUrl(const QUrl &url)
return; return;
} }
QString stringUrl = url.toString(); QString stringUrl = qz_urlEncodeQueryString(url);
if (stringUrl == "qupzilla:speeddial" || stringUrl == "about:blank") { if (stringUrl == "qupzilla:speeddial" || stringUrl == "about:blank") {
stringUrl = ""; stringUrl = "";

View File

@ -18,8 +18,7 @@
#include "popuplocationbar.h" #include "popuplocationbar.h"
#include "popupwebview.h" #include "popupwebview.h"
#include "toolbutton.h" #include "toolbutton.h"
#include "globalfunctions.h"
#include <QDebug>
class PopupSiteIcon : public QWidget class PopupSiteIcon : public QWidget
{ {
@ -62,7 +61,7 @@ void PopupLocationBar::setView(PopupWebView* view)
void PopupLocationBar::showUrl(const QUrl &url) void PopupLocationBar::showUrl(const QUrl &url)
{ {
setText(url.toString()); setText(qz_urlEncodeQueryString(url));
setCursorPosition(0); setCursorPosition(0);
} }

View File

@ -148,6 +148,15 @@ QUrl qz_makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl)
return returnUrl; return returnUrl;
} }
QString qz_urlEncodeQueryString(const QUrl &url)
{
QString returnString = url.toString(QUrl::RemoveQuery | QUrl::RemoveFragment);
returnString.append(url.encodedQuery());
returnString.append(url.encodedFragment());
return returnString;
}
QString qz_ensureUniqueFilename(const QString &pathToFile) QString qz_ensureUniqueFilename(const QString &pathToFile)
{ {
if (!QFile::exists(pathToFile)) { if (!QFile::exists(pathToFile)) {

View File

@ -42,6 +42,7 @@ void qz_removeDir(const QString &d);
QString qz_samePartOfStrings(const QString &one, const QString &other); QString qz_samePartOfStrings(const QString &one, const QString &other);
QUrl qz_makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl); QUrl qz_makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl);
QString qz_urlEncodeQueryString(const QUrl &url);
QString qz_ensureUniqueFilename(const QString &name); QString qz_ensureUniqueFilename(const QString &name);
QString qz_getFileNameFromUrl(const QUrl &url); QString qz_getFileNameFromUrl(const QUrl &url);