| 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 |
| 24 | * \inheaderfile KIO/WidgetsAskUserActionHandler |
| 25 | * \inmodule KIOWidgets |
| 26 | * |
| 27 | * This implements KIO::AskUserActionInterface. |
| 28 | * |
| 29 | * \sa KIO::AskUserActionInterface |
| 30 | * \sa KIO::JobUiDelegateExtension |
| 31 | * |
| 32 | * \since 5.78 |
| 33 | */ |
| 34 | class WidgetsAskUserActionHandlerPrivate; |
| 35 | |
| 36 | class KIOWIDGETS_EXPORT WidgetsAskUserActionHandler : public AskUserActionInterface |
| 37 | { |
| 38 | Q_OBJECT |
| 39 | public: |
| 40 | /*! |
| 41 | * |
| 42 | */ |
| 43 | explicit WidgetsAskUserActionHandler(QObject *parent = nullptr); |
| 44 | |
| 45 | ~WidgetsAskUserActionHandler() override; |
| 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 | void askUserSkip(KJob *job, KIO::SkipDialog_Options options, const QString &error_text) override; |
| 60 | |
| 61 | void askUserDelete(const QList<QUrl> &urls, DeletionType deletionType, ConfirmationType confirmationType, QWidget *parent = nullptr) override; |
| 62 | |
| 63 | void requestUserMessageBox(MessageDialogType type, |
| 64 | const QString &text, |
| 65 | const QString &title, |
| 66 | const QString &primaryActionText, |
| 67 | const QString &secondaryActionText, |
| 68 | const QString &primaryActionIconName = {}, |
| 69 | const QString &secondaryActionIconName = {}, |
| 70 | const QString &dontAskAgainName = {}, |
| 71 | const QString &details = {}, |
| 72 | QWidget *parent = nullptr) override; |
| 73 | |
| 74 | void askIgnoreSslErrors(const QVariantMap &sslErrorData, QWidget *parent) override; |
| 75 | |
| 76 | /*! |
| 77 | * |
| 78 | */ |
| 79 | void setWindow(QWidget *window); |
| 80 | |
| 81 | private: |
| 82 | void showSslDetails(const QVariantMap &sslErrorData, QWidget *parentWidget); |
| 83 | std::unique_ptr<WidgetsAskUserActionHandlerPrivate> d; |
| 84 | }; |
| 85 | |
| 86 | } // namespace KIO |
| 87 | |
| 88 | #endif // WIDGETSASKUSERACTIONHANDLER_H |
| 89 | |