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
17namespace KIO
18{
19class MkpathJobPrivate;
20/**
21 * @class KIO::MkpathJob mkpathjob.h <KIO/MkpathJob>
22 *
23 * A KIO job that creates a directory, after creating all parent
24 * directories necessary for this.
25 *
26 * @see KIO::mkpath(), KIO::mkdir()
27 * @since 5.4
28 */
29class KIOCORE_EXPORT MkpathJob : public Job
30{
31 Q_OBJECT
32
33public:
34 ~MkpathJob() override;
35
36Q_SIGNALS:
37 /**
38 * Signals that a directory was created.
39 */
40 void directoryCreated(const QUrl &url);
41
42protected Q_SLOTS:
43 void slotResult(KJob *job) override;
44
45protected:
46 KIOCORE_NO_EXPORT explicit MkpathJob(MkpathJobPrivate &dd);
47
48private:
49 Q_DECLARE_PRIVATE(MkpathJob)
50};
51
52/**
53 * Creates a directory, creating parent directories as needed.
54 * Unlike KIO::mkdir(), the job will succeed if the directory exists already.
55 *
56 * @param url The URL of the directory to create.
57 * @param baseUrl Optionally, the URL to start from, which is known to exist
58 * (e.g. the directory currently listed).
59 * @param flags mkpath() supports HideProgressInfo.
60 *
61 * If @p baseUrl is not an ancestor of @p url, @p baseUrl will be ignored.
62 *
63 * @return A pointer to the job handling the operation.
64 * @since 5.4
65 */
66KIOCORE_EXPORT MkpathJob *mkpath(const QUrl &url, const QUrl &baseUrl = QUrl(), JobFlags flags = DefaultFlags);
67
68}
69
70#endif /* MKPATHJOB_H */
71

source code of kio/src/core/mkpathjob.h