Messagelib

checkphishingurlcache.h
1 /*
2  SPDX-FileCopyrightText: 2016-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 <QObject>
11 #include <QUrl>
12 #include <memory>
13 
14 namespace WebEngineViewer
15 {
16 class CheckPhishingUrlCachePrivate;
17 /**
18  * @brief The CheckPhishingUrlCache class
19  * @author Laurent Montel <[email protected]>
20  */
21 class WEBENGINEVIEWER_EXPORT CheckPhishingUrlCache : public QObject
22 {
23  Q_OBJECT
24 public:
25  static CheckPhishingUrlCache *self();
26 
27  enum UrlStatus {
28  UrlOk = 0,
29  MalWare = 1,
30  Unknown = 2,
31  };
32 
33  explicit CheckPhishingUrlCache(QObject *parent = nullptr);
34  ~CheckPhishingUrlCache() override;
35 
36  /**
37  * @brief addCheckingUrlResult cache url. If @p correctUrl is true we store as UrlOk otherwise MalWare
38  * @param url
39  * @param correctUrl
40  */
41  void addCheckingUrlResult(const QUrl &url, bool correctUrl, uint cacheDuration = 0);
42  /**
43  * @brief urlStatus Return the status of cached Url. When we didn't stored it, it returns Unknown
44  * @param url
45  * @return the status of url
46  */
47  Q_REQUIRED_RESULT CheckPhishingUrlCache::UrlStatus urlStatus(const QUrl &url);
48 
49  /**
50  * @brief clearCache clear the cache and save result in config file.
51  */
52  void clearCache();
53 
54 private:
55  std::unique_ptr<CheckPhishingUrlCachePrivate> const d;
56 };
57 }
58 
59 Q_DECLARE_METATYPE(WebEngineViewer::CheckPhishingUrlCache::UrlStatus)
The CheckPhishingUrlCache class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Mar 24 2023 04:08:30 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.