Commit 79661c8b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Interceptor is not only mail specific

parent daa530f4
Pipeline #55566 canceled with stage
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
set(PIM_VERSION "5.17.40")
set(PIM_VERSION "5.17.41")
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
......
......@@ -122,7 +122,6 @@ 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/cidschemehandler/cidschemehandler.cpp
)
......@@ -375,15 +374,6 @@ install(TARGETS
EXPORT KF5MessageViewerTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}
)
ecm_generate_headers(MessageViewer_Camelblockmailtrackingurlinterceptor_HEADERS
HEADER_NAMES
BlockMailTrackingUrlInterceptor
REQUIRED_HEADERS MessageViewer_blockmailtrackingurlinterceptor_HEADERS
PREFIX MessageViewer
RELATIVE viewer/webengine/blockmailtrackingurlinterceptor
)
ecm_generate_headers(MessageViewer_Camelcasewebengine_HEADERS
HEADER_NAMES
MailWebEnginePage
......@@ -596,7 +586,6 @@ install(FILES
${MessageViewer_Camelfindbar_HEADERS}
${MessageViewer_Camelcasescam_HEADERS}
${MessageViewer_Camelcaserenderer_HEADERS}
${MessageViewer_Camelblockmailtrackingurlinterceptor_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageViewer
COMPONENT Devel
)
......@@ -618,7 +607,6 @@ install(FILES
${MessageViewer_findbar_HEADERS}
${MessageViewer_renderer_HEADERS}
${MessageViewer_remotecontent_HEADERS}
${MessageViewer_blockmailtrackingurlinterceptor_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/messageviewer_export.h
${CMAKE_CURRENT_BINARY_DIR}/globalsettings_messageviewer.h
${CMAKE_CURRENT_BINARY_DIR}/messageviewer_debug.h
......
......@@ -6,7 +6,6 @@
#include "mailwebengineview.h"
#include "../urlhandlermanager.h"
#include "blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h"
#include "blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.h"
#include "cidreferencesurlinterceptor/cidreferencesurlinterceptor.h"
#include "cidschemehandler/cidschemehandler.h"
#include "loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.h"
......@@ -14,6 +13,7 @@
#include "messageviewer/messageviewersettings.h"
#include "webengineviewer/webengineaccesskey.h"
#include "webengineviewer/webenginescript.h"
#include <WebEngineViewer/BlockMailTrackingUrlInterceptor>
#include <WebEngineViewer/InterceptorManager>
#include <WebEngineViewer/WebEngineManageScript>
......@@ -61,7 +61,7 @@ public:
MailWebEnginePage *mPageEngine = nullptr;
WebEngineViewer::InterceptorManager *mNetworkAccessManager = nullptr;
MessageViewer::ViewerPrivate *mViewer = nullptr;
MessageViewer::BlockMailTrackingUrlInterceptor *mBlockMailTrackingUrl = nullptr;
WebEngineViewer::BlockMailTrackingUrlInterceptor *mBlockMailTrackingUrl = nullptr;
bool mCanStartDrag = false;
};
......@@ -90,8 +90,8 @@ MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
connect(blockExternalUrl, &BlockExternalResourcesUrlInterceptor::formSubmittedForbidden, this, &MailWebEngineView::formSubmittedForbidden);
d->mNetworkAccessManager->addInterceptor(blockExternalUrl);
d->mBlockMailTrackingUrl = new MessageViewer::BlockMailTrackingUrlInterceptor(this);
connect(d->mBlockMailTrackingUrl, &BlockMailTrackingUrlInterceptor::trackingFound, this, &MailWebEngineView::mailTrackingFound);
d->mBlockMailTrackingUrl = new WebEngineViewer::BlockMailTrackingUrlInterceptor(this);
connect(d->mBlockMailTrackingUrl, &WebEngineViewer::BlockMailTrackingUrlInterceptor::trackingFound, this, &MailWebEngineView::mailTrackingFound);
d->mNetworkAccessManager->addInterceptor(d->mBlockMailTrackingUrl);
setFocusPolicy(Qt::WheelFocus);
......
......@@ -6,7 +6,7 @@
#pragma once
#include "messageviewer_export.h"
#include <MessageViewer/BlockMailTrackingUrlInterceptor>
#include <WebEngineViewer/BlockMailTrackingUrlInterceptor>
#include <WebEngineViewer/WebEngineView>
#include <boost/function.hpp>
class QPrinter;
......@@ -83,7 +83,7 @@ Q_SIGNALS:
void urlBlocked(const QUrl &url);
void messageMayBeAScam();
void formSubmittedForbidden();
void mailTrackingFound(const MessageViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &);
void mailTrackingFound(const WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &);
/// Emitted when the user right-clicks somewhere
void popupMenu(const WebEngineViewer::WebHitTestResult &result);
void pageIsScrolledToBottom(bool);
......
......@@ -50,7 +50,7 @@ QString MailTrackingWarningWidget::generateDetails() const
return details;
}
void MailTrackingWarningWidget::addTracker(const MessageViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &tracker)
void MailTrackingWarningWidget::addTracker(const WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &tracker)
{
blackListFound item = mBackLists.value(tracker.mCompanyName);
if (item.url.isEmpty()) {
......
......@@ -13,7 +13,7 @@
#include <QMap>
#include <QPointer>
#include <viewer/webengine/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.h>
#include <WebEngineViewer/BlockMailTrackingUrlInterceptor>
namespace MessageViewer
{
......@@ -24,7 +24,7 @@ class MESSAGEVIEWER_TESTS_EXPORT MailTrackingWarningWidget : public KMessageWidg
public:
explicit MailTrackingWarningWidget(QWidget *parent = nullptr);
~MailTrackingWarningWidget() override;
void addTracker(const MessageViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &);
void addTracker(const WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &);
void hideAndClear();
private:
......
......@@ -50,6 +50,7 @@ set(libwebengineviewer_interceptor_SRCS
urlinterceptor/networkpluginurlinterceptor.cpp
urlinterceptor/networkurlinterceptormanager.cpp
urlinterceptor/networkpluginurlinterceptorconfigurewidget.cpp
urlinterceptor/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.cpp
)
set(libwebengineviewer_accesskey_SRCS
......@@ -194,6 +195,14 @@ ecm_generate_headers(WebEngineViewer_Camelcasewidgets_HEADERS
RELATIVE widgets
)
ecm_generate_headers(WebEngineViewer_Camelblockmailtrackingurlinterceptor_HEADERS
HEADER_NAMES
BlockMailTrackingUrlInterceptor
REQUIRED_HEADERS WebEngineViewer_blockmailtrackingurlinterceptor_HEADERS
PREFIX WebEngineViewer
RELATIVE urlinterceptor/blockmailtrackingurlinterceptor/
)
ecm_generate_pri_file(BASE_NAME WebEngineViewer
......@@ -203,6 +212,7 @@ ecm_generate_pri_file(BASE_NAME WebEngineViewer
install(FILES
${WebEngineViewer_Camelblockmailtrackingurlinterceptor_HEADERS}
${WebEngineViewer_Camelcasewebengine_checkurl_HEADERS}
${WebEngineViewer_Camelcasewebengine_accesskey_HEADERS}
${WebEngineViewer_Camelcasewebengine_urlinterceptor_HEADERS}
......@@ -216,6 +226,7 @@ install(FILES
)
install(FILES
${WebEngineViewer_blockmailtrackingurlinterceptor_HEADERS}
${WebEngineViewer_webengine_checkurl_HEADERS}
${WebEngineViewer_webengine_accesskey_HEADERS}
${WebEngineViewer_findbar_HEADERS}
......
......@@ -8,11 +8,11 @@
#include <QWebEngineUrlRequestInfo>
using namespace MessageViewer;
using namespace WebEngineViewer;
BlockMailTrackingUrlInterceptor::BlockMailTrackingUrlInterceptor(QObject *parent)
: WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent)
{
qRegisterMetaType<MessageViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList>();
qRegisterMetaType<WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList>();
initializeList();
}
......
......@@ -6,16 +6,16 @@
#pragma once
#include "messageviewer_export.h"
#include "webengineviewer_export.h"
#include <QVector>
#include <WebEngineViewer/NetworkPluginUrlInterceptorInterface>
namespace MessageViewer
namespace WebEngineViewer
{
/**
* @brief The BlockMailTrackingUrlInterceptor class
* @author Laurent Montel <montel@kde.org>
*/
class MESSAGEVIEWER_EXPORT BlockMailTrackingUrlInterceptor : public WebEngineViewer::NetworkPluginUrlInterceptorInterface
class WEBENGINEVIEWER_EXPORT BlockMailTrackingUrlInterceptor : public WebEngineViewer::NetworkPluginUrlInterceptorInterface
{
Q_OBJECT
public:
......@@ -41,7 +41,7 @@ public:
void setEnabledMailTrackingInterceptor(bool enabledMailTrackingInterceptor);
Q_SIGNALS:
void trackingFound(const MessageViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &);
void trackingFound(const WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &);
private:
void initializeList();
......@@ -49,5 +49,5 @@ private:
bool mEnabledMailTrackingInterceptor = false;
};
}
Q_DECLARE_TYPEINFO(MessageViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(MessageViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList)
Q_DECLARE_TYPEINFO(WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(WebEngineViewer::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