1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org> |
4 | SPDX-FileCopyrightText: 2000-2014 David Faure <faure@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef MKPATHJOB_H |
10 | #define MKPATHJOB_H |
11 | |
12 | #include <QUrl> |
13 | |
14 | #include "job_base.h" |
15 | #include "kiocore_export.h" |
16 | |
17 | namespace KIO |
18 | { |
19 | class MkpathJobPrivate; |
20 | /*! |
21 | * \class KIO::MkpathJob |
22 | * \inheaderfile KIO/MkpathJob |
23 | * \inmodule KIOCore |
24 | * |
25 | * \brief A KIO job that creates a directory, after creating all parent |
26 | * directories necessary for this. |
27 | * |
28 | * \sa KIO::mkpath() |
29 | * \sa KIO::mkdir() |
30 | * \since 5.4 |
31 | */ |
32 | class KIOCORE_EXPORT MkpathJob : public Job |
33 | { |
34 | Q_OBJECT |
35 | |
36 | public: |
37 | ~MkpathJob() override; |
38 | |
39 | Q_SIGNALS: |
40 | /*! |
41 | * Signals that a directory was created. |
42 | */ |
43 | void directoryCreated(const QUrl &url); |
44 | |
45 | protected Q_SLOTS: |
46 | void slotResult(KJob *job) override; |
47 | |
48 | protected: |
49 | KIOCORE_NO_EXPORT explicit MkpathJob(MkpathJobPrivate &dd); |
50 | |
51 | private: |
52 | Q_DECLARE_PRIVATE(MkpathJob) |
53 | }; |
54 | |
55 | /*! |
56 | * \relates KIO::MkpathJob |
57 | * |
58 | * Creates a directory, creating parent directories as needed. |
59 | * Unlike KIO::mkdir(), the job will succeed if the directory exists already. |
60 | * |
61 | * \a url The URL of the directory to create. |
62 | * |
63 | * \a baseUrl Optionally, the URL to start from, which is known to exist |
64 | * (e.g. the directory currently listed). |
65 | * |
66 | * \a flags mkpath() supports HideProgressInfo. |
67 | * |
68 | * If \a baseUrl is not an ancestor of \a url, \a baseUrl will be ignored. |
69 | * |
70 | * Returns a pointer to the job handling the operation. |
71 | * \since 5.4 |
72 | */ |
73 | KIOCORE_EXPORT MkpathJob *mkpath(const QUrl &url, const QUrl &baseUrl = QUrl(), JobFlags flags = DefaultFlags); |
74 | |
75 | } |
76 | |
77 | #endif /* MKPATHJOB_H */ |
78 | |