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

Merge pull request #1549 from srazi/fix_1539

Assume "about:blank" as an empty URL.
This commit is contained in:
David Rosca 2014-12-16 14:35:46 +01:00
commit 478cfa660d
2 changed files with 20 additions and 7 deletions

View File

@ -336,7 +336,7 @@ void LocationBar::showUrl(const QUrl &url)
}
// Set converted url as text
setText(convertUrlToText(url));
setText(stringUrl);
// Move cursor to the start
home(false);

View File

@ -129,18 +129,30 @@ bool WebView::isTitleEmpty() const
return QWebView::title().isEmpty();
}
static QString convertUrlToText(const QUrl &url)
{
// It was most probably entered by user, so don't urlencode it
if (url.scheme().isEmpty()) {
return url.toString();
}
QString stringUrl = QzTools::urlEncodeQueryString(url);
if (stringUrl == QLatin1String("about:blank")) {
stringUrl.clear();
}
return stringUrl;
}
QUrl WebView::url() const
{
QUrl returnUrl = page()->url();
if (returnUrl.isEmpty()) {
if (convertUrlToText(returnUrl).isEmpty()) {
returnUrl = m_aboutToLoadUrl;
}
if (returnUrl.toString() == QLatin1String("about:blank")) {
returnUrl = QUrl();
}
return returnUrl;
}
@ -404,7 +416,8 @@ void WebView::editDelete()
void WebView::reload()
{
m_isReloading = true;
if (QWebView::url().isEmpty() && !m_aboutToLoadUrl.isEmpty()) {
if (convertUrlToText(QWebView::url()).isEmpty() && !m_aboutToLoadUrl.isEmpty()) {
load(m_aboutToLoadUrl);
return;
}