From 56e5237697714cb0dfd9e7726b7e0f6a61daad88 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Fri, 9 Oct 2015 21:32:43 +0200 Subject: [PATCH] WebView: Don't save blank page / speed dial into view history --- src/lib/webengine/webview.cpp | 13 +++++++++++++ src/lib/webengine/webview.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index a360fa142..9a4719fa1 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -62,6 +62,7 @@ WebView::WebView(QWidget* parent) connect(this, &QWebEngineView::loadStarted, this, &WebView::slotLoadStarted); connect(this, &QWebEngineView::loadProgress, this, &WebView::slotLoadProgress); connect(this, &QWebEngineView::loadFinished, this, &WebView::slotLoadFinished); + connect(this, &QWebEngineView::urlChanged, this, &WebView::slotUrlChanged); connect(this, &QWebEngineView::iconUrlChanged, this, &WebView::slotIconUrlChanged); m_currentZoomLevel = zoomLevels().indexOf(100); @@ -387,6 +388,18 @@ void WebView::slotLoadFinished(bool ok) mApp->history()->addHistoryEntry(this); } +void WebView::slotUrlChanged(const QUrl &url) +{ + Q_UNUSED(url) + + // Don't save blank page / speed dial in tab history + if (!history()->canGoForward() && history()->backItems(1).size() == 1) { + const QString s = LocationBar::convertUrlToText(history()->backItem().url()); + if (s.isEmpty()) + history()->clear(); + } +} + void WebView::slotIconUrlChanged(const QUrl &url) { m_siteIcon = QIcon(); diff --git a/src/lib/webengine/webview.h b/src/lib/webengine/webview.h index 5a86f82d3..12a6eb599 100644 --- a/src/lib/webengine/webview.h +++ b/src/lib/webengine/webview.h @@ -114,6 +114,7 @@ protected slots: void slotLoadStarted(); void slotLoadProgress(int progress); void slotLoadFinished(bool ok); + void slotUrlChanged(const QUrl &url); void slotIconUrlChanged(const QUrl &url); // Context menu slots