From: Soren Stoutner Date: Fri, 10 Jun 2022 23:19:25 +0000 (-0700) Subject: Display a MessageBox when an HTTP Ping is blocked. https://redmine.stoutner.com/issue... X-Git-Tag: v0.1~28 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=b105f2cce889a132faa9d7a5cdc8505b75965321;p=PrivacyBrowserPC.git Display a MessageBox when an HTTP Ping is blocked. https://redmine.stoutner.com/issues/853 --- diff --git a/src/interceptors/UrlRequestInterceptor.cpp b/src/interceptors/UrlRequestInterceptor.cpp index d405928..6348898 100644 --- a/src/interceptors/UrlRequestInterceptor.cpp +++ b/src/interceptors/UrlRequestInterceptor.cpp @@ -20,6 +20,12 @@ // Application headers. #include "UrlRequestInterceptor.h" +// KDE Framework headers. +#include + +// Qt framework headers. +#include + // Construct the class. UrlRequestInterceptor::UrlRequestInterceptor(QObject *parentObjectPointer) : QWebEngineUrlRequestInterceptor(parentObjectPointer) {} @@ -42,9 +48,7 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &urlReques // Reapply the domain settings if the host is changing. if (requestingHost != requestedHost) - { emit applyDomainSettings(requestedHost); - } } break; @@ -64,6 +68,25 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &urlReques // Block HTTP ping requests. urlRequestInfo.block(true); + // 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.", + urlRequestInfo.requestUrl().toString())); + + // Set the standard button. + httpPingBlockedMessageBox.setStandardButtons(QMessageBox::Ok); + + // Display the message box. + httpPingBlockedMessageBox.exec(); + break; }