]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/views/BrowserView.cpp
Use an off-the-record profile. https://redmine.stoutner.com/issues/825
[PrivacyBrowserPC.git] / src / views / BrowserView.cpp
index 933a300816208a1ad3528b29fb429f8cab742564..fb2473a6977c406deb3221bcadac4ca5394409d9 100644 (file)
@@ -43,10 +43,17 @@ BrowserView::BrowserView(QWidget *parent) : QWidget(parent)
     // Get handles for the views.
     webEngineViewPointer = browserViewUi.webEngineView;
 
+    // Create an off-the-record profile (the default when no profile name is specified).
+    webEngineProfilePointer = new QWebEngineProfile(QStringLiteral(""));
+
+    // Create a WebEngine page.
+    QWebEnginePage *webEnginePagePointer = new QWebEnginePage(webEngineProfilePointer);
+
+    // Set the WebEngine page.
+    webEngineViewPointer->setPage(webEnginePagePointer);
+
     // Get handles for the aspects of the WebEngine.
-    QWebEnginePage *webEnginePagePointer = webEngineViewPointer->page();
     webEngineHistoryPointer = webEnginePagePointer->history();
-    webEngineProfilePointer = webEnginePagePointer->profile();
     webEngineSettingsPointer = webEngineViewPointer->settings();
 
     // Update the URL line edit when the URL changes.
@@ -75,9 +82,6 @@ BrowserView::BrowserView(QWidget *parent) : QWidget(parent)
     // Reapply the domain settings when the host changes.
     connect(urlRequestInterceptorPointer, SIGNAL(applyDomainSettings(QString)), this, SLOT(applyDomainSettingsWithoutReloading(QString)));
 
-    // Disable the cache.
-    webEngineProfilePointer->setHttpCacheType(QWebEngineProfile::NoCache);
-
     // Don't allow JavaScript to open windows.
     webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false);
 
@@ -209,7 +213,7 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload
         webEngineViewPointer->setZoomFactor(currentZoomFactor);
 
         // Apply the domain settings palette to the URL line edit.
-        emit updateDomainSettingsIndicator(true);
+        emit updateDomainSettingsIndicator(true, domainRecord.field(DomainsDatabaseHelper::DOMAIN_NAME).value().toString());
     }
     else  // The hostname does not have domain settings.
     {
@@ -229,7 +233,7 @@ void BrowserView::applyDomainSettings(const QString &hostname, const bool reload
         webEngineViewPointer->setZoomFactor(Settings::zoomFactor());
 
         // Apply the no domain settings palette to the URL line edit.
-        emit updateDomainSettingsIndicator(false);
+        emit updateDomainSettingsIndicator(false, QStringLiteral(""));
     }
 
     // Emit the update actions signals.
@@ -405,7 +409,7 @@ void BrowserView::toggleLocalStorage() const
 void BrowserView::updateUrl(const QUrl &url) const
 {
     // Update the URL line edit.
-    emit updateUrlLineEdit(url.toString());
+    emit updateUrlLineEdit(url);
 
     // Update the status of the forward and back buttons.
     emit updateBackAction(webEngineHistoryPointer->canGoBack());