From 28ed740815550c7d83486501127cb9eca325511b Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 6 Jan 2017 11:21:52 +0100 Subject: Only block requests that would open a new site. ... so we can still load images. --- applications/mail/main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'applications') diff --git a/applications/mail/main.cpp b/applications/mail/main.cpp index 9f3003d0..f28c72d3 100644 --- a/applications/mail/main.cpp +++ b/applications/mail/main.cpp @@ -37,14 +37,17 @@ class WebUrlRequestInterceptor : public QWebEngineUrlRequestInterceptor { Q_OBJECT public: - WebUrlRequestInterceptor(QObject *p = Q_NULLPTR) : QWebEngineUrlRequestInterceptor{} + WebUrlRequestInterceptor(QObject *p = Q_NULLPTR) : QWebEngineUrlRequestInterceptor{p} {} void interceptRequest(QWebEngineUrlRequestInfo &info) { - qWarning() << info.requestMethod() << info.requestUrl(); - QDesktopServices::openUrl(info.requestUrl()); - info.block(true); + qDebug() << info.requestMethod() << info.requestUrl() << info.resourceType() << info.navigationType(); + const bool isNavigationRequest = info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame; + if (isNavigationRequest) { + QDesktopServices::openUrl(info.requestUrl()); + info.block(true); + } //TODO handle mailto to open a composer } }; -- cgit v1.2.3