X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=src%2Fwidgets%2FPrivacyWebEngineView.cpp;h=05c765925d8aa6da639c4f4f019634ffc3d956f5;hb=a2737fd8ee243b19080acdda891efb44674808e3;hp=37c26bfef12f8b918a1d251baf691b54d66da638;hpb=310828788817f6acf54c77138ec38d97c8bdaf3d;p=PrivacyBrowserPC.git diff --git a/src/widgets/PrivacyWebEngineView.cpp b/src/widgets/PrivacyWebEngineView.cpp index 37c26bf..05c7659 100644 --- a/src/widgets/PrivacyWebEngineView.cpp +++ b/src/widgets/PrivacyWebEngineView.cpp @@ -30,7 +30,7 @@ #include // Construct the class. -PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr) +PrivacyWebEngineView::PrivacyWebEngineView(QWidget *parentWidgetPointer) : QWebEngineView(parentWidgetPointer) { // Create an off-the-record profile (the default when no profile name is specified). webEngineProfilePointer = new QWebEngineProfile(QLatin1String("")); @@ -45,7 +45,7 @@ PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr) webEngineSettingsPointer = webEnginePagePointer->settings(); // Instantiate the URL request interceptor. - UrlRequestInterceptor *urlRequestInterceptorPointer = new UrlRequestInterceptor(); + UrlRequestInterceptor *urlRequestInterceptorPointer = new UrlRequestInterceptor(this); // Set the URL request interceptor. webEngineProfilePointer->setUrlRequestInterceptor(urlRequestInterceptorPointer); @@ -180,12 +180,12 @@ void PrivacyWebEngineView::applyDomainSettings(const QString &hostname, const bo if (domainQuery.value(DomainsDatabase::ZOOM_FACTOR).toInt()) { // Store the current zoom factor. - setZoomFactor(domainQuery.value(DomainsDatabase::CUSTOM_ZOOM_FACTOR).toDouble()); + defaultZoomFactor = domainQuery.value(DomainsDatabase::CUSTOM_ZOOM_FACTOR).toDouble(); } else { - // Reset the current zoom factor. - setZoomFactor(Settings::zoomFactor()); + // Store the current zoom factor. + defaultZoomFactor = Settings::zoomFactor(); } } else // The hostname does not have domain settings. @@ -205,10 +205,13 @@ void PrivacyWebEngineView::applyDomainSettings(const QString &hostname, const bo // Set the user agent. webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgentFromDatabaseName(Settings::userAgent())); - // Set the zoom factor. - setZoomFactor(Settings::zoomFactor()); + // Store the zoom factor. + defaultZoomFactor = Settings::zoomFactor(); } + // Set the current zoom factor. + setZoomFactor(defaultZoomFactor); + // Reload the website if requested. if (reloadWebsite) reload(); @@ -256,9 +259,9 @@ QWebEngineView* PrivacyWebEngineView::createWindow(QWebEnginePage::WebWindowType { case QWebEnginePage::WebBrowserTab: { - // Create the new tab and return the privacy WebEngine view pointer. `true` removes the focus from the blank URL line edit. + // Create the new tab and return the privacy WebEngine view pointer. `true` removes the focus from the blank URL line edit. `true` adds the new tab adjacent to the current tab. // The new privacy WebEngine view pointer is returned so it can be populated with the link from the context menu. - return browserWindowPointer->tabWidgetPointer->addTab(true); + return browserWindowPointer->tabWidgetPointer->addTab(true, true); } case QWebEnginePage::WebBrowserWindow: @@ -275,9 +278,10 @@ QWebEngineView* PrivacyWebEngineView::createWindow(QWebEnginePage::WebWindowType case QWebEnginePage::WebBrowserBackgroundTab: { - // Create the new tab and return the privacy WebEngine view pointer. `false` does not clear the URL line edit. `true` creates a background tab. + // Create the new tab and return the privacy WebEngine view pointer. `false` does not clear the URL line edit. `true` adds the new tab adjacent to the current tab. + // `true` creates a background tab. // The new privacy WebEngine view pointer is returned so it can be populated with the link from the context menu. - return browserWindowPointer->tabWidgetPointer->addTab(false, true); + return browserWindowPointer->tabWidgetPointer->addTab(false, true, true); } default: