File indexing completed on 2024-12-08 06:40:29

0001 /*
0002     SPDX-FileCopyrightText: 2008 Rob Scheepmaker <r.scheepmaker@student.utwente.nl>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-or-later
0005 */
0006 
0007 #ifndef KDYNAMICJOBTRACKER_H
0008 #define KDYNAMICJOBTRACKER_H
0009 
0010 #include <KJobTrackerInterface>
0011 
0012 #include <memory>
0013 
0014 class KDynamicJobTrackerPrivate;
0015 
0016 /**
0017  * This class implements a simple job tracker which registers any job to the KWidgetJobTracker if a
0018  * kuiserver isn't available on the DBus, or to the KUiServerJobTracker, if a kuiserver is
0019  * available. This way, we have the old dialogs as fallback when the user doesn't use a kuiserver
0020  * applet or application.
0021  */
0022 class KDynamicJobTracker : public KJobTrackerInterface
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     /**
0028      * Creates a new KDynamicJobTracker
0029      *
0030      * @param parent the parent of this object.
0031      */
0032     explicit KDynamicJobTracker(QObject *parent = nullptr);
0033 
0034     /**
0035      * Destroys this KDynamicJobTracker
0036      */
0037     ~KDynamicJobTracker() override;
0038 
0039 public Q_SLOTS:
0040     /**
0041      * Register a new job in this tracker. This call will get forwarded to either KWidgetJobTracker
0042      * or KUiServerJobTracker, depending on the availability of the Kuiserver.
0043      *
0044      * @param job the job to register
0045      */
0046     void registerJob(KJob *job) override;
0047 
0048     /**
0049      * Unregister a job from the tracker it was registered to.
0050      *
0051      * @param job the job to unregister
0052      */
0053     void unregisterJob(KJob *job) override;
0054 
0055 private:
0056     std::unique_ptr<KDynamicJobTrackerPrivate> const d;
0057 };
0058 
0059 #endif