1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz@gmx.at> *
4 * The code is based on kdelibs/kio/kio/directorysizejob.* *
5 * (C) 2006 by David Faure <faure@kde.org> *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
21 ***************************************************************************/
23 #ifndef APPLYVIEWPROPSJOB_H
24 #define APPLYVIEWPROPSJOB_H
27 #include <kfileitem.h>
33 * @brief Applies view properties recursively to directories.
37 * KJob* job = new ApplyViewPropsJob(dir, viewProps);
38 * connect(job, SIGNAL(result(KJob*)),
39 * this, SLOT(slotResult(KJob*)));
42 * To be able to show a progress of the operation, the following steps
44 * - Use a DirectorySizeJob to count the number of directories.
45 * - Use a timer to show the current count of directories by invoking
46 * DirectorySizeJob::totalSubdirs() until the result signal is emitted.
47 * - Use the ApplyViewPropsJob.
48 * - Use a timer to show the progress by invoking ApplyViwePropsJob::progress().
49 * In combination with the total directory count it is possible to show a
52 class ApplyViewPropsJob
: public KIO::Job
58 * @param dir Directory where the view properties should be applied to
59 * (including sub directories).
60 * @param viewProps View properties for the directory \a dir including its
63 ApplyViewPropsJob(const KUrl
& dir
, const ViewProperties
& viewProps
);
64 virtual ~ApplyViewPropsJob();
68 virtual void slotResult(KJob
* job
);
69 void slotEntries(KIO::Job
*, const KIO::UDSEntryList
&);
72 ViewProperties
* m_viewProps
;
78 inline int ApplyViewPropsJob::progress() const