| 1 | /* |
| 2 | This file is part of the KDE Frameworks |
| 3 | SPDX-FileCopyrightText: 2020 Kai Uwe Broulik <kde@broulik.de> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 6 | */ |
| 7 | |
| 8 | #ifndef KNOTIFICATIONJOBUIDELEGATE_H |
| 9 | #define KNOTIFICATIONJOBUIDELEGATE_H |
| 10 | |
| 11 | #include <KJobUiDelegate> |
| 12 | |
| 13 | #include <QScopedPointer> |
| 14 | |
| 15 | #include <kjobwidgets_export.h> |
| 16 | |
| 17 | class KNotificationJobUiDelegatePrivate; |
| 18 | |
| 19 | /*! |
| 20 | * \class KNotificationJobUiDelegate |
| 21 | * \inmodule KJobWidgets |
| 22 | * |
| 23 | * \brief A UI delegate using KNotification for interaction (showing errors and warnings). |
| 24 | * |
| 25 | * \since 6.0 |
| 26 | */ |
| 27 | class KJOBWIDGETS_EXPORT KNotificationJobUiDelegate : public KJobUiDelegate |
| 28 | { |
| 29 | Q_OBJECT |
| 30 | |
| 31 | public: |
| 32 | /*! |
| 33 | * Constructs a new KNotificationJobUiDelegate. |
| 34 | * |
| 35 | * \a flags allows to enable automatic error/warning handling |
| 36 | * |
| 37 | * \since 6.0 |
| 38 | */ |
| 39 | explicit KNotificationJobUiDelegate(KJobUiDelegate::Flags flags = {KJobUiDelegate::AutoHandlingDisabled}); |
| 40 | |
| 41 | ~KNotificationJobUiDelegate() override; |
| 42 | |
| 43 | public: |
| 44 | /*! |
| 45 | * Display a notification to inform the user of the error given by |
| 46 | * this job. |
| 47 | */ |
| 48 | void showErrorMessage() override; |
| 49 | |
| 50 | protected Q_SLOTS: |
| 51 | bool setJob(KJob *job) override; |
| 52 | void slotWarning(KJob *job, const QString &message) override; |
| 53 | |
| 54 | private: |
| 55 | QScopedPointer<KNotificationJobUiDelegatePrivate> d; |
| 56 | }; |
| 57 | |
| 58 | #endif // KNOTIFICATIONJOBUIDELEGATE_H |
| 59 | |