1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org> |
4 | SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org> |
5 | SPDX-FileCopyrightText: 2006, 2007 Kevin Ottens <ervin@kde.org> |
6 | |
7 | SPDX-License-Identifier: LGPL-2.0-or-later |
8 | */ |
9 | |
10 | #ifndef KDIALOGJOBUIDELEGATE_H |
11 | #define KDIALOGJOBUIDELEGATE_H |
12 | |
13 | #include <KJobUiDelegate> |
14 | #include <kjobwidgets_export.h> |
15 | |
16 | #include <memory> |
17 | |
18 | /** |
19 | * @class KDialogJobUiDelegate kdialogjobuidelegate.h KDialogJobUiDelegate |
20 | * |
21 | * A UI delegate using KMessageBox for interaction (showing errors and warnings). |
22 | * |
23 | * The KMessageBox will use window as a parent in an application-modal. |
24 | */ |
25 | class KJOBWIDGETS_EXPORT KDialogJobUiDelegate : public KJobUiDelegate |
26 | { |
27 | Q_OBJECT |
28 | |
29 | public: |
30 | /** |
31 | * Constructs a new KDialogJobUiDelegate. |
32 | */ |
33 | KDialogJobUiDelegate(); |
34 | |
35 | /** |
36 | * Constructs a new KDialogJobUiDelegate. |
37 | * @param flags allows to enable automatic error/warning handling |
38 | * @param window the window associated with this delegate, see setWindow. |
39 | * @since 5.70 |
40 | */ |
41 | explicit KDialogJobUiDelegate(KJobUiDelegate::Flags flags, QWidget *window); |
42 | |
43 | /** |
44 | * Destroys the KDialogJobUiDelegate. |
45 | */ |
46 | ~KDialogJobUiDelegate() override; |
47 | |
48 | public: |
49 | /** |
50 | * @reimp |
51 | */ |
52 | bool setJob(KJob *job) override; |
53 | |
54 | /** |
55 | * Associate this delegate with a window given by @p window. |
56 | * Needed for dialog boxes to respect stacking order, centering to parent, focus going back to parent after closing... |
57 | * @param window the window to associate to |
58 | * @see window() |
59 | */ |
60 | virtual void setWindow(QWidget *window); |
61 | |
62 | /** |
63 | * Returns the window this delegate is associated with. |
64 | * @return the associated window |
65 | * @see setWindow() |
66 | */ |
67 | QWidget *window() const; |
68 | |
69 | /** |
70 | * Updates the last user action timestamp to the given time. |
71 | * See KApplication::updateUserTimestamp(). |
72 | */ |
73 | void updateUserTimestamp(unsigned long time); |
74 | |
75 | /** |
76 | * @internal |
77 | */ |
78 | unsigned long userTimestamp() const; |
79 | |
80 | void showErrorMessage() override; |
81 | |
82 | protected Q_SLOTS: |
83 | void slotWarning(KJob *job, const QString &message) override; |
84 | |
85 | private: |
86 | std::unique_ptr<class KDialogJobUiDelegatePrivate> const d; |
87 | }; |
88 | |
89 | #endif |
90 | |