Warning, file /system/dolphin/src/settings/applyviewpropsjob.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * SPDX-FileCopyrightText: 2006 Peter Penz <peter.penz19@gmail.com> 0003 * 0004 * The code is based on kdelibs/kio/directorysizejob: 0005 * SPDX-FileCopyrightText: 2006 David Faure <faure@kde.org> 0006 * 0007 * SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef APPLYVIEWPROPSJOB_H 0011 #define APPLYVIEWPROPSJOB_H 0012 0013 #include <KIO/Job> 0014 #include <KIO/UDSEntry> 0015 0016 #include <QUrl> 0017 0018 class ViewProperties; 0019 0020 /** 0021 * @brief Applies view properties recursively to directories. 0022 * 0023 * Usage: 0024 * \code 0025 * KJob* job = new ApplyViewPropsJob(dir, viewProps); 0026 * connect(job, SIGNAL(result(KJob*)), 0027 * this, SLOT(slotResult(KJob*))); 0028 * \endcode 0029 * 0030 * To be able to show a progress of the operation, the following steps 0031 * are recommended: 0032 * - Use a DirectorySizeJob to count the number of directories. 0033 * - Use a timer to show the current count of directories by invoking 0034 * DirectorySizeJob::totalSubdirs() until the result signal is emitted. 0035 * - Use the ApplyViewPropsJob. 0036 * - Use a timer to show the progress by invoking ApplyViwePropsJob::progress(). 0037 * In combination with the total directory count it is possible to show a 0038 * progress bar now. 0039 */ 0040 class ApplyViewPropsJob : public KIO::Job 0041 { 0042 Q_OBJECT 0043 0044 public: 0045 /** 0046 * @param dir Directory where the view properties should be applied to 0047 * (including sub directories). 0048 * @param viewProps View properties for the directory \a dir including its 0049 * sub directories. 0050 */ 0051 ApplyViewPropsJob(const QUrl &dir, const ViewProperties &viewProps); 0052 ~ApplyViewPropsJob() override; 0053 int progress() const; 0054 0055 private Q_SLOTS: 0056 void slotResult(KJob *job) override; 0057 void slotEntries(KIO::Job *, const KIO::UDSEntryList &); 0058 0059 private: 0060 ViewProperties *m_viewProps; 0061 int m_progress; 0062 QUrl m_dir; 0063 }; 0064 0065 inline int ApplyViewPropsJob::progress() const 0066 { 0067 return m_progress; 0068 } 0069 0070 #endif