KJobWidgets 5.109.0
kabstractwidgetjobtracker.h
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2000 Matej Koss <koss@miesto.sk>
4 SPDX-FileCopyrightText: 2007 Kevin Ottens <ervin@kde.org>
5 SPDX-FileCopyrightText: 2008 Rafael Fernández López <ereslibre@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-only
8*/
9
10#ifndef KABSTRACTWIDGETJOBTRACKER_H
11#define KABSTRACTWIDGETJOBTRACKER_H
12
13#include <KJobTrackerInterface>
14#include <kjobwidgets_export.h>
15
16#include <memory>
17
18class KJob;
19class QWidget;
20class KAbstractWidgetJobTrackerPrivate;
21
27class KJOBWIDGETS_EXPORT KAbstractWidgetJobTracker : public KJobTrackerInterface
28{
29 Q_OBJECT
30
31public:
37 explicit KAbstractWidgetJobTracker(QWidget *parent = nullptr);
38
43
44 // KDE5: move this two virtual methods to be placed correctly (ereslibre)
45public Q_SLOTS:
53 void registerJob(KJob *job) override;
54
60 void unregisterJob(KJob *job) override;
61
62public:
69 virtual QWidget *widget(KJob *job) = 0;
70
79 void setStopOnClose(KJob *job, bool stopOnClose);
80
88 bool stopOnClose(KJob *job) const;
89
102 void setAutoDelete(KJob *job, bool autoDelete);
103
112 bool autoDelete(KJob *job) const;
113
114protected Q_SLOTS:
121 void finished(KJob *job) override;
122
129 virtual void slotStop(KJob *job);
130
137 virtual void slotSuspend(KJob *job);
138
145 virtual void slotResume(KJob *job);
146
153 virtual void slotClean(KJob *job);
154
155Q_SIGNALS:
161 void stopped(KJob *job);
162
168 void suspend(KJob *job);
169
175 void resume(KJob *job);
176
177protected:
178 KJOBWIDGETS_NO_EXPORT explicit KAbstractWidgetJobTracker(KAbstractWidgetJobTrackerPrivate &dd, QWidget *parent = nullptr);
179
180protected:
181 friend class KStatusBarJobTracker;
182 friend class KWidgetJobTracker;
183 std::unique_ptr<KAbstractWidgetJobTrackerPrivate> const d;
184 // KF6 TODO: change d to d_ptr, use normal Q_DECLARE_PRIVATE, remove friend
185
186private:
187 Q_DECLARE_PRIVATE_D(d, KAbstractWidgetJobTracker)
188};
189
190#endif
The base class for widget based job trackers.
Definition kabstractwidgetjobtracker.h:28
virtual void slotClean(KJob *job)
This method is called when the widget should be cleaned (after job is finished).
bool autoDelete(KJob *job) const
Checks whether the dialog should be deleted or cleaned.
~KAbstractWidgetJobTracker() override
Destroys a KAbstractWidgetJobTracker.
virtual void slotStop(KJob *job)
This method should be called for correct cancellation of IO operation Connect this to the progress wi...
KAbstractWidgetJobTracker(QWidget *parent=nullptr)
Creates a new KAbstractWidgetJobTracker.
void resume(KJob *job)
Emitted when the user resumed the operation.
bool stopOnClose(KJob *job) const
Checks whether the job will be killed when the dialog is closed.
void unregisterJob(KJob *job) override
Unregister a job from this tracker.
void setAutoDelete(KJob *job, bool autoDelete)
This controls whether the dialog should be deleted or only cleaned when the KJob is finished (or canc...
void stopped(KJob *job)
Emitted when the user aborted the operation.
void registerJob(KJob *job) override
Register a new job in this tracker.
void setStopOnClose(KJob *job, bool stopOnClose)
This controls whether the job should be canceled if the dialog is closed.
void finished(KJob *job) override
Called when a job is finished, in any case.
virtual void slotResume(KJob *job)
This method should be called for pause/resume Connect this to the progress widgets buttons etc.
void suspend(KJob *job)
Emitted when the user suspended the operation.
virtual void slotSuspend(KJob *job)
This method should be called for pause/resume Connect this to the progress widgets buttons etc.
virtual QWidget * widget(KJob *job)=0
The widget associated to this tracker.
This class implements a job tracker with a widget suited for embedding in a status bar.
Definition kstatusbarjobtracker.h:23
This class implements a job tracker with a widget suited for use as a progress dialog.
Definition kwidgetjobtracker.h:25