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

Start to create mail tracking blocker

parent e956a430
......@@ -55,6 +55,7 @@ set(libmessageviewer_mailviewer_SRCS
viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.cpp
viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.cpp
viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.cpp
viewer/webengine/mailwebenginescript.cpp
)
......
......@@ -1064,6 +1064,8 @@ void ViewerPrivate::initHtmlWidget()
&ViewerPrivate::slotMessageMayBeAScam);
connect(mViewer, &MailWebEngineView::formSubmittedForbidden, this,
&ViewerPrivate::slotFormSubmittedForbidden);
connect(mViewer, &MailWebEngineView::mailTrackingFound, this,
&ViewerPrivate::slotMailTrackingFound);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::showDetails, mViewer,
&MailWebEngineView::slotShowDetails);
connect(mScamDetectionWarning, &ScamDetectionWarningWidget::moveMessageToTrash, this,
......@@ -3189,6 +3191,11 @@ void ViewerPrivate::slotAddToWhiteList()
}
}
void ViewerPrivate::slotMailTrackingFound()
{
//TODO
}
void ViewerPrivate::slotFormSubmittedForbidden()
{
mSubmittedFormWarning->showWarning();
......
......@@ -434,6 +434,7 @@ private Q_SLOTS:
void slotMessageIsNotAScam();
void slotAddToWhiteList();
void slotFormSubmittedForbidden();
void slotMailTrackingFound();
/** Show hide all fields specified inside this function */
void toggleFullAddressList();
......
/*
Copyright (C) 2017 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "blockmailtrackingurlinterceptor.h"
using namespace MessageViewer;
BlockMailTrackingUrlInterceptor::BlockMailTrackingUrlInterceptor(QObject *parent)
: WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent)
{
}
MessageViewer::BlockMailTrackingUrlInterceptor::~BlockMailTrackingUrlInterceptor()
{
}
bool BlockMailTrackingUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
//TODO
return false;
}
/*
Copyright (C) 2017 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef BLOCKMAILTRACKINGURLINTERCEPTOR_H
#define BLOCKMAILTRACKINGURLINTERCEPTOR_H
#include <WebEngineViewer/NetworkPluginUrlInterceptorInterface>
namespace MessageViewer {
class BlockMailTrackingUrlInterceptor : public WebEngineViewer::NetworkPluginUrlInterceptorInterface
{
Q_OBJECT
public:
explicit BlockMailTrackingUrlInterceptor(QObject *parent = nullptr);
~BlockMailTrackingUrlInterceptor();
bool interceptRequest(QWebEngineUrlRequestInfo &info) override;
Q_SIGNALS:
//Add info about company
void mailTrackingFound();
};
}
#endif // BLOCKMAILTRACKINGURLINTERCEPTOR_H
......@@ -25,6 +25,7 @@
#include "../urlhandlermanager.h"
#include "loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.h"
#include "blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h"
#include "blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.h"
#include "cidreferencesurlinterceptor/cidreferencesurlinterceptor.h"
#include <WebEngineViewer/InterceptorManager>
#include <WebEngineViewer/WebEngineManageScript>
......@@ -101,8 +102,14 @@ MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
= new MessageViewer::BlockExternalResourcesUrlInterceptor(this);
connect(blockExternalUrl, &BlockExternalResourcesUrlInterceptor::formSubmittedForbidden, this,
&MailWebEngineView::formSubmittedForbidden);
d->mNetworkAccessManager->addInterceptor(blockExternalUrl);
MessageViewer::BlockMailTrackingUrlInterceptor *blockMailTrackingUrl
= new MessageViewer::BlockMailTrackingUrlInterceptor(this);
connect(blockMailTrackingUrl, &BlockMailTrackingUrlInterceptor::mailTrackingFound, this,
&MailWebEngineView::mailTrackingFound);
d->mNetworkAccessManager->addInterceptor(blockMailTrackingUrl);
setFocusPolicy(Qt::WheelFocus);
connect(d->mPageEngine, &MailWebEnginePage::urlClicked, this, &MailWebEngineView::openUrl);
connect(
......
......@@ -91,6 +91,7 @@ Q_SIGNALS:
void openUrl(const QUrl &url);
void messageMayBeAScam();
void formSubmittedForbidden();
void mailTrackingFound();
/// Emitted when the user right-clicks somewhere
/// @param url if an URL was under the cursor, this parameter contains it. Otherwise empty
/// @param point position where the click happened, in local coordinates
......
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