File indexing completed on 2023-09-24 04:08:27
0001 // -*- c++ -*- 0002 /* 0003 This file is part of the KDE libraries 0004 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef KIO_CHMODJOB_H 0010 #define KIO_CHMODJOB_H 0011 0012 #include "global.h" 0013 #include "job_base.h" 0014 #include "kiocore_export.h" 0015 #include <kfileitem.h> 0016 0017 namespace KIO 0018 { 0019 class ChmodJobPrivate; 0020 /** 0021 * @class KIO::ChmodJob chmodjob.h <KIO/ChmodJob> 0022 * 0023 * This job changes permissions on a list of files or directories, 0024 * optionally in a recursive manner. 0025 * @see KIO::chmod() 0026 */ 0027 class KIOCORE_EXPORT ChmodJob : public KIO::Job 0028 { 0029 Q_OBJECT 0030 public: 0031 ~ChmodJob() override; 0032 0033 protected Q_SLOTS: 0034 void slotResult(KJob *job) override; 0035 0036 protected: 0037 KIOCORE_NO_EXPORT explicit ChmodJob(ChmodJobPrivate &dd); 0038 0039 private: 0040 Q_DECLARE_PRIVATE(ChmodJob) 0041 }; 0042 0043 /** 0044 * Creates a job that changes permissions/ownership on several files or directories, 0045 * optionally recursively. 0046 * This version of chmod uses a KFileItemList so that it directly knows 0047 * what to do with the items. TODO: a version that takes a QList<QUrl>, 0048 * and a general job that stats each url and returns a KFileItemList. 0049 * 0050 * Note that change of ownership is only supported for local files. 0051 * 0052 * Inside directories, the "x" bits will only be changed for files that had 0053 * at least one "x" bit before, and for directories. 0054 * This emulates the behavior of chmod +X. 0055 * 0056 * @param lstItems The file items representing several files or directories. 0057 * @param permissions the permissions we want to set 0058 * @param mask the bits we are allowed to change. 0059 * For instance, if mask is 0077, we don't change 0060 * the "user" bits, only "group" and "others". 0061 * @param newOwner If non-empty, the new owner for the files 0062 * @param newGroup If non-empty, the new group for the files 0063 * @param recursive whether to open directories recursively 0064 * @param flags We support HideProgressInfo here 0065 * @return The job handling the operation. 0066 */ 0067 KIOCORE_EXPORT ChmodJob *chmod(const KFileItemList &lstItems, 0068 int permissions, 0069 int mask, 0070 const QString &newOwner, 0071 const QString &newGroup, 0072 bool recursive, 0073 JobFlags flags = DefaultFlags); 0074 0075 } 0076 0077 #endif