File indexing completed on 2024-10-06 09:39:26

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org>
0004     SPDX-FileCopyrightText: 2000-2009 David Faure <faure@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef MKDIRJOB_H
0010 #define MKDIRJOB_H
0011 
0012 #include "kiocore_export.h"
0013 #include "simplejob.h"
0014 
0015 namespace KIO
0016 {
0017 class MkdirJobPrivate;
0018 /**
0019  * @class KIO::MkdirJob mkdirjob.h <KIO/MkdirJob>
0020  *
0021  * A KIO job that creates a directory
0022  * @see KIO::mkdir()
0023  */
0024 class KIOCORE_EXPORT MkdirJob : public SimpleJob
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     ~MkdirJob() override;
0030 
0031 Q_SIGNALS:
0032     /**
0033      * Signals a redirection.
0034      * Use to update the URL shown to the user.
0035      * The redirection itself is handled internally.
0036      * @param job the job that is redirected
0037      * @param url the new url
0038      */
0039     void redirection(KIO::Job *job, const QUrl &url);
0040 
0041     /**
0042      * Signals a permanent redirection.
0043      * The redirection itself is handled internally.
0044      * @param job the job that is redirected
0045      * @param fromUrl the original URL
0046      * @param toUrl the new URL
0047      */
0048     void permanentRedirection(KIO::Job *job, const QUrl &fromUrl, const QUrl &toUrl);
0049 
0050 protected Q_SLOTS:
0051     void slotFinished() override;
0052 
0053 protected:
0054     KIOCORE_NO_EXPORT explicit MkdirJob(MkdirJobPrivate &dd);
0055 
0056 private:
0057     Q_DECLARE_PRIVATE(MkdirJob)
0058 };
0059 
0060 /**
0061  * Creates a single directory.
0062  *
0063  * @param url The URL of the directory to create.
0064  * @param permissions The permissions to set after creating the
0065  *                    directory (unix-style), -1 for default permissions.
0066  * @return A pointer to the job handling the operation.
0067  */
0068 KIOCORE_EXPORT MkdirJob *mkdir(const QUrl &url, int permissions = -1);
0069 
0070 }
0071 
0072 #endif /* MKDIRJOB_H */