Messagelib

checkphishingurlcache.h
1/*
2 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
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
14namespace WebEngineViewer
15{
16class CheckPhishingUrlCachePrivate;
17/**
18 * @brief The CheckPhishingUrlCache class
19 * @author Laurent Montel <montel@kde.org>
20 */
21class WEBENGINEVIEWER_EXPORT CheckPhishingUrlCache : public QObject
22{
23 Q_OBJECT
24public:
25 explicit CheckPhishingUrlCache(QObject *parent = nullptr);
26 static CheckPhishingUrlCache *self();
27
28 enum UrlStatus {
29 UrlOk = 0,
30 MalWare = 1,
31 Unknown = 2,
32 };
33
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 [[nodiscard]] 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
54private:
55 std::unique_ptr<CheckPhishingUrlCachePrivate> const d;
56};
57}
58
59Q_DECLARE_METATYPE(WebEngineViewer::CheckPhishingUrlCache::UrlStatus)
The CheckPhishingUrlCache class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:05:10 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.