1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Fix searching for strings with non-ascii characters from locationbar

Closes #1587
This commit is contained in:
David Rosca 2015-01-21 12:21:54 +01:00
parent 744a1d15be
commit 7384ed2685
4 changed files with 25 additions and 3 deletions

View File

@ -205,6 +205,8 @@ LoadRequest LocationBar::createLoadRequest() const
req.setUrl(guessedUrl);
else
req.setUrl(QUrl::fromEncoded(text().toUtf8()));
req.setUrlString(text());
}
return req;

View File

@ -26,15 +26,17 @@ LoadRequest::LoadRequest()
LoadRequest::LoadRequest(const LoadRequest &other)
: m_request(other.m_request)
, m_urlString(other.m_urlString)
, m_operation(other.m_operation)
, m_data(other.m_data)
{
}
LoadRequest::LoadRequest(const QUrl &url)
LoadRequest::LoadRequest(const QUrl &url, const QString &urlString)
: m_operation(GetOperation)
{
setUrl(url);
setUrlString(urlString);
}
LoadRequest::LoadRequest(const QNetworkRequest &req, LoadRequest::Operation op, const QByteArray &data)
@ -47,6 +49,7 @@ LoadRequest::LoadRequest(const QNetworkRequest &req, LoadRequest::Operation op,
LoadRequest &LoadRequest::operator=(const LoadRequest &other)
{
m_request = other.m_request;
m_urlString = other.m_urlString;
m_operation = other.m_operation;
m_data = other.m_data;
return *this;
@ -67,6 +70,19 @@ void LoadRequest::setUrl(const QUrl &url)
m_request.setUrl(url);
}
QString LoadRequest::urlString() const
{
if (m_urlString.isEmpty())
return m_request.url().toString();
return m_urlString;
}
void LoadRequest::setUrlString(const QString &urlString)
{
m_urlString = urlString;
}
QNetworkRequest LoadRequest::networkRequest() const
{
return m_request;

View File

@ -34,7 +34,7 @@ public:
LoadRequest();
LoadRequest(const LoadRequest &other);
LoadRequest(const QUrl &url);
LoadRequest(const QUrl &url, const QString &urlString = QString());
LoadRequest(const QNetworkRequest &req, Operation op = GetOperation, const QByteArray &data = QByteArray());
LoadRequest &operator=(const LoadRequest &other);
@ -44,6 +44,9 @@ public:
QUrl url() const;
void setUrl(const QUrl &url);
QString urlString() const;
void setUrlString(const QString &urlString);
QNetworkRequest networkRequest() const;
void setNetworkRequest(const QNetworkRequest &req);
@ -55,6 +58,7 @@ public:
private:
QNetworkRequest m_request;
QString m_urlString;
Operation m_operation;
QByteArray m_data;
};

View File

@ -220,7 +220,7 @@ void WebView::load(const LoadRequest &request)
return;
}
const LoadRequest searchRequest = mApp->searchEnginesManager()->searchResult(reqUrl.toString());
const LoadRequest searchRequest = mApp->searchEnginesManager()->searchResult(request.urlString());
loadRequest(searchRequest);
}