#include "MouseEventFilter.h"
#include "Settings.h"
#include "ui_MainView.h"
+#include "UrlRequestInterceptor.h"
#include "helpers/SearchEngineHelper.h"
#include "helpers/UserAgentHelper.h"
// Listen for hovered link URLs.
connect(webEnginePagePointer, SIGNAL(linkHovered(const QString)), this, SLOT(pageLinkHovered(const QString)));
+ // Instantiate the URL request interceptor.
+ UrlRequestInterceptor *urlRequestInterceptorPointer = new UrlRequestInterceptor();
+
+ // Set the URL request interceptor.
+ webEngineProfilePointer->setUrlRequestInterceptor(urlRequestInterceptorPointer);
+
+ // Reapply the domain settings when the host changes.
+ connect(urlRequestInterceptorPointer, SIGNAL(applyDomainSettings()), this, SLOT(applyDomainSettingsWithoutReloading()));
+
// Disable the cache.
webEngineProfilePointer->setHttpCacheType(QWebEngineProfile::NoCache);
// This exists as a separate function from `applyDomainSettings()` so it can be listed as a slot and function without the need for a boolean argument.
void MainView::applyDomainSettingsAndReload() const
{
- // Apply the domain setings. `true` reloads the website.
+ // Apply the domain settings. `true` reloads the website.
applyDomainSettings(true);
}
+// This exists as a separate function from `applyDomainSettings()` so it can be listed as a slot and function without the need for a boolean argument.
+void MainView::applyDomainSettingsWithoutReloading() const
+{
+ // Apply the domain settings `false` does not reload the website.
+ applyDomainSettings(false);
+}
+
void MainView::applyDomainSettings(bool reloadWebsite) const
{
// Set the JavaScript status.