fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / kio / kio / chmodjob.h
bloba38cfa4e91b080a0d0beb070cc9ebbc9a1344054
1 // -*- c++ -*-
2 /* This file is part of the KDE libraries
3 Copyright (C) 2000 David Faure <faure@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #ifndef KIO_CHMODJOB_H
22 #define KIO_CHMODJOB_H
24 #include <kurl.h>
25 #include "global.h"
26 #include "job.h"
27 #include <kfileitem.h>
29 #include <QtCore/QLinkedList>
31 namespace KIO {
33 class ChmodJobPrivate;
34 /**
35 * This job changes permissions on a list of files or directories,
36 * optionally in a recursive manner.
37 * @see KIO::chmod()
39 class KIO_EXPORT ChmodJob : public KIO::Job
41 Q_OBJECT
42 public:
43 virtual ~ChmodJob();
45 protected Q_SLOTS:
46 virtual void slotResult( KJob *job );
48 protected:
49 ChmodJob(ChmodJobPrivate &dd);
51 private:
52 Q_PRIVATE_SLOT(d_func(), void _k_slotEntries( KIO::Job * , const KIO::UDSEntryList & ))
53 Q_PRIVATE_SLOT(d_func(), void _k_processList())
54 Q_DECLARE_PRIVATE(ChmodJob)
58 /**
59 * Creates a job that changes permissions/ownership on several files or directories,
60 * optionally recursively.
61 * This version of chmod uses a KFileItemList so that it directly knows
62 * what to do with the items. TODO: a version that takes a KUrl::List,
63 * and a general job that stats each url and returns a KFileItemList.
65 * Note that change of ownership is only supported for local files.
67 * Inside directories, the "x" bits will only be changed for files that had
68 * at least one "x" bit before, and for directories.
69 * This emulates the behavior of chmod +X.
71 * @param lstItems The file items representing several files or directories.
72 * @param permissions the permissions we want to set
73 * @param mask the bits we are allowed to change.
74 * For instance, if mask is 0077, we don't change
75 * the "user" bits, only "group" and "others".
76 * @param newOwner If non-empty, the new owner for the files
77 * @param newGroup If non-empty, the new group for the files
78 * @param recursive whether to open directories recursively
79 * @param flags: We support HideProgressInfo here
80 * @return The job handling the operation.
82 KIO_EXPORT ChmodJob * chmod( const KFileItemList& lstItems, int permissions, int mask,
83 const QString& newOwner, const QString& newGroup,
84 bool recursive, JobFlags flags = DefaultFlags );
88 #endif