Commit d73ae7e2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Forward url blocked

parent 13204ffb
Pipeline #51847 canceled with stage
...@@ -927,6 +927,11 @@ void ViewerPrivate::initHtmlWidget() ...@@ -927,6 +927,11 @@ void ViewerPrivate::initHtmlWidget()
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::messageIsNotAScam, this, &ViewerPrivate::slotMessageIsNotAScam); connect(mScamDetectionWarning, &ScamDetectionWarningWidget::messageIsNotAScam, this, &ViewerPrivate::slotMessageIsNotAScam);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::addToWhiteList, this, &ViewerPrivate::slotAddToWhiteList); connect(mScamDetectionWarning, &ScamDetectionWarningWidget::addToWhiteList, this, &ViewerPrivate::slotAddToWhiteList);
connect(mViewer, &MailWebEngineView::pageIsScrolledToBottom, this, &ViewerPrivate::pageIsScrolledToBottom); connect(mViewer, &MailWebEngineView::pageIsScrolledToBottom, this, &ViewerPrivate::pageIsScrolledToBottom);
connect(mViewer, &MailWebEngineView::urlBlocked, this, &ViewerPrivate::slotUrlBlocked);
}
void ViewerPrivate::slotUrlBlocked(const QUrl &url)
{
} }
void ViewerPrivate::applyZoomValue(qreal factor, bool saveConfig) void ViewerPrivate::applyZoomValue(qreal factor, bool saveConfig)
......
...@@ -609,6 +609,7 @@ private: ...@@ -609,6 +609,7 @@ private:
bool mHtmlMailGlobalSetting = false; bool mHtmlMailGlobalSetting = false;
bool mHtmlLoadExternalDefaultSetting = false; bool mHtmlLoadExternalDefaultSetting = false;
bool mHtmlLoadExtOverride = false; bool mHtmlLoadExtOverride = false;
void slotUrlBlocked(const QUrl &url);
public: public:
KMime::Message::Ptr mMessage; // the current message, if it was set manually KMime::Message::Ptr mMessage; // the current message, if it was set manually
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "loadexternalreferencesurlinterceptor.h" #include "loadexternalreferencesurlinterceptor.h"
#include <QDebug>
#include <QWebEngineUrlRequestInfo> #include <QWebEngineUrlRequestInfo>
using namespace MessageViewer; using namespace MessageViewer;
...@@ -30,6 +31,7 @@ bool LoadExternalReferencesUrlInterceptor::interceptRequest(QWebEngineUrlRequest ...@@ -30,6 +31,7 @@ bool LoadExternalReferencesUrlInterceptor::interceptRequest(QWebEngineUrlRequest
} else { } else {
if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeImage && !info.requestUrl().isLocalFile() && (scheme != QLatin1String("cid"))) { if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeImage && !info.requestUrl().isLocalFile() && (scheme != QLatin1String("cid"))) {
Q_EMIT urlBlocked(info.requestUrl()); Q_EMIT urlBlocked(info.requestUrl());
qDebug() << " info.requestUrl()" << info.requestUrl();
return true; return true;
} else if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeFontResource) { } else if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeFontResource) {
return true; return true;
......
...@@ -82,6 +82,7 @@ MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent) ...@@ -82,6 +82,7 @@ MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
d->mNetworkAccessManager = new WebEngineViewer::InterceptorManager(this, ac, this); d->mNetworkAccessManager = new WebEngineViewer::InterceptorManager(this, ac, this);
d->mExternalReference = new MessageViewer::LoadExternalReferencesUrlInterceptor(this); d->mExternalReference = new MessageViewer::LoadExternalReferencesUrlInterceptor(this);
connect(d->mExternalReference, &MessageViewer::LoadExternalReferencesUrlInterceptor::urlBlocked, this, &MailWebEngineView::urlBlocked);
d->mNetworkAccessManager->addInterceptor(d->mExternalReference); d->mNetworkAccessManager->addInterceptor(d->mExternalReference);
auto cidReference = new MessageViewer::CidReferencesUrlInterceptor(this); auto cidReference = new MessageViewer::CidReferencesUrlInterceptor(this);
d->mNetworkAccessManager->addInterceptor(cidReference); d->mNetworkAccessManager->addInterceptor(cidReference);
......
...@@ -81,6 +81,7 @@ protected: ...@@ -81,6 +81,7 @@ protected:
Q_SIGNALS: Q_SIGNALS:
void wheelZoomChanged(int numSteps); void wheelZoomChanged(int numSteps);
void openUrl(const QUrl &url); void openUrl(const QUrl &url);
void urlBlocked(const QUrl &url);
void messageMayBeAScam(); void messageMayBeAScam();
void formSubmittedForbidden(); void formSubmittedForbidden();
void mailTrackingFound(const MessageViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &); void mailTrackingFound(const MessageViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment