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 <QList>
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  [[nodiscard]] bool interceptRequest(QWebEngineUrlRequestInfo &info) override;
40 
41  [[nodiscard]] bool enabledMailTrackingInterceptor() const;
42  void setEnabledMailTrackingInterceptor(bool enabledMailTrackingInterceptor);
43 
44 Q_SIGNALS:
45  void trackingFound(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &);
46 
47 private:
48  WEBENGINEVIEWER_NO_EXPORT void initializeList();
49  QList<TrackerBlackList> mBackList;
50  bool mEnabledMailTrackingInterceptor = false;
51 };
52 }
53 Q_DECLARE_TYPEINFO(WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList, Q_RELOCATABLE_TYPE);
54 Q_DECLARE_METATYPE(WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList)
55 WEBENGINEVIEWER_EXPORT QDebug operator<<(QDebug d, const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &t);
QDataStream & operator<<(QDataStream &out, const KDateTime &dateTime)
The BlockMailTrackingUrlInterceptor class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Nov 28 2023 04:03:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.