File indexing completed on 2024-12-08 09:41:44
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2020 Ahmad Samir <a.samirh78@gmail.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 #ifndef WIDGETSASKUSERACTIONHANDLER_H 0009 #define WIDGETSASKUSERACTIONHANDLER_H 0010 0011 #include "kiowidgets_export.h" 0012 #include <kio/askuseractioninterface.h> 0013 #include <kio/global.h> 0014 #include <kio/jobuidelegateextension.h> 0015 #include <kio/renamedialog.h> 0016 #include <kio/skipdialog.h> 0017 0018 namespace KIO 0019 { 0020 // TODO KF6: Handle this the same way we end up handling WidgetsUntrustedProgramHandler. 0021 0022 /** 0023 * @class KIO::WidgetsAskUserActionHandler widgetsaskuseractionhandler.h <KIO/WidgetsAskUserActionHandler> 0024 * 0025 * This implements KIO::AskUserActionInterface. 0026 * @see KIO::AskUserActionInterface() 0027 * 0028 * @sa KIO::JobUiDelegateExtension() 0029 * 0030 * @since 5.78 0031 * @note This header wasn't installed until 5.98 0032 */ 0033 0034 class WidgetsAskUserActionHandlerPrivate; 0035 0036 class KIOWIDGETS_EXPORT WidgetsAskUserActionHandler : public AskUserActionInterface 0037 { 0038 Q_OBJECT 0039 public: 0040 explicit WidgetsAskUserActionHandler(QObject *parent = nullptr); 0041 0042 ~WidgetsAskUserActionHandler() override; 0043 0044 /** 0045 * @copydoc KIO::AskUserActionInterface::askUserRename() 0046 */ 0047 void askUserRename(KJob *job, 0048 const QString &title, 0049 const QUrl &src, 0050 const QUrl &dest, 0051 KIO::RenameDialog_Options options, 0052 KIO::filesize_t sizeSrc = KIO::filesize_t(-1), 0053 KIO::filesize_t sizeDest = KIO::filesize_t(-1), 0054 const QDateTime &ctimeSrc = {}, 0055 const QDateTime &ctimeDest = {}, 0056 const QDateTime &mtimeSrc = {}, 0057 const QDateTime &mtimeDest = {}) override; 0058 0059 /** 0060 * @copydoc KIO::AskUserActionInterface::askUserSkip() 0061 */ 0062 void askUserSkip(KJob *job, KIO::SkipDialog_Options options, const QString &error_text) override; 0063 0064 /** 0065 * @copydoc KIO::AskUserActionInterface::askUserDelete() 0066 */ 0067 void askUserDelete(const QList<QUrl> &urls, DeletionType deletionType, ConfirmationType confirmationType, QWidget *parent = nullptr) override; 0068 0069 /** 0070 * @copydoc KIO::AskUserActionInterface::requestUserMessageBox() 0071 */ 0072 void requestUserMessageBox(MessageDialogType type, 0073 const QString &text, 0074 const QString &title, 0075 const QString &primaryActionText, 0076 const QString &secondaryActionText, 0077 const QString &primaryActionIconName = {}, 0078 const QString &secondaryActionIconName = {}, 0079 const QString &dontAskAgainName = {}, 0080 const QString &details = {}, 0081 const KIO::MetaData &metaData = {}, 0082 QWidget *parent = nullptr) override; 0083 0084 void setWindow(QWidget *window); 0085 0086 private: 0087 std::unique_ptr<WidgetsAskUserActionHandlerPrivate> d; 0088 }; 0089 0090 } // namespace KIO 0091 0092 #endif // WIDGETSASKUSERACTIONHANDLER_H