From 0e3d0b1a5e13f38828f08934c41ed263fa4c1a7d Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sun, 18 Apr 2021 20:26:00 +0200 Subject: Push lazy-loaded links to the history When lazy-loaded links were making a new tab, they wasn't calling tab->navigateTo(url, BrowserTab::PushImmediate). What's important is only it can push urls to the history and making a new function just for that seemed like it'd just complicate things. So I've changed it to call tab->navigateTo() on every loading type. Unfortunately, that fixed our issue partly. Sure, links are now put into the history, but lazy-loaded tabs stopped being lazy-loaded anymore. Moreover, they were also reloading a page on first tab switch. So I've made also a check that stops requesting lazy-loaded urls, which made lazy-loading work as intended again, and moved the unsetting lazy-loaded boolean on reload instead of right after it to be able to request the file, which finally... Closes: #214 --- src/mainwindow.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index dc97ebd..4c7169b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -169,10 +169,8 @@ BrowserTab * MainWindow::addNewTab(bool focus_new, QUrl const & url, bool lazylo tab->current_location = url; tab->lazy_loading = true; } - else - { - tab->navigateTo(url, BrowserTab::PushImmediate); - } + + tab->navigateTo(url, BrowserTab::PushImmediate); if (!defaultTitle.isEmpty()) { @@ -387,7 +385,6 @@ void MainWindow::on_browser_tabs_currentChanged(int index) if (tab->lazy_loading) { tab->reloadPage(); - tab->lazy_loading = false; } this->setRequestState(tab->request_state); -- cgit v1.2.3