Commit c8165c37 authored by Laurent Montel's avatar Laurent Montel 😁

Add missing connect + improve it

parent e43f2f12
......@@ -20,6 +20,7 @@
#include "mailwebengineaccesskey.h"
#include "webengine/webenginescript.h"
#include "messageviewer/messageviewersettings.h"
#include "webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.h"
#include <MessageViewer/NetworkAccessManagerWebEngine>
#include "scamdetection/scamdetectionwebengine.h"
......@@ -48,12 +49,15 @@ class MessageViewer::MailWebEngineViewPrivate
{
public:
MailWebEngineViewPrivate()
: mWebViewAccessKey(Q_NULLPTR)
: mScamDetection(Q_NULLPTR),
mWebViewAccessKey(Q_NULLPTR),
mExternalReference(Q_NULLPTR)
{
}
ScamDetectionWebEngine *mScamDetection;
MailWebEngineAccessKey *mWebViewAccessKey;
MessageViewer::LoadExternalReferencesUrlInterceptor *mExternalReference;
};
MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
......@@ -64,9 +68,12 @@ MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
d->mWebViewAccessKey = new MailWebEngineAccessKey(this, this);
d->mWebViewAccessKey->setActionCollection(ac);
d->mScamDetection = new ScamDetectionWebEngine(this);
connect(d->mScamDetection, &ScamDetectionWebEngine::messageMayBeAScam, this, &MailWebEngineView::messageMayBeAScam);
connect(d->mWebViewAccessKey, &MailWebEngineAccessKey::openUrl, this, &MailWebEngineView::openUrl);
new MessageViewer::NetworkAccessManagerWebEngine(this, ac, this);
MessageViewer::NetworkAccessManagerWebEngine *networkAccessManager = new MessageViewer::NetworkAccessManagerWebEngine(this, ac, this);
d->mExternalReference = new MessageViewer::LoadExternalReferencesUrlInterceptor(this);
networkAccessManager->addInterceptor(d->mExternalReference);
MailWebEnginePage *pageEngine = new MailWebEnginePage(this);
setPage(pageEngine);
......@@ -309,3 +316,9 @@ void MailWebEngineView::openBlockableItemsDialog()
{
//TODO
}
void MailWebEngineView::setAllowExternalContent(bool b)
{
d->mExternalReference->setAllowExternalContent(b);
reload();
}
......@@ -59,6 +59,8 @@ public:
QUrl linkOrImageUrlAt(const QPoint &global) const;
void openBlockableItemsDialog();
void setAllowExternalContent(bool b);
public Q_SLOTS:
void slotZoomChanged(qreal zoom);
void slotZoomTextOnlyChanged(bool b);
......@@ -73,6 +75,7 @@ protected:
Q_SIGNALS:
void openUrl(const QUrl &url);
void messageMayBeAScam();
private Q_SLOTS:
void handleScrollToAnchor(const QVariant &result);
......
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