diff options
Diffstat (limited to 'src/browser.cpp')
-rw-r--r-- | src/browser.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index 354b179..82972dd 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -21,6 +21,7 @@ #include "browser.h" #include <bookmarks/bookmarkswidget.h> #include <downloads/downloadswidget.h> +#include "webengine/urlinterceptor.h" #include "mainwindow.h" #include <QtWebEngine> #include <QDir> @@ -39,8 +40,12 @@ Browser::Browser(int &argc, char *argv[]) : Browser::~Browser() { + // TODO: fix crash here // qDeleteAll(m_windows); // m_windows.clear(); + +// qDeleteAll(m_profiles); +// m_profiles.clear(); } void Browser::setConfiguration(std::shared_ptr<Configuration> &config) @@ -49,6 +54,8 @@ void Browser::setConfiguration(std::shared_ptr<Configuration> &config) m_bookmarksManager = std::make_shared<BookmarksWidget>(QString::fromStdString(m_config->value<std::string>("bookmarks.path").value())); m_downloadManager = std::make_shared<DownloadsWidget>(QString::fromStdString(m_config->value<std::string>("downloads.path").value())); + m_urlRequestInterceptor = std::make_shared<UrlRequestInterceptor>(QString::fromStdString(m_config->value<std::string>("browser.filterPath").value())); + } void Browser::loadProfiles() @@ -66,11 +73,15 @@ void Browser::loadProfiles() const QStringList profileList = profileDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); for(const QString &name : profileList) { - m_profiles.insert(name, new WebEngineProfile(name, profileDir.absoluteFilePath(name), this)); + WebEngineProfile *profile = new WebEngineProfile(name, profileDir.absoluteFilePath(name), this); + profile->setRequestInterceptor(m_urlRequestInterceptor.get()); + m_profiles.insert(name, profile); } // Also add the Off-the-record profile - m_profiles.insert("", new WebEngineProfile(this)); + WebEngineProfile *otr = new WebEngineProfile(this); + otr->setRequestInterceptor(m_urlRequestInterceptor.get()); + m_profiles.insert("", otr); // set default profile m_defaultProfile = m_profiles[QString::fromStdString(m_config->value<std::string>("browser.profile").value())]; |