1 /***************************************************************************
2 * Copyright (C) 2013 by Frank Reininghaus <frank78ac@googlemail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef KDIRECTORYCONTENTSCOUNTERWORKER_H
21 #define KDIRECTORYCONTENTSCOUNTERWORKER_H
28 class KDirectoryContentsCounterWorker
: public QObject
35 CountHiddenFiles
= 0x1,
36 CountDirectoriesOnly
= 0x2
38 Q_DECLARE_FLAGS(Options
, Option
)
41 /// number of elements in the directory
43 /// Recursive sum of the size of the directory content files and folders
44 /// Calculation depends on DetailsModeSettings::recursiveDirectorySizeLimit
48 explicit KDirectoryContentsCounterWorker(QObject
* parent
= nullptr);
51 * Counts the items inside the directory \a path using the options
54 * @return The number of items.
56 static CountResult
subItemsCount(const QString
& path
, Options options
);
60 * Signals that the directory \a path contains \a count items and optionally the size of its content.
62 void result(const QString
& path
, int count
, long size
);
66 * Requests the number of items inside the directory \a path using the
67 * options \a options. The result is announced via the signal \a result.
69 // Note that the full type name KDirectoryContentsCounterWorker::Options
70 // is needed here. Just using 'Options' is OK for the compiler, but
72 void countDirectoryContents(const QString
& path
, KDirectoryContentsCounterWorker::Options options
);
75 Q_DECLARE_METATYPE(KDirectoryContentsCounterWorker::Options
)
76 Q_DECLARE_OPERATORS_FOR_FLAGS(KDirectoryContentsCounterWorker::Options
)