Messagelib

blocktrackingurlinterceptor.h
1 /*
2  SPDX-FileCopyrightText: 2017-2023 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "webengineviewer_export.h"
10 #include <QDebug>
11 #include <QVector>
12 #include <WebEngineViewer/NetworkPluginUrlInterceptorInterface>
13 namespace WebEngineViewer
14 {
15 /**
16  * @brief The BlockMailTrackingUrlInterceptor class
17  * @author Laurent Montel <[email protected]>
18  */
20 {
21  Q_OBJECT
22 public:
23  struct TrackerBlackList {
24  TrackerBlackList() = default;
25  TrackerBlackList(const QString &company, const QString &pattern, const QString &url)
26  : mCompanyName(company)
27  , mCompanyUrl(url)
28  , mPattern(pattern)
29  {
30  }
31 
32  QString mCompanyName;
33  QString mCompanyUrl;
34  QString mPattern;
35  };
36 
37  explicit BlockTrackingUrlInterceptor(QObject *parent = nullptr);
38  ~BlockTrackingUrlInterceptor() override;
39  Q_REQUIRED_RESULT bool interceptRequest(QWebEngineUrlRequestInfo &info) override;
40 
41  Q_REQUIRED_RESULT bool enabledMailTrackingInterceptor() const;
42  void setEnabledMailTrackingInterceptor(bool enabledMailTrackingInterceptor);
43 
44 Q_SIGNALS:
45  void trackingFound(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &);
46 
47 private:
48  void initializeList();
49  QVector<TrackerBlackList> mBackList;
50  bool mEnabledMailTrackingInterceptor = false;
51 };
52 }
53 Q_DECLARE_TYPEINFO(WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList, Q_MOVABLE_TYPE);
54 Q_DECLARE_METATYPE(WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList)
55 WEBENGINEVIEWER_EXPORT QDebug operator<<(QDebug d, const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &t);
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
The BlockMailTrackingUrlInterceptor class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Mar 27 2023 04:08:16 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.