diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-01-06 11:21:52 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-01-07 17:37:33 +0100 |
commit | 28ed740815550c7d83486501127cb9eca325511b (patch) | |
tree | 4ba1b840a01817b3a4e6fb659ed2208c62e02620 /applications | |
parent | 9d3af72bbbdddae93133d7d7f73b8704613a06ca (diff) | |
download | kube-28ed740815550c7d83486501127cb9eca325511b.tar.gz kube-28ed740815550c7d83486501127cb9eca325511b.zip |
Only block requests that would open a new site.
... so we can still load images.
Diffstat (limited to 'applications')
-rw-r--r-- | applications/mail/main.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
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 | |||
37 | { | 37 | { |
38 | Q_OBJECT | 38 | Q_OBJECT |
39 | public: | 39 | public: |
40 | WebUrlRequestInterceptor(QObject *p = Q_NULLPTR) : QWebEngineUrlRequestInterceptor{} | 40 | WebUrlRequestInterceptor(QObject *p = Q_NULLPTR) : QWebEngineUrlRequestInterceptor{p} |
41 | {} | 41 | {} |
42 | 42 | ||
43 | void interceptRequest(QWebEngineUrlRequestInfo &info) | 43 | void interceptRequest(QWebEngineUrlRequestInfo &info) |
44 | { | 44 | { |
45 | qWarning() << info.requestMethod() << info.requestUrl(); | 45 | qDebug() << info.requestMethod() << info.requestUrl() << info.resourceType() << info.navigationType(); |
46 | QDesktopServices::openUrl(info.requestUrl()); | 46 | const bool isNavigationRequest = info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMainFrame; |
47 | info.block(true); | 47 | if (isNavigationRequest) { |
48 | QDesktopServices::openUrl(info.requestUrl()); | ||
49 | info.block(true); | ||
50 | } | ||
48 | //TODO handle mailto to open a composer | 51 | //TODO handle mailto to open a composer |
49 | } | 52 | } |
50 | }; | 53 | }; |