KIO

chmodjob.h
1// -*- c++ -*-
2/*
3 This file is part of the KDE libraries
4 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef KIO_CHMODJOB_H
10#define KIO_CHMODJOB_H
11
12#include "global.h"
13#include "job_base.h"
14#include "kiocore_export.h"
15#include <kfileitem.h>
16
17namespace KIO
18{
19class ChmodJobPrivate;
20/**
21 * @class KIO::ChmodJob chmodjob.h <KIO/ChmodJob>
22 *
23 * This job changes permissions on a list of files or directories,
24 * optionally in a recursive manner.
25 * @see KIO::chmod()
26 */
27class KIOCORE_EXPORT ChmodJob : public KIO::Job
28{
29 Q_OBJECT
30public:
31 ~ChmodJob() override;
32
33protected Q_SLOTS:
34 void slotResult(KJob *job) override;
35
36protected:
37 KIOCORE_NO_EXPORT explicit ChmodJob(ChmodJobPrivate &dd);
38
39private:
40 Q_DECLARE_PRIVATE(ChmodJob)
41};
42
43/**
44 * Creates a job that changes permissions/ownership on several files or directories,
45 * optionally recursively.
46 * This version of chmod uses a KFileItemList so that it directly knows
47 * what to do with the items. TODO: a version that takes a QList<QUrl>,
48 * and a general job that stats each url and returns a KFileItemList.
49 *
50 * Note that change of ownership is only supported for local files.
51 *
52 * Inside directories, the "x" bits will only be changed for files that had
53 * at least one "x" bit before, and for directories.
54 * This emulates the behavior of chmod +X.
55 *
56 * @param lstItems The file items representing several files or directories.
57 * @param permissions the permissions we want to set
58 * @param mask the bits we are allowed to change.
59 * For instance, if mask is 0077, we don't change
60 * the "user" bits, only "group" and "others".
61 * @param newOwner If non-empty, the new owner for the files
62 * @param newGroup If non-empty, the new group for the files
63 * @param recursive whether to open directories recursively
64 * @param flags We support HideProgressInfo here
65 * @return The job handling the operation.
66 */
67KIOCORE_EXPORT ChmodJob *chmod(const KFileItemList &lstItems,
68 int permissions,
69 int mask,
70 const QString &newOwner,
71 const QString &newGroup,
72 bool recursive,
73 JobFlags flags = DefaultFlags);
74
75}
76
77#endif
List of KFileItems, which adds a few helper methods to QList<KFileItem>.
Definition kfileitem.h:632
This job changes permissions on a list of files or directories, optionally in a recursive manner.
The base class for all jobs.
A namespace for KIO globals.
KIOCORE_EXPORT ChmodJob * chmod(const KFileItemList &lstItems, int permissions, int mask, const QString &newOwner, const QString &newGroup, bool recursive, JobFlags flags=DefaultFlags)
Creates a job that changes permissions/ownership on several files or directories, optionally recursiv...
Definition chmodjob.cpp:288
@ DefaultFlags
Show the progress info GUI, no Resume and no Overwrite.
Definition job_base.h:246
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:04:57 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.