2 * SPDX-FileCopyrightText: 2013 Frank Reininghaus <frank78ac@googlemail.com>
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #ifndef KDIRECTORYCONTENTSCOUNTERWORKER_H
8 #define KDIRECTORYCONTENTSCOUNTERWORKER_H
15 class KDirectoryContentsCounterWorker
: public QObject
22 CountHiddenFiles
= 0x1,
23 CountDirectoriesOnly
= 0x2
25 Q_DECLARE_FLAGS(Options
, Option
)
28 /// number of elements in the directory
30 /// Recursive sum of the size of the directory content files and folders
31 /// Calculation depends on DetailsModeSettings::recursiveDirectorySizeLimit
35 explicit KDirectoryContentsCounterWorker(QObject
* parent
= nullptr);
38 * Counts the items inside the directory \a path using the options
41 * @return The number of items.
43 static CountResult
subItemsCount(const QString
& path
, Options options
);
47 * Signals that the directory \a path contains \a count items and optionally the size of its content.
49 void result(const QString
& path
, int count
, long size
);
53 * Requests the number of items inside the directory \a path using the
54 * options \a options. The result is announced via the signal \a result.
56 // Note that the full type name KDirectoryContentsCounterWorker::Options
57 // is needed here. Just using 'Options' is OK for the compiler, but
59 void countDirectoryContents(const QString
& path
, KDirectoryContentsCounterWorker::Options options
);
62 Q_DECLARE_METATYPE(KDirectoryContentsCounterWorker::Options
)
63 Q_DECLARE_OPERATORS_FOR_FLAGS(KDirectoryContentsCounterWorker::Options
)