1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2020 David Faure <faure@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6*/
7
8#ifndef WIDGETSUNTRUSTEDPROGRAMHANDLER_H
9#define WIDGETSUNTRUSTEDPROGRAMHANDLER_H
10
11#include "untrustedprogramhandlerinterface.h"
12
13#include <memory>
14
15class QDialog;
16class QWidget;
17
18namespace KIO
19{
20// TODO KF6: Make KIO::JobUiDelegate inherit from WidgetsUntrustedProgramHandler
21// (or even merge the two classes)
22// so that setDelegate(new KIO::JobUiDelegate) provides both dialog boxes on error
23// and the messagebox for handling untrusted programs.
24// Then port those users of ApplicationLauncherJob which were setting a KDialogJobUiDelegate
25// to set a KIO::JobUiDelegate instead.
26class WidgetsUntrustedProgramHandlerPrivate;
27
28class WidgetsUntrustedProgramHandler : public UntrustedProgramHandlerInterface
29{
30 Q_OBJECT
31public:
32 explicit WidgetsUntrustedProgramHandler(QObject *parent = nullptr);
33 ~WidgetsUntrustedProgramHandler() override;
34
35 void showUntrustedProgramWarning(KJob *job, const QString &programName) override;
36
37 void setWindow(QWidget *window);
38
39private:
40 QDialog *createDialog(QWidget *parentWidget, const QString &programName);
41
42 std::unique_ptr<WidgetsUntrustedProgramHandlerPrivate> d;
43};
44
45}
46
47#endif // WIDGETSUNTRUSTEDPROGRAMHANDLER_H
48

source code of kio/src/widgets/widgetsuntrustedprogramhandler.h