]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/widgets/PrivacyWebEngineView.cpp
Only display the HTTP Ping dialog if it originates from the current tab. https:...
[PrivacyBrowserPC.git] / src / widgets / PrivacyWebEngineView.cpp
index bc207cb21c94d5823b832642bb59ac193739a68a..96a0da5d67735743225293e0ca6a8db1990e5922 100644 (file)
@@ -51,7 +51,10 @@ PrivacyWebEngineView::PrivacyWebEngineView() : QWebEngineView(nullptr)
     webEngineProfilePointer->setUrlRequestInterceptor(urlRequestInterceptorPointer);
 
     // Reapply the domain settings when the host changes.
-    connect(urlRequestInterceptorPointer, SIGNAL(applyDomainSettings(QString)), this, SLOT(applyDomainSettingsWithoutReloading(QString)));
+    connect(urlRequestInterceptorPointer, SIGNAL(applyDomainSettings(const QString&)), this, SLOT(applyDomainSettingsWithoutReloading(const QString&)));
+
+    // Display HTTP Ping blocked dialogs.
+    connect(urlRequestInterceptorPointer, SIGNAL(displayHttpPingDialog(const QString&)), this, SLOT(displayHttpPingDialog(const QString&)));
 }
 
 void PrivacyWebEngineView::addCookieToList(const QNetworkCookie &cookie) const
@@ -229,7 +232,19 @@ void PrivacyWebEngineView::contextMenuEvent(QContextMenuEvent *contextMenuEvent)
 
     // 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)))
-        contextMenu->insertAction(webEnginePagePointer->action(QWebEnginePage::OpenLinkInNewWindow), webEnginePagePointer->action(QWebEnginePage::OpenLinkInNewBackgroundTab));
+    {
+        // 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());
@@ -276,6 +291,12 @@ QWebEngineView* PrivacyWebEngineView::createWindow(QWebEnginePage::WebWindowType
     }
 }
 
+void PrivacyWebEngineView::displayHttpPingDialog(const QString &httpPingUrl) const
+{
+    // Display the HTTP Ping blocked dialog.
+    emit displayHttpPingBlockedDialog(httpPingUrl);
+}
+
 void PrivacyWebEngineView::removeCookieFromList(const QNetworkCookie &cookie) const
 {
     //qDebug() << "Remove cookie:  " << cookie.toRawForm();