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 |
20 | * |
21 | * \inmodule KJobWidgets |
22 | * |
23 | * \brief A UI delegate using KMessageBox for interaction (showing errors and warnings). |
24 | * |
25 | * The KMessageBox will use window as a parent in an application-modal. |
26 | */ |
27 | class KJOBWIDGETS_EXPORT KDialogJobUiDelegate : public KJobUiDelegate |
28 | { |
29 | Q_OBJECT |
30 | |
31 | public: |
32 | /*! |
33 | * Constructs a new KDialogJobUiDelegate. |
34 | */ |
35 | KDialogJobUiDelegate(); |
36 | |
37 | /*! |
38 | * Constructs a new KDialogJobUiDelegate. |
39 | * |
40 | * \a flags allows to enable automatic error/warning handling |
41 | * |
42 | * \a window the window associated with this delegate, see setWindow. |
43 | * |
44 | * \since 5.70 |
45 | */ |
46 | explicit KDialogJobUiDelegate(KJobUiDelegate::Flags flags, QWidget *window); |
47 | |
48 | ~KDialogJobUiDelegate() override; |
49 | |
50 | public: |
51 | bool setJob(KJob *job) override; |
52 | |
53 | /*! |
54 | * Associate this delegate with a window given by \a window. |
55 | * |
56 | * Needed for dialog boxes to respect stacking order, centering to parent, focus going back to parent after closing... |
57 | * |
58 | * \a window the window to associate to |
59 | * |
60 | * \sa window() |
61 | */ |
62 | virtual void setWindow(QWidget *window); |
63 | |
64 | /*! |
65 | * Returns the window this delegate is associated with. |
66 | * |
67 | * \sa setWindow() |
68 | */ |
69 | QWidget *window() const; |
70 | |
71 | /*! |
72 | * Updates the last user action timestamp to the given time. |
73 | */ |
74 | void updateUserTimestamp(unsigned long time); |
75 | |
76 | /*! |
77 | * \internal |
78 | */ |
79 | unsigned long userTimestamp() const; |
80 | |
81 | void showErrorMessage() override; |
82 | |
83 | protected Q_SLOTS: |
84 | void slotWarning(KJob *job, const QString &message) override; |
85 | |
86 | private: |
87 | std::unique_ptr<class KDialogJobUiDelegatePrivate> const d; |
88 | }; |
89 | |
90 | #endif |
91 | |