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

Fixed issue with searching about:blank after restoring empty tabs.

- regression from previous commit
This commit is contained in:
nowrep 2012-05-13 22:41:10 +02:00
parent d5071215eb
commit 5ec579b91e
2 changed files with 12 additions and 8 deletions

View File

@ -80,7 +80,7 @@ void DownloadFileHelper::handleUnsupportedContent(QNetworkReply* reply, bool ask
// Close Empty Tab
if (m_webPage) {
WebView* view = qobject_cast<WebView*>(m_webPage->view());
if (!m_webPage->url().isEmpty() && m_webPage->url().toString() != "about:blank") {
if (!m_webPage->url().isEmpty()) {
m_downloadPage = m_webPage->url();
}
else if (m_webPage->history()->canGoBack()) {

View File

@ -104,6 +104,10 @@ QUrl WebView::url() const
returnUrl = m_aboutToLoadUrl;
}
if (returnUrl.toString() == "about:blank") {
returnUrl = QUrl();
}
return returnUrl;
}
@ -131,23 +135,23 @@ void WebView::load(const QUrl &url)
void WebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation, const QByteArray &body)
{
const QUrl &url = request.url();
const QUrl &reqUrl = request.url();
if (url.scheme() == "javascript") {
if (reqUrl.scheme() == "javascript") {
// Getting scriptSource from PercentEncoding to properly load bookmarklets
QString scriptSource = QUrl::fromPercentEncoding(url.toString().mid(11).toUtf8());
QString scriptSource = QUrl::fromPercentEncoding(reqUrl.toString().mid(11).toUtf8());
page()->mainFrame()->evaluateJavaScript(scriptSource);
return;
}
if (url.isEmpty() || isUrlValid(url)) {
if (reqUrl.isEmpty() || isUrlValid(reqUrl)) {
QWebView::load(request, operation, body);
emit urlChanged(url);
m_aboutToLoadUrl = url;
emit urlChanged(url());
m_aboutToLoadUrl = reqUrl;
return;
}
const QUrl &searchUrl = mApp->searchEnginesManager()->searchUrl(url.toString());
const QUrl &searchUrl = mApp->searchEnginesManager()->searchUrl(reqUrl.toString());
QWebView::load(searchUrl);
emit urlChanged(searchUrl);