aboutsummaryrefslogtreecommitdiff
path: root/src/browsertab.cpp
diff options
context:
space:
mode:
authorKarol Kosek <krkk@krkk.ct8.pl>2021-04-18 20:26:00 +0200
committerFelix Queißner <felix@ib-queissner.de>2021-04-18 21:06:18 +0200
commit0e3d0b1a5e13f38828f08934c41ed263fa4c1a7d (patch)
treed6beb994896e3450e58b73e09263906caedb6890 /src/browsertab.cpp
parent2f74b60d0653c1fcc2d0e741052aa1173f6b6d7c (diff)
downloadkristall-0e3d0b1a5e13f38828f08934c41ed263fa4c1a7d.tar.gz
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
Diffstat (limited to 'src/browsertab.cpp')
-rw-r--r--src/browsertab.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp
index e397f0f..b2a31a1 100644
--- a/src/browsertab.cpp
+++ b/src/browsertab.cpp
@@ -195,7 +195,7 @@ void BrowserTab::navigateTo(const QUrl &url, PushToHistory mode, RequestFlags fl
this->successfully_loaded = false;
this->timer.start();
- if(not this->startRequest(url, ProtocolHandler::Default, flags)) {
+ if(!this->lazy_loading && not this->startRequest(url, ProtocolHandler::Default, flags)) {
QMessageBox::critical(this, tr("Kristall"), tr("Failed to execute request to %1").arg(url.toString()));
return;
}
@@ -263,6 +263,7 @@ void BrowserTab::scrollToAnchor(QString const &anchor)
void BrowserTab::reloadPage()
{
+ lazy_loading = false;
if (current_location.isValid())
this->navigateTo(this->current_location, DontPush, RequestFlags::DontReadFromCache);
}