/* This file is part of the KDE project Copyright (C) 2000 Matej Koss Copyright (C) 2007 Kevin Ottens Copyright (C) 2008 Rafael Fernández López This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KABSTRACTWIDGETJOBTRACKER_H #define KABSTRACTWIDGETJOBTRACKER_H #include #include #include class KJob; /** * The base class for widget based job trackers. */ class KDEUI_EXPORT KAbstractWidgetJobTracker : public KJobTrackerInterface { Q_OBJECT public: /** * Creates a new KAbstractWidgetJobTracker * * @param parent the parent of this object and of the widget displaying the job progresses */ KAbstractWidgetJobTracker(QWidget *parent = nullptr); public: /** * The widget associated to this tracker. * * @param job the job that is assigned the widget we want to return * @return the widget displaying the job progresses */ virtual QWidget *widget(KJob *job) = 0; /** * This controls whether the job should be canceled if the dialog is closed. * * @param job the job's widget that will be stopped when closing * @param stopOnClose If true the job will be stopped if the dialog is closed, * otherwise the job will continue even on close. * @see stopOnClose() */ virtual void setStopOnClose(KJob *job, bool stopOnClose); /** * Checks whether the job will be killed when the dialog is closed. * * @param job the job's widget that will be stopped when closing * @return true if the job is killed on close event, false otherwise. * @see setStopOnClose() */ virtual bool stopOnClose(KJob *job) const; protected Q_SLOTS: /** * Called when a job is finished, in any case. It is used to notify * that the job is terminated and that progress UI (if any) can be hidden. * * @param job the job that emitted this signal */ virtual void finished(KJob *job); /** * This method should be called for correct cancellation of IO operation * Connect this to the progress widgets buttons etc. * * @param job The job that is being stopped */ virtual void slotStop(KJob *job); /** * This method should be called for pause/resume * Connect this to the progress widgets buttons etc. * * @param job The job that is being suspended */ virtual void slotSuspend(KJob *job); /** * This method should be called for pause/resume * Connect this to the progress widgets buttons etc. * * @param job The job that is being resumed */ virtual void slotResume(KJob *job); Q_SIGNALS: /** * Emitted when the user aborted the operation * * @param job The job that has been stopped */ void stopped(KJob *job); /** * Emitted when the user suspended the operation * * @param job The job that has been suspended */ void suspend(KJob *job); /** * Emitted when the user resumed the operation * * @param job The job that has been resumed */ void resume(KJob *job); }; #endif // KABSTRACTWIDGETJOBTRACKER_H