File indexing completed on 2023-09-24 04:08:41
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org> 0004 SPDX-FileCopyrightText: 2000-2014 David Faure <faure@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef MKPATHJOB_H 0010 #define MKPATHJOB_H 0011 0012 #include <QUrl> 0013 0014 #include "job_base.h" 0015 #include "kiocore_export.h" 0016 0017 namespace KIO 0018 { 0019 class MkpathJobPrivate; 0020 /** 0021 * @class KIO::MkpathJob mkpathjob.h <KIO/MkpathJob> 0022 * 0023 * A KIO job that creates a directory, after creating all parent 0024 * directories necessary for this. 0025 * 0026 * @see KIO::mkpath(), KIO::mkdir() 0027 * @since 5.4 0028 */ 0029 class KIOCORE_EXPORT MkpathJob : public Job 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 ~MkpathJob() override; 0035 0036 Q_SIGNALS: 0037 /** 0038 * Signals that a directory was created. 0039 */ 0040 void directoryCreated(const QUrl &url); 0041 0042 protected Q_SLOTS: 0043 void slotResult(KJob *job) override; 0044 0045 protected: 0046 KIOCORE_NO_EXPORT explicit MkpathJob(MkpathJobPrivate &dd); 0047 0048 private: 0049 Q_DECLARE_PRIVATE(MkpathJob) 0050 }; 0051 0052 /** 0053 * Creates a directory, creating parent directories as needed. 0054 * Unlike KIO::mkdir(), the job will succeed if the directory exists already. 0055 * 0056 * @param url The URL of the directory to create. 0057 * @param baseUrl Optionally, the URL to start from, which is known to exist 0058 * (e.g. the directory currently listed). 0059 * @param flags mkpath() supports HideProgressInfo. 0060 * 0061 * If @p baseUrl is not an ancestor of @p url, @p baseUrl will be ignored. 0062 * 0063 * @return A pointer to the job handling the operation. 0064 * @since 5.4 0065 */ 0066 KIOCORE_EXPORT MkpathJob *mkpath(const QUrl &url, const QUrl &baseUrl = QUrl(), JobFlags flags = DefaultFlags); 0067 0068 } 0069 0070 #endif /* MKPATHJOB_H */