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

WebView: Don't save blank page / speed dial into view history

This commit is contained in:
David Rosca 2015-10-09 21:32:43 +02:00
parent b6b7edd187
commit 56e5237697
2 changed files with 14 additions and 0 deletions

View File

@ -62,6 +62,7 @@ WebView::WebView(QWidget* parent)
connect(this, &QWebEngineView::loadStarted, this, &WebView::slotLoadStarted); connect(this, &QWebEngineView::loadStarted, this, &WebView::slotLoadStarted);
connect(this, &QWebEngineView::loadProgress, this, &WebView::slotLoadProgress); connect(this, &QWebEngineView::loadProgress, this, &WebView::slotLoadProgress);
connect(this, &QWebEngineView::loadFinished, this, &WebView::slotLoadFinished); connect(this, &QWebEngineView::loadFinished, this, &WebView::slotLoadFinished);
connect(this, &QWebEngineView::urlChanged, this, &WebView::slotUrlChanged);
connect(this, &QWebEngineView::iconUrlChanged, this, &WebView::slotIconUrlChanged); connect(this, &QWebEngineView::iconUrlChanged, this, &WebView::slotIconUrlChanged);
m_currentZoomLevel = zoomLevels().indexOf(100); m_currentZoomLevel = zoomLevels().indexOf(100);
@ -387,6 +388,18 @@ void WebView::slotLoadFinished(bool ok)
mApp->history()->addHistoryEntry(this); 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) void WebView::slotIconUrlChanged(const QUrl &url)
{ {
m_siteIcon = QIcon(); m_siteIcon = QIcon();

View File

@ -114,6 +114,7 @@ protected slots:
void slotLoadStarted(); void slotLoadStarted();
void slotLoadProgress(int progress); void slotLoadProgress(int progress);
void slotLoadFinished(bool ok); void slotLoadFinished(bool ok);
void slotUrlChanged(const QUrl &url);
void slotIconUrlChanged(const QUrl &url); void slotIconUrlChanged(const QUrl &url);
// Context menu slots // Context menu slots