+ // Set the user agent.
+ webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getResultingDomainSettingsUserAgent(domainQuery.value(DomainsDatabase::USER_AGENT).toString()));
+
+ // Check if a custom zoom factor is set.
+ if (domainQuery.value(DomainsDatabase::ZOOM_FACTOR).toInt())
+ {
+ // Store the current zoom factor.
+ defaultZoomFactor = domainQuery.value(DomainsDatabase::CUSTOM_ZOOM_FACTOR).toDouble();
+ }
+ else
+ {
+ // Store the current zoom factor.
+ defaultZoomFactor = Settings::zoomFactor();
+ }
+ }
+ else // The hostname does not have domain settings.
+ {
+ // Reset the domain settings name.
+ domainSettingsName = QLatin1String("");
+
+ // Set the JavaScript status.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::javaScriptEnabled());
+
+ // Set the local storage status.
+ localStorageEnabled = Settings::localStorageEnabled();
+
+ // Set DOM storage. In QWebEngineSettings it is called Local Storage.
+ webEngineSettingsPointer->setAttribute(QWebEngineSettings::LocalStorageEnabled, Settings::domStorageEnabled());
+
+ // Set the user agent.
+ webEngineProfilePointer->setHttpUserAgent(UserAgentHelper::getUserAgentFromDatabaseName(Settings::userAgent()));
+
+ // Store the zoom factor.
+ defaultZoomFactor = Settings::zoomFactor();
+ }
+
+ // Set the current zoom factor.
+ setZoomFactor(defaultZoomFactor);
+
+ // Reload the website if requested.
+ if (reloadWebsite)
+ reload();
+
+ // Update the UI.
+ emit updateUi(this);
+}
+
+void PrivacyWebEngineView::contextMenuEvent(QContextMenuEvent *contextMenuEvent) {
+ // Get a handle for the
+ QWebEnginePage *webEnginePagePointer = page();
+
+ // Get a handle for the menu.
+ QMenu *contextMenu = webEnginePagePointer->createStandardContextMenu();
+
+ // Get the list of context menu actions.
+ const QList<QAction *> contextMenuActionsList = contextMenu->actions();
+
+ // Add the open link in new background tab action if the context menu already contains the open link in new window action.
+ if (contextMenuActionsList.contains(webEnginePagePointer->action(QWebEnginePage::OpenLinkInNewWindow)))
+ {
+ // Move the open in new tab action to the top of the list.
+ contextMenu->insertAction(webEnginePagePointer->action(QWebEnginePage::Back), webEnginePagePointer->action(QWebEnginePage::OpenLinkInNewTab));
+
+ // Add the open link in background tab action below the open in new tab action.
+ contextMenu->insertAction(webEnginePagePointer->action(QWebEnginePage::Back), webEnginePagePointer->action(QWebEnginePage::OpenLinkInNewBackgroundTab));
+
+ // Move the open in new window action below the open in background tab action.
+ contextMenu->insertAction(webEnginePagePointer->action(QWebEnginePage::Back), webEnginePagePointer->action(QWebEnginePage::OpenLinkInNewWindow));
+
+ // Add a separator below the open in new window action.
+ contextMenu->insertSeparator(webEnginePagePointer->action(QWebEnginePage::Back));
+ }
+
+ // Display the menu using the location in the context menu event.
+ contextMenu->popup(contextMenuEvent->globalPos());
+}
+
+QWebEngineView* PrivacyWebEngineView::createWindow(QWebEnginePage::WebWindowType webWindowType) {