1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

WebTab: Set new WebPage when unloading tab

This way it is not needed to have special handling for unloading
in WebTab and it also kills the QtWebEngineProcess entirely.
This commit is contained in:
David Rosca 2018-01-28 21:42:37 +01:00
parent 9b3f56093e
commit 2d01a6d092
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -324,8 +324,8 @@ void WebTab::reload()
void WebTab::unload() void WebTab::unload()
{ {
m_savedTab = SavedTab(this); m_savedTab = SavedTab(this);
m_webView->history()->clear(); m_webView->setPage(new WebPage);
m_webView->setUrl(QUrl(QSL("about:blank"))); m_webView->setFocus();
} }
bool WebTab::isLoading() const bool WebTab::isLoading() const
@ -433,10 +433,6 @@ void WebTab::showNotification(QWidget* notif)
void WebTab::loadStarted() void WebTab::loadStarted()
{ {
if (!isRestored()) {
return;
}
if (m_tabBar && m_webView->title(/*allowEmpty*/true).isEmpty()) { if (m_tabBar && m_webView->title(/*allowEmpty*/true).isEmpty()) {
m_tabBar->setTabText(tabIndex(), tr("Loading...")); m_tabBar->setTabText(tabIndex(), tr("Loading..."));
} }
@ -444,16 +440,12 @@ void WebTab::loadStarted()
void WebTab::loadFinished() void WebTab::loadFinished()
{ {
if (isRestored()) { titleChanged(m_webView->title());
titleChanged(m_webView->title());
} else if (m_webView->url().toString() == QL1S("about:blank")) {
m_webView->history()->clear();
}
} }
void WebTab::titleChanged(const QString &title) void WebTab::titleChanged(const QString &title)
{ {
if (!m_tabBar || !m_window || title.isEmpty() || !isRestored()) { if (!m_tabBar || !m_window || title.isEmpty()) {
return; return;
} }