File indexing completed on 2024-04-28 04:49:51
0001 /* 0002 SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef _K3B_DIR_SIZE_JOB_H_ 0007 #define _K3B_DIR_SIZE_JOB_H_ 0008 0009 #include "k3bthreadjob.h" 0010 #include <KIO/Global> 0011 #include <QUrl> 0012 0013 #include "k3b_export.h" 0014 0015 namespace K3b { 0016 /** 0017 * DirSizeJob is a replacement for KDirSize which allows 0018 * a much finer grained control over what is counted and how. 0019 * Additionally it uses threading for enhanced speed. 0020 * 0021 * For now DirSizeJob only works on local urls. 0022 */ 0023 class LIBK3B_EXPORT DirSizeJob : public ThreadJob 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 explicit DirSizeJob( QObject* parent = 0 ); 0029 ~DirSizeJob() override; 0030 0031 KIO::filesize_t totalSize() const; 0032 0033 /** 0034 * Does also include symlinks to files, devices, and fifos 0035 */ 0036 KIO::filesize_t totalFiles() const; 0037 0038 /** 0039 * Total number of counted dirs. This does also 0040 * include the first dirs the job was started with. 0041 * Does also include symlinks to dirs. 0042 */ 0043 KIO::filesize_t totalDirs() const; 0044 0045 /** 0046 * Includes symlinks to files and folders 0047 */ 0048 KIO::filesize_t totalSymlinks() const; 0049 0050 public Q_SLOTS: 0051 void setUrls( const QList<QUrl>& urls ); 0052 void setFollowSymlinks( bool ); 0053 0054 private: 0055 bool run() override; 0056 bool countDir( const QString& dir ); 0057 bool countFiles( const QStringList& l, const QString& dir ); 0058 0059 class Private; 0060 Private* const d; 0061 }; 0062 } 0063 0064 #endif