1 | // -*- c++ -*- |
2 | /* |
3 | This file is part of the KDE libraries |
4 | SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org> |
5 | SPDX-FileCopyrightText: 2000-2006 David Faure <faure@kde.org> |
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 | KIOCORE_NO_EXPORT explicit DeleteJob(DeleteJobPrivate &dd); |
87 | |
88 | private: |
89 | Q_DECLARE_PRIVATE(DeleteJob) |
90 | }; |
91 | |
92 | /** |
93 | * Delete a file or directory. |
94 | * |
95 | * @param src file to delete |
96 | * @param flags We support HideProgressInfo here |
97 | * @return the job handling the operation |
98 | */ |
99 | KIOCORE_EXPORT DeleteJob *del(const QUrl &src, JobFlags flags = DefaultFlags); |
100 | |
101 | /** |
102 | * Deletes a list of files or directories. |
103 | * |
104 | * @param src the files to delete |
105 | * @param flags We support HideProgressInfo here |
106 | * @return the job handling the operation |
107 | */ |
108 | KIOCORE_EXPORT DeleteJob *del(const QList<QUrl> &src, JobFlags flags = DefaultFlags); |
109 | } |
110 | |
111 | #endif |
112 | |