X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2FMainView.cpp;h=3bef1040a88bb160939b685cd2fbf10635f69844;hp=9ddf1fb4524177e07627da213c047bb9d7b6354e;hb=44cd064cb213ad693223ca117fe346d8b78456d6;hpb=68167c0aba46c4bd4c859b176824873ffd14a3e7 diff --git a/src/MainView.cpp b/src/MainView.cpp index 9ddf1fb..3bef104 100644 --- a/src/MainView.cpp +++ b/src/MainView.cpp @@ -23,6 +23,7 @@ #include "MouseEventFilter.h" #include "Settings.h" #include "ui_MainView.h" +#include "UrlRequestInterceptor.h" #include "helpers/SearchEngineHelper.h" #include "helpers/UserAgentHelper.h" @@ -76,6 +77,15 @@ MainView::MainView(QWidget *parent) : QWidget(parent) // 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); @@ -118,10 +128,17 @@ void MainView::applyApplicationSettings() const // 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.