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 knotificationjobuidelegate.h KNotificationJobUiDelegate |
21 | * |
22 | * A UI delegate using KNotification for interaction (showing errors and warnings). |
23 | * |
24 | * @since 6.0 |
25 | */ |
26 | class KJOBWIDGETS_EXPORT KNotificationJobUiDelegate : public KJobUiDelegate |
27 | { |
28 | Q_OBJECT |
29 | |
30 | public: |
31 | /** |
32 | * Constructs a new KNotificationJobUiDelegate. |
33 | * @param flags allows to enable automatic error/warning handling |
34 | * @since 6.0 |
35 | */ |
36 | explicit KNotificationJobUiDelegate(KJobUiDelegate::Flags flags = {KJobUiDelegate::AutoHandlingDisabled}); |
37 | |
38 | /** |
39 | * Destroys the KNotificationJobUiDelegate. |
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 | |