File indexing completed on 2024-04-28 03:56:21

0001 /*
0002     This file is part of the KDE Frameworks
0003     SPDX-FileCopyrightText: 2020 Kai Uwe Broulik <kde@broulik.de>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KNOTIFICATIONJOBUIDELEGATE_H
0009 #define KNOTIFICATIONJOBUIDELEGATE_H
0010 
0011 #include <KJobUiDelegate>
0012 
0013 #include <QScopedPointer>
0014 
0015 #include <kjobwidgets_export.h>
0016 
0017 class KNotificationJobUiDelegatePrivate;
0018 
0019 /**
0020  * @class KNotificationJobUiDelegate knotificationjobuidelegate.h KNotificationJobUiDelegate
0021  *
0022  * A UI delegate using KNotification for interaction (showing errors and warnings).
0023  *
0024  * @since 6.0
0025  */
0026 class KJOBWIDGETS_EXPORT KNotificationJobUiDelegate : public KJobUiDelegate
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     /**
0032      * Constructs a new KNotificationJobUiDelegate.
0033      * @param flags allows to enable automatic error/warning handling
0034      * @since 6.0
0035      */
0036     explicit KNotificationJobUiDelegate(KJobUiDelegate::Flags flags = {KJobUiDelegate::AutoHandlingDisabled});
0037 
0038     /**
0039      * Destroys the KNotificationJobUiDelegate.
0040      */
0041     ~KNotificationJobUiDelegate() override;
0042 
0043 public:
0044     /**
0045      * Display a notification to inform the user of the error given by
0046      * this job.
0047      */
0048     void showErrorMessage() override;
0049 
0050 protected Q_SLOTS:
0051     bool setJob(KJob *job) override;
0052     void slotWarning(KJob *job, const QString &message) override;
0053 
0054 private:
0055     QScopedPointer<KNotificationJobUiDelegatePrivate> d;
0056 };
0057 
0058 #endif // KNOTIFICATIONJOBUIDELEGATE_H