]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/widgets/TabWidget.cpp
Only display the HTTP Ping dialog if it originates from the current tab. https:...
[PrivacyBrowserPC.git] / src / widgets / TabWidget.cpp
index 2e32cab37320efa2364d1921a54bcf6b3c4fb965..ec555faa50c3bcf88884ece0143083cbe85ea431 100644 (file)
@@ -38,6 +38,7 @@
 #include <QFileDialog>
 #include <QGraphicsScene>
 #include <QGraphicsView>
+#include <QMessageBox>
 #include <QPrintDialog>
 #include <QPrintPreviewDialog>
 #include <QPrinter>
@@ -209,6 +210,32 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const
             emit hideProgressBar();
     });
 
+    // Display HTTP Ping blocked dialogs.
+    connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::displayHttpPingBlockedDialog, [privacyWebEngineViewPointer, this] (const QString &httpPingUrl)
+    {
+        // Only display the HTTP Ping blocked dialog if this is the current tab.
+        if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer)
+        {
+            // Instantiate an HTTP ping blocked message box.
+            QMessageBox httpPingBlockedMessageBox;
+
+            // Set the icon.
+            httpPingBlockedMessageBox.setIcon(QMessageBox::Information);
+
+            // Set the window title.
+            httpPingBlockedMessageBox.setWindowTitle(i18nc("HTTP Ping blocked dialog title", "HTTP Ping Blocked"));
+
+            // Set the text.
+            httpPingBlockedMessageBox.setText(i18nc("HTTP Ping blocked dialog text", "This request has been blocked because it sends a naughty HTTP ping to %1.", httpPingUrl));
+
+            // Set the standard button.
+            httpPingBlockedMessageBox.setStandardButtons(QMessageBox::Ok);
+
+            // Display the message box.
+            httpPingBlockedMessageBox.exec();
+        }
+    });
+
     // Update the zoom factor when changed by CTRL-Scrolling.  This can be modified when <https://redmine.stoutner.com/issues/845> is fixed.
     connect(webEnginePagePointer, &QWebEnginePage::contentsSizeChanged, [webEnginePagePointer, this] ()
     {