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

Improved showing url in locationbar on opening tab

- when opening new tab (restoring session, restoring
  closed tab, ...), url of tab will be shown in locationbar
  immediately - not after first progress tick fires
This commit is contained in:
nowrep 2011-12-11 11:07:26 +01:00
parent df72343ee2
commit 65f4bf1a1b

View File

@ -647,7 +647,7 @@ void WebView::stop()
loadFinished(true); loadFinished(true);
if (m_locationBar->text().isEmpty()) { if (m_locationBar->text().isEmpty()) {
m_locationBar->setText(url().toEncoded()); emit urlChanged(url());
} }
} }
} }
@ -843,24 +843,27 @@ void WebView::load(const QUrl &url)
if (url.scheme() == "data" || url.scheme() == "qrc") { if (url.scheme() == "data" || url.scheme() == "qrc") {
QWebView::load(url); QWebView::load(url);
emit urlChanged(url);
m_aboutToLoadUrl = url; m_aboutToLoadUrl = url;
return; return;
} }
if (isUrlValid(url)) { if (isUrlValid(url)) {
QWebView::load(url); QWebView::load(url);
emit urlChanged(url);
m_aboutToLoadUrl = url; m_aboutToLoadUrl = url;
return; return;
} }
if (QFile::exists(url.toLocalFile())) { if (QFile::exists(url.toLocalFile())) {
QWebView::load(url); QWebView::load(url);
emit urlChanged(url);
} }
else { else {
SearchEngine engine = mApp->searchEnginesManager()->activeEngine(); SearchEngine engine = mApp->searchEnginesManager()->activeEngine();
QString urlString = engine.url.replace("%s", url.toString()); QString urlString = engine.url.replace("%s", url.toString());
QWebView::load(QUrl(urlString)); QWebView::load(QUrl(urlString));
m_locationBar->setText(urlString); emit urlChanged(url);
} }
} }