summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-12-14 13:30:57 +0100
committerMontel Laurent <[email protected]>2017-12-14 13:30:57 +0100
commit8002306706720eee3f1dbbb8a70419bce4d527c2 (patch)
tree0cd758c9c967de755ab5363c64a23382dd87a6d6
parente956a43048c227d3fc5f7f42a695d50f4223220f (diff)
Start to create mail tracking blocker
-rw-r--r--messageviewer/src/CMakeLists.txt1
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp7
-rw-r--r--messageviewer/src/viewer/viewer_p.h1
-rw-r--r--messageviewer/src/viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.cpp39
-rw-r--r--messageviewer/src/viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.h39
-rw-r--r--messageviewer/src/viewer/webengine/mailwebengineview.cpp9
-rw-r--r--messageviewer/src/viewer/webengine/mailwebengineview.h1
7 files changed, 96 insertions, 1 deletions
diff --git a/messageviewer/src/CMakeLists.txt b/messageviewer/src/CMakeLists.txt
index abcbc0c..83e1582 100644
--- a/messageviewer/src/CMakeLists.txt
+++ b/messageviewer/src/CMakeLists.txt
@@ -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
)
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index 1833c0c..078f256 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.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();
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index a72d96c..6467f16 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -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();
diff --git a/messageviewer/src/viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.cpp b/messageviewer/src/viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.cpp
new file mode 100644
index 0000000..0959bcb
--- /dev/null
+++ b/messageviewer/src/viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.cpp
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2017 Laurent Montel <[email protected]>
+
+ 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;
+}
diff --git a/messageviewer/src/viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.h b/messageviewer/src/viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.h
new file mode 100644
index 0000000..7e9a2ad
--- /dev/null
+++ b/messageviewer/src/viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.h
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2017 Laurent Montel <[email protected]>
+
+ 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
diff --git a/messageviewer/src/viewer/webengine/mailwebengineview.cpp b/messageviewer/src/viewer/webengine/mailwebengineview.cpp
index 69403cc..7185512 100644
--- a/messageviewer/src/viewer/webengine/mailwebengineview.cpp
+++ b/messageviewer/src/viewer/webengine/mailwebengineview.cpp
@@ -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(
diff --git a/messageviewer/src/viewer/webengine/mailwebengineview.h b/messageviewer/src/viewer/webengine/mailwebengineview.h
index 6f51d43..06add1e 100644
--- a/messageviewer/src/viewer/webengine/mailwebengineview.h
+++ b/messageviewer/src/viewer/webengine/mailwebengineview.h
@@ -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