File indexing completed on 2024-11-03 09:56:03

0001 // -*- c++ -*-
0002 /*
0003     This file is part of the KDE libraries
0004     SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org>
0005     SPDX-FileCopyrightText: 2000-2006 David Faure <faure@kde.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #ifndef KIO_DELETEJOB_H
0011 #define KIO_DELETEJOB_H
0012 
0013 #include <QStringList>
0014 
0015 #include "global.h"
0016 #include "kiocore_export.h"
0017 
0018 #include "job_base.h"
0019 
0020 class QTimer;
0021 
0022 namespace KIO
0023 {
0024 class DeleteJobPrivate;
0025 /**
0026  * @class KIO::DeleteJob deletejob.h <KIO/DeleteJob>
0027  *
0028  * A more complex Job to delete files and directories.
0029  * Don't create the job directly, but use KIO::del() instead.
0030  *
0031  * @see KIO::del()
0032  */
0033 class KIOCORE_EXPORT DeleteJob : public Job
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     ~DeleteJob() override;
0039 
0040     /**
0041      * Returns the list of URLs.
0042      * @return the list of URLs.
0043      */
0044     QList<QUrl> urls() const;
0045 
0046 Q_SIGNALS:
0047 
0048     /**
0049      * Emitted when the total number of files is known.
0050      * @param job the job that emitted this signal
0051      * @param files the total number of files
0052      */
0053     void totalFiles(KJob *job, unsigned long files);
0054     /**
0055      * Emitted when the total number of directories is known.
0056      * @param job the job that emitted this signal
0057      * @param dirs the total number of directories
0058      */
0059     void totalDirs(KJob *job, unsigned long dirs);
0060 
0061     /**
0062      * Sends the number of processed files.
0063      * @param job the job that emitted this signal
0064      * @param files the number of processed files
0065      */
0066     void processedFiles(KIO::Job *job, unsigned long files);
0067     /**
0068      * Sends the number of processed directories.
0069      * @param job the job that emitted this signal
0070      * @param dirs the number of processed dirs
0071      */
0072     void processedDirs(KIO::Job *job, unsigned long dirs);
0073 
0074     /**
0075      * Sends the URL of the file that is currently being deleted.
0076      * @param job the job that emitted this signal
0077      * @param file the URL of the file or directory that is being
0078      *        deleted
0079      */
0080     void deleting(KIO::Job *job, const QUrl &file);
0081 
0082 protected Q_SLOTS:
0083     void slotResult(KJob *job) override;
0084 
0085 protected:
0086     KIOCORE_NO_EXPORT explicit DeleteJob(DeleteJobPrivate &dd);
0087 
0088 private:
0089     Q_DECLARE_PRIVATE(DeleteJob)
0090 };
0091 
0092 /**
0093  * Delete a file or directory.
0094  *
0095  * @param src file to delete
0096  * @param flags We support HideProgressInfo here
0097  * @return the job handling the operation
0098  */
0099 KIOCORE_EXPORT DeleteJob *del(const QUrl &src, JobFlags flags = DefaultFlags);
0100 
0101 /**
0102  * Deletes a list of files or directories.
0103  *
0104  * @param src the files to delete
0105  * @param flags We support HideProgressInfo here
0106  * @return the job handling the operation
0107  */
0108 KIOCORE_EXPORT DeleteJob *del(const QList<QUrl> &src, JobFlags flags = DefaultFlags);
0109 }
0110 
0111 #endif