From 9ed3c1693fbd777f64d390e5b2d795fa285ffb85 Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Thu, 7 Jan 2021 08:53:02 +1100 Subject: Remembered scroll adjustment Now only scrolls back if the user navigated back/forward. This is a little more intuitive and makes it less confusing when user clicks a link to a cached page --- src/browsertab.hpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/browsertab.hpp') diff --git a/src/browsertab.hpp b/src/browsertab.hpp index 595e846..d706f72 100644 --- a/src/browsertab.hpp +++ b/src/browsertab.hpp @@ -40,6 +40,19 @@ struct DocumentStats } }; +enum RequestFlags : int +{ + None = 0, + + // Forces request to be made to server + // instead of reading from cache. + DontReadFromCache = 1, + + // If the user navigated back/forward + // (i.e if using back/forward buttons in toolbar) + NavigatedBackOrForward = 2, +}; + class BrowserTab : public QWidget { Q_OBJECT @@ -53,7 +66,7 @@ public: explicit BrowserTab(MainWindow * mainWindow); ~BrowserTab(); - void navigateTo(QUrl const & url, PushToHistory mode, bool no_cache_read = false); + void navigateTo(QUrl const & url, PushToHistory mode, RequestFlags flags = RequestFlags::None); void navigateBack(const QModelIndex &history_index); @@ -165,7 +178,7 @@ private: this->addProtocolHandler(std::make_unique()); } - bool startRequest(QUrl const & url, ProtocolHandler::RequestOptions options, bool no_cache_read = false); + bool startRequest(QUrl const & url, ProtocolHandler::RequestOptions options, RequestFlags flags = RequestFlags::None); void updateMouseCursor(bool waiting); -- cgit v1.2.3