Commit 4e541d3d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Rename class

parent 54b6d1af
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
set(PIM_VERSION "5.17.43")
set(PIM_VERSION "5.17.44")
if (POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
......
......@@ -13,7 +13,7 @@
#include "webengineviewer/webengineaccesskey.h"
#include "webengineviewer/webenginescript.h"
#include <WebEngineViewer/BlockExternalResourcesUrlInterceptor>
#include <WebEngineViewer/BlockMailTrackingUrlInterceptor>
#include <WebEngineViewer/BlockTrackingUrlInterceptor>
#include <WebEngineViewer/InterceptorManager>
#include <WebEngineViewer/WebEngineManageScript>
......@@ -61,7 +61,7 @@ public:
MailWebEnginePage *mPageEngine = nullptr;
WebEngineViewer::InterceptorManager *mNetworkAccessManager = nullptr;
MessageViewer::ViewerPrivate *mViewer = nullptr;
WebEngineViewer::BlockMailTrackingUrlInterceptor *mBlockMailTrackingUrl = nullptr;
WebEngineViewer::BlockTrackingUrlInterceptor *mBlockMailTrackingUrl = nullptr;
bool mCanStartDrag = false;
};
......@@ -90,8 +90,8 @@ MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
connect(blockExternalUrl, &WebEngineViewer::BlockExternalResourcesUrlInterceptor::formSubmittedForbidden, this, &MailWebEngineView::formSubmittedForbidden);
d->mNetworkAccessManager->addInterceptor(blockExternalUrl);
d->mBlockMailTrackingUrl = new WebEngineViewer::BlockMailTrackingUrlInterceptor(this);
connect(d->mBlockMailTrackingUrl, &WebEngineViewer::BlockMailTrackingUrlInterceptor::trackingFound, this, &MailWebEngineView::mailTrackingFound);
d->mBlockMailTrackingUrl = new WebEngineViewer::BlockTrackingUrlInterceptor(this);
connect(d->mBlockMailTrackingUrl, &WebEngineViewer::BlockTrackingUrlInterceptor::trackingFound, this, &MailWebEngineView::mailTrackingFound);
d->mNetworkAccessManager->addInterceptor(d->mBlockMailTrackingUrl);
setFocusPolicy(Qt::WheelFocus);
......
......@@ -6,7 +6,7 @@
#pragma once
#include "messageviewer_export.h"
#include <WebEngineViewer/BlockMailTrackingUrlInterceptor>
#include <WebEngineViewer/BlockTrackingUrlInterceptor>
#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 WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &);
void mailTrackingFound(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &);
/// 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 WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &tracker)
void MailTrackingWarningWidget::addTracker(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &tracker)
{
blackListFound item = mBackLists.value(tracker.mCompanyName);
if (item.url.isEmpty()) {
......
......@@ -13,7 +13,7 @@
#include <QMap>
#include <QPointer>
#include <WebEngineViewer/BlockMailTrackingUrlInterceptor>
#include <WebEngineViewer/BlockTrackingUrlInterceptor>
namespace MessageViewer
{
......@@ -24,7 +24,7 @@ class MESSAGEVIEWER_TESTS_EXPORT MailTrackingWarningWidget : public KMessageWidg
public:
explicit MailTrackingWarningWidget(QWidget *parent = nullptr);
~MailTrackingWarningWidget() override;
void addTracker(const WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &);
void addTracker(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &);
void hideAndClear();
private:
......
......@@ -51,7 +51,7 @@ set(libwebengineviewer_interceptor_SRCS
urlinterceptor/networkpluginurlinterceptor.cpp
urlinterceptor/networkurlinterceptormanager.cpp
urlinterceptor/networkpluginurlinterceptorconfigurewidget.cpp
urlinterceptor/blockmailtrackingurlinterceptor/blockmailtrackingurlinterceptor.cpp
urlinterceptor/blocktrackingurlinterceptor/blocktrackingurlinterceptor.cpp
urlinterceptor/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.cpp
urlinterceptor/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
)
......@@ -198,13 +198,13 @@ ecm_generate_headers(WebEngineViewer_Camelcasewidgets_HEADERS
RELATIVE widgets
)
ecm_generate_headers(WebEngineViewer_Camelblockmailtrackingurlinterceptor_HEADERS
ecm_generate_headers(WebEngineViewer_Camelblocktrackingurlinterceptor_HEADERS
HEADER_NAMES
BlockMailTrackingUrlInterceptor
BlockTrackingUrlInterceptor
REQUIRED_HEADERS WebEngineViewer_blockmailtrackingurlinterceptor_HEADERS
REQUIRED_HEADERS WebEngineViewer_blocktrackingurlinterceptor_HEADERS
PREFIX WebEngineViewer
RELATIVE urlinterceptor/blockmailtrackingurlinterceptor/
RELATIVE urlinterceptor/blocktrackingurlinterceptor/
)
ecm_generate_headers(WebEngineViewer_Camelloadexternalreferencesurlinterceptor_HEADERS
......@@ -235,7 +235,7 @@ ecm_generate_pri_file(BASE_NAME WebEngineViewer
install(FILES
${WebEngineViewer_Camelblockexternalresourcesurlinterceptor_HEADERS}
${WebEngineViewer_Camelloadexternalreferencesurlinterceptor_HEADERS}
${WebEngineViewer_Camelblockmailtrackingurlinterceptor_HEADERS}
${WebEngineViewer_Camelblocktrackingurlinterceptor_HEADERS}
${WebEngineViewer_Camelcasewebengine_checkurl_HEADERS}
${WebEngineViewer_Camelcasewebengine_accesskey_HEADERS}
${WebEngineViewer_Camelcasewebengine_urlinterceptor_HEADERS}
......@@ -251,7 +251,7 @@ install(FILES
install(FILES
${WebEngineViewer_blockexternalresourcesurlinterceptor_HEADERS}
${WebEngineViewer_loadexternalreferencesurlinterceptor_HEADERS}
${WebEngineViewer_blockmailtrackingurlinterceptor_HEADERS}
${WebEngineViewer_blocktrackingurlinterceptor_HEADERS}
${WebEngineViewer_webengine_checkurl_HEADERS}
${WebEngineViewer_webengine_accesskey_HEADERS}
${WebEngineViewer_findbar_HEADERS}
......
......@@ -4,23 +4,23 @@
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "blockmailtrackingurlinterceptor.h"
#include "blocktrackingurlinterceptor.h"
#include <QWebEngineUrlRequestInfo>
using namespace WebEngineViewer;
BlockMailTrackingUrlInterceptor::BlockMailTrackingUrlInterceptor(QObject *parent)
BlockTrackingUrlInterceptor::BlockTrackingUrlInterceptor(QObject *parent)
: WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent)
{
qRegisterMetaType<WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList>();
qRegisterMetaType<WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList>();
initializeList();
}
BlockMailTrackingUrlInterceptor::~BlockMailTrackingUrlInterceptor()
BlockTrackingUrlInterceptor::~BlockTrackingUrlInterceptor()
{
}
bool BlockMailTrackingUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
bool BlockTrackingUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
if (!mEnabledMailTrackingInterceptor) {
return false;
......@@ -36,7 +36,7 @@ bool BlockMailTrackingUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo
return false;
}
void BlockMailTrackingUrlInterceptor::initializeList()
void BlockTrackingUrlInterceptor::initializeList()
{
mBackList = {{QStringLiteral("Sidekick"), QStringLiteral("t.signaux"), QStringLiteral("http://getsidekick.com")},
{QStringLiteral("Sidekick"), QStringLiteral("t.sidekickopen"), QStringLiteral("http://getsidekick.com")},
......@@ -64,12 +64,12 @@ void BlockMailTrackingUrlInterceptor::initializeList()
{QStringLiteral("Outreach"), QStringLiteral("app.outreach.io"), QStringLiteral("http://outreach.io")}};
}
bool BlockMailTrackingUrlInterceptor::enabledMailTrackingInterceptor() const
bool BlockTrackingUrlInterceptor::enabledMailTrackingInterceptor() const
{
return mEnabledMailTrackingInterceptor;
}
void BlockMailTrackingUrlInterceptor::setEnabledMailTrackingInterceptor(bool enabledMailTrackingInterceptor)
void BlockTrackingUrlInterceptor::setEnabledMailTrackingInterceptor(bool enabledMailTrackingInterceptor)
{
mEnabledMailTrackingInterceptor = enabledMailTrackingInterceptor;
}
......@@ -15,13 +15,13 @@ namespace WebEngineViewer
* @brief The BlockMailTrackingUrlInterceptor class
* @author Laurent Montel <montel@kde.org>
*/
class WEBENGINEVIEWER_EXPORT BlockMailTrackingUrlInterceptor : public WebEngineViewer::NetworkPluginUrlInterceptorInterface
class WEBENGINEVIEWER_EXPORT BlockTrackingUrlInterceptor : public WebEngineViewer::NetworkPluginUrlInterceptorInterface
{
Q_OBJECT
public:
struct MailTrackerBlackList {
MailTrackerBlackList() = default;
MailTrackerBlackList(const QString &company, const QString &pattern, const QString &url)
struct TrackerBlackList {
TrackerBlackList() = default;
TrackerBlackList(const QString &company, const QString &pattern, const QString &url)
: mCompanyName(company)
, mCompanyUrl(url)
, mPattern(pattern)
......@@ -33,21 +33,21 @@ public:
QString mPattern;
};
explicit BlockMailTrackingUrlInterceptor(QObject *parent = nullptr);
~BlockMailTrackingUrlInterceptor() override;
explicit BlockTrackingUrlInterceptor(QObject *parent = nullptr);
~BlockTrackingUrlInterceptor() override;
Q_REQUIRED_RESULT bool interceptRequest(QWebEngineUrlRequestInfo &info) override;
Q_REQUIRED_RESULT bool enabledMailTrackingInterceptor() const;
void setEnabledMailTrackingInterceptor(bool enabledMailTrackingInterceptor);
Q_SIGNALS:
void trackingFound(const WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList &);
void trackingFound(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &);
private:
void initializeList();
QVector<MailTrackerBlackList> mBackList;
QVector<TrackerBlackList> mBackList;
bool mEnabledMailTrackingInterceptor = false;
};
}
Q_DECLARE_TYPEINFO(WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(WebEngineViewer::BlockMailTrackingUrlInterceptor::MailTrackerBlackList)
Q_DECLARE_TYPEINFO(WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList)
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