1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2020 Ahmad Samir <a.samirh78@gmail.com> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
6 | */ |
7 | |
8 | #ifndef WIDGETSASKUSERACTIONHANDLER_H |
9 | #define WIDGETSASKUSERACTIONHANDLER_H |
10 | |
11 | #include "kiowidgets_export.h" |
12 | #include <kio/askuseractioninterface.h> |
13 | #include <kio/global.h> |
14 | #include <kio/jobuidelegateextension.h> |
15 | #include <kio/renamedialog.h> |
16 | #include <kio/skipdialog.h> |
17 | |
18 | namespace KIO |
19 | { |
20 | // TODO KF6: Handle this the same way we end up handling WidgetsUntrustedProgramHandler. |
21 | |
22 | /** |
23 | * @class KIO::WidgetsAskUserActionHandler widgetsaskuseractionhandler.h <KIO/WidgetsAskUserActionHandler> |
24 | * |
25 | * This implements KIO::AskUserActionInterface. |
26 | * @see KIO::AskUserActionInterface() |
27 | * |
28 | * @sa KIO::JobUiDelegateExtension() |
29 | * |
30 | * @since 5.78 |
31 | * @note This header wasn't installed until 5.98 |
32 | */ |
33 | |
34 | class WidgetsAskUserActionHandlerPrivate; |
35 | |
36 | class KIOWIDGETS_EXPORT WidgetsAskUserActionHandler : public AskUserActionInterface |
37 | { |
38 | Q_OBJECT |
39 | public: |
40 | explicit WidgetsAskUserActionHandler(QObject *parent = nullptr); |
41 | |
42 | ~WidgetsAskUserActionHandler() override; |
43 | |
44 | /** |
45 | * @copydoc KIO::AskUserActionInterface::askUserRename() |
46 | */ |
47 | void askUserRename(KJob *job, |
48 | const QString &title, |
49 | const QUrl &src, |
50 | const QUrl &dest, |
51 | KIO::RenameDialog_Options options, |
52 | KIO::filesize_t sizeSrc = KIO::filesize_t(-1), |
53 | KIO::filesize_t sizeDest = KIO::filesize_t(-1), |
54 | const QDateTime &ctimeSrc = {}, |
55 | const QDateTime &ctimeDest = {}, |
56 | const QDateTime &mtimeSrc = {}, |
57 | const QDateTime &mtimeDest = {}) override; |
58 | |
59 | /** |
60 | * @copydoc KIO::AskUserActionInterface::askUserSkip() |
61 | */ |
62 | void askUserSkip(KJob *job, KIO::SkipDialog_Options options, const QString &error_text) override; |
63 | |
64 | /** |
65 | * @copydoc KIO::AskUserActionInterface::askUserDelete() |
66 | */ |
67 | void askUserDelete(const QList<QUrl> &urls, DeletionType deletionType, ConfirmationType confirmationType, QWidget *parent = nullptr) override; |
68 | |
69 | /** |
70 | * @copydoc KIO::AskUserActionInterface::requestUserMessageBox() |
71 | */ |
72 | void requestUserMessageBox(MessageDialogType type, |
73 | const QString &text, |
74 | const QString &title, |
75 | const QString &primaryActionText, |
76 | const QString &secondaryActionText, |
77 | const QString &primaryActionIconName = {}, |
78 | const QString &secondaryActionIconName = {}, |
79 | const QString &dontAskAgainName = {}, |
80 | const QString &details = {}, |
81 | QWidget *parent = nullptr) override; |
82 | |
83 | void askIgnoreSslErrors(const QVariantMap &sslErrorData, QWidget *parent) override; |
84 | |
85 | void setWindow(QWidget *window); |
86 | |
87 | private: |
88 | void showSslDetails(const QVariantMap &sslErrorData, QWidget *parentWidget); |
89 | std::unique_ptr<WidgetsAskUserActionHandlerPrivate> d; |
90 | }; |
91 | |
92 | } // namespace KIO |
93 | |
94 | #endif // WIDGETSASKUSERACTIONHANDLER_H |
95 | |