Messagelib

blocktrackingurlinterceptor.h
1 /*
2  SPDX-FileCopyrightText: 2017-2021 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 <QVector>
11 #include <WebEngineViewer/NetworkPluginUrlInterceptorInterface>
12 namespace WebEngineViewer
13 {
14 /**
15  * @brief The BlockMailTrackingUrlInterceptor class
16  * @author Laurent Montel <[email protected]>
17  */
19 {
20  Q_OBJECT
21 public:
22  struct TrackerBlackList {
23  TrackerBlackList() = default;
24  TrackerBlackList(const QString &company, const QString &pattern, const QString &url)
25  : mCompanyName(company)
26  , mCompanyUrl(url)
27  , mPattern(pattern)
28  {
29  }
30 
31  QString mCompanyName;
32  QString mCompanyUrl;
33  QString mPattern;
34  };
35 
36  explicit BlockTrackingUrlInterceptor(QObject *parent = nullptr);
37  ~BlockTrackingUrlInterceptor() override;
38  Q_REQUIRED_RESULT bool interceptRequest(QWebEngineUrlRequestInfo &info) override;
39 
40  Q_REQUIRED_RESULT bool enabledMailTrackingInterceptor() const;
41  void setEnabledMailTrackingInterceptor(bool enabledMailTrackingInterceptor);
42 
43 Q_SIGNALS:
44  void trackingFound(const WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList &);
45 
46 private:
47  void initializeList();
48  QVector<TrackerBlackList> mBackList;
49  bool mEnabledMailTrackingInterceptor = false;
50 };
51 }
52 Q_DECLARE_TYPEINFO(WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList, Q_MOVABLE_TYPE);
53 Q_DECLARE_METATYPE(WebEngineViewer::BlockTrackingUrlInterceptor::TrackerBlackList)
The BlockMailTrackingUrlInterceptor class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Dec 6 2021 23:04:56 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.