KIO

deletejob.h
1 // -*- c++ -*-
2 /*
3  This file is part of the KDE libraries
4  SPDX-FileCopyrightText: 2000 Stephan Kulow <[email protected]>
5  SPDX-FileCopyrightText: 2000-2006 David Faure <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #ifndef KIO_DELETEJOB_H
11 #define KIO_DELETEJOB_H
12 
13 #include <QStringList>
14 
15 #include "global.h"
16 #include "kiocore_export.h"
17 
18 #include "job_base.h"
19 
20 class QTimer;
21 
22 namespace KIO
23 {
24 class DeleteJobPrivate;
25 /**
26  * @class KIO::DeleteJob deletejob.h <KIO/DeleteJob>
27  *
28  * A more complex Job to delete files and directories.
29  * Don't create the job directly, but use KIO::del() instead.
30  *
31  * @see KIO::del()
32  */
33 class KIOCORE_EXPORT DeleteJob : public Job
34 {
35  Q_OBJECT
36 
37 public:
38  ~DeleteJob() override;
39 
40  /**
41  * Returns the list of URLs.
42  * @return the list of URLs.
43  */
44  QList<QUrl> urls() const;
45 
46 Q_SIGNALS:
47 
48  /**
49  * Emitted when the total number of files is known.
50  * @param job the job that emitted this signal
51  * @param files the total number of files
52  */
53  void totalFiles(KJob *job, unsigned long files);
54  /**
55  * Emitted when the total number of directories is known.
56  * @param job the job that emitted this signal
57  * @param dirs the total number of directories
58  */
59  void totalDirs(KJob *job, unsigned long dirs);
60 
61  /**
62  * Sends the number of processed files.
63  * @param job the job that emitted this signal
64  * @param files the number of processed files
65  */
66  void processedFiles(KIO::Job *job, unsigned long files);
67  /**
68  * Sends the number of processed directories.
69  * @param job the job that emitted this signal
70  * @param dirs the number of processed dirs
71  */
72  void processedDirs(KIO::Job *job, unsigned long dirs);
73 
74  /**
75  * Sends the URL of the file that is currently being deleted.
76  * @param job the job that emitted this signal
77  * @param file the URL of the file or directory that is being
78  * deleted
79  */
80  void deleting(KIO::Job *job, const QUrl &file);
81 
82 protected Q_SLOTS:
83  void slotResult(KJob *job) override;
84 
85 protected:
86  DeleteJob(DeleteJobPrivate &dd);
87 
88 private:
89  Q_PRIVATE_SLOT(d_func(), void slotStart())
90  Q_PRIVATE_SLOT(d_func(), void slotEntries(KIO::Job *, const KIO::UDSEntryList &list))
91  Q_PRIVATE_SLOT(d_func(), void slotReport())
92  Q_DECLARE_PRIVATE(DeleteJob)
93 };
94 
95 /**
96  * Delete a file or directory.
97  *
98  * @param src file to delete
99  * @param flags We support HideProgressInfo here
100  * @return the job handling the operation
101  */
102 KIOCORE_EXPORT DeleteJob *del(const QUrl &src, JobFlags flags = DefaultFlags);
103 
104 /**
105  * Deletes a list of files or directories.
106  *
107  * @param src the files to delete
108  * @param flags We support HideProgressInfo here
109  * @return the job handling the operation
110  */
111 KIOCORE_EXPORT DeleteJob *del(const QList<QUrl> &src, JobFlags flags = DefaultFlags);
112 }
113 
114 #endif
@ DefaultFlags
Show the progress info GUI, no Resume and no Overwrite.
Definition: job_base.h:269
KIOCORE_EXPORT DeleteJob * del(const QUrl &src, JobFlags flags=DefaultFlags)
Delete a file or directory.
Definition: deletejob.cpp:590
A namespace for KIO globals.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Aug 9 2022 03:53:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.