Messagelib

checkphishingurlcache.h
1 /*
2  SPDX-FileCopyrightText: 2016-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 <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 { UrlOk = 0, MalWare = 1, Unknown = 2 };
28 
29  explicit CheckPhishingUrlCache(QObject *parent = nullptr);
30  ~CheckPhishingUrlCache() override;
31 
32  /**
33  * @brief addCheckingUrlResult cache url. If @p correctUrl is true we store as UrlOk otherwise MalWare
34  * @param url
35  * @param correctUrl
36  */
37  void addCheckingUrlResult(const QUrl &url, bool correctUrl, uint cacheDuration = 0);
38  /**
39  * @brief urlStatus Return the status of cached Url. When we didn't stored it, it returns Unknown
40  * @param url
41  * @return the status of url
42  */
43  CheckPhishingUrlCache::UrlStatus urlStatus(const QUrl &url);
44 
45  /**
46  * @brief clearCache clear the cache and save result in config file.
47  */
48  void clearCache();
49 
50 private:
51  std::unique_ptr<CheckPhishingUrlCachePrivate> const d;
52 };
53 }
54 
55 Q_DECLARE_METATYPE(WebEngineViewer::CheckPhishingUrlCache::UrlStatus)
56 
The CheckPhishingUrlCache class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 23:04:53 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.