Messagelib

createphishingurldatabasejob.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 <QNetworkReply>
10#include <QObject>
11#include <QSslError>
12
13#include "webengineviewer_export.h"
14namespace WebEngineViewer
15{
16struct UpdateDataBaseInfo;
17class CreatePhishingUrlDataBaseJobPrivate;
18/* https://developers.google.com/safe-browsing/v4/update-api */
19/**
20 * @brief The CreatePhishingUrlDataBaseJob class
21 * @author Laurent Montel <montel@kde.org>
22 */
23class WEBENGINEVIEWER_EXPORT CreatePhishingUrlDataBaseJob : public QObject
24{
25 Q_OBJECT
26public:
27 enum DataBaseDownloadType {
28 FullDataBase = 0,
29 UpdateDataBase = 1,
30 };
31
32 enum DataBaseDownloadResult {
33 InvalidData = 0,
34 ValidData = 1,
35 UnknownError = 2,
36 BrokenNetwork = 3,
37 };
38
39 enum ContraintsCompressionType {
40 RawCompression = 0,
41 RiceCompression = 1,
42 };
43
44 explicit CreatePhishingUrlDataBaseJob(QObject *parent = nullptr);
46
47 void start();
48
49 void setDataBaseState(const QString &value);
50
51 void setDataBaseDownloadNeeded(WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadType type);
52
53 [[nodiscard]] QByteArray jsonRequest() const;
54
55 void parseResult(const QByteArray &value);
56
57 void setContraintsCompressionType(CreatePhishingUrlDataBaseJob::ContraintsCompressionType type);
58
59Q_SIGNALS:
60 void finished(const WebEngineViewer::UpdateDataBaseInfo &infoDataBase, WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadResult status);
61 void debugJsonResult(const QByteArray &ba);
62 void debugJson(const QByteArray &ba);
63
64private:
65 WEBENGINEVIEWER_NO_EXPORT void slotDownloadDataBaseFinished(QNetworkReply *reply);
66 WEBENGINEVIEWER_NO_EXPORT void slotSslErrors(QNetworkReply *reply, const QList<QSslError> &error);
67 WEBENGINEVIEWER_NO_EXPORT void slotError(QNetworkReply::NetworkError error);
68
69 std::unique_ptr<CreatePhishingUrlDataBaseJobPrivate> const d;
70};
71}
72Q_DECLARE_METATYPE(WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadType)
73Q_DECLARE_METATYPE(WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadResult)
74Q_DECLARE_METATYPE(WebEngineViewer::CreatePhishingUrlDataBaseJob::ContraintsCompressionType)
Q_SCRIPTABLE CaptureState status()
Q_SCRIPTABLE Q_NOREPLY void start()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.