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 |
27 | * \inheaderfile KIO/DeleteJob |
28 | * \inmodule KIOCore |
29 | * |
30 | * \brief A more complex Job to delete files and directories. |
31 | * |
32 | * Don't create the job directly, but use KIO::del() instead. |
33 | * |
34 | * \sa KIO::del() |
35 | */ |
36 | class KIOCORE_EXPORT DeleteJob : public Job |
37 | { |
38 | Q_OBJECT |
39 | |
40 | public: |
41 | ~DeleteJob() override; |
42 | |
43 | /*! |
44 | * Returns the list of URLs. |
45 | */ |
46 | QList<QUrl> urls() const; |
47 | |
48 | Q_SIGNALS: |
49 | |
50 | /*! |
51 | * Emitted when the total number of files is known. |
52 | * |
53 | * \a job the job that emitted this signal |
54 | * |
55 | * \a files the total number of files |
56 | */ |
57 | void totalFiles(KJob *job, unsigned long files); |
58 | /*! |
59 | * Emitted when the total number of directories is known. |
60 | * |
61 | * \a job the job that emitted this signal |
62 | * |
63 | * \a dirs the total number of directories |
64 | */ |
65 | void totalDirs(KJob *job, unsigned long dirs); |
66 | |
67 | /*! |
68 | * Sends the number of processed files. |
69 | * |
70 | * \a job the job that emitted this signal |
71 | * |
72 | * \a files the number of processed files |
73 | */ |
74 | void processedFiles(KIO::Job *job, unsigned long files); |
75 | /*! |
76 | * Sends the number of processed directories. |
77 | * |
78 | * \a job the job that emitted this signal |
79 | * |
80 | * \a dirs the number of processed dirs |
81 | */ |
82 | void processedDirs(KIO::Job *job, unsigned long dirs); |
83 | |
84 | /*! |
85 | * Sends the URL of the file that is currently being deleted. |
86 | * |
87 | * \a job the job that emitted this signal |
88 | * |
89 | * \a file the URL of the file or directory that is being |
90 | * deleted |
91 | */ |
92 | void deleting(KIO::Job *job, const QUrl &file); |
93 | |
94 | protected Q_SLOTS: |
95 | void slotResult(KJob *job) override; |
96 | |
97 | protected: |
98 | KIOCORE_NO_EXPORT explicit DeleteJob(DeleteJobPrivate &dd); |
99 | |
100 | private: |
101 | Q_DECLARE_PRIVATE(DeleteJob) |
102 | }; |
103 | |
104 | /*! |
105 | * \relates KIO::DeleteJob |
106 | * |
107 | * Delete a file or directory. |
108 | * |
109 | * \a src file to delete |
110 | * |
111 | * \a flags We support HideProgressInfo here |
112 | * |
113 | * Returns the job handling the operation |
114 | */ |
115 | KIOCORE_EXPORT DeleteJob *del(const QUrl &src, JobFlags flags = DefaultFlags); |
116 | |
117 | /*! |
118 | * \relates KIO::DeleteJob |
119 | * |
120 | * Deletes a list of files or directories. |
121 | * |
122 | * \a src the files to delete |
123 | * |
124 | * \a flags We support HideProgressInfo here |
125 | * |
126 | * Returns the job handling the operation |
127 | */ |
128 | KIOCORE_EXPORT DeleteJob *del(const QList<QUrl> &src, JobFlags flags = DefaultFlags); |
129 | } |
130 | |
131 | #endif |
132 | |