TrashSizeCache: Use correct flags for QDirIterator
When calculating the total size of the trash we iterate through the
files using a QDirIterator
. In 0ab81b6b (trashimpl: optimize
TrashSizeCache::calculateSize, 2023-09-05) its invocation was changed to
include the QDir::NoDotAndDotDot
filter intended to replace a manual
check later.
However, when given on its own, QDir::NoDotAndDotDot
will not match any
files, so the iterator is always empty. Regardless of the amount of
files in the trash we always report a size of 0.
This causes a number of issues:
- The kioworker no longer correctly reports the size of the trash
- Whilst items that are bigger than the trash limit are treated correctly, several smaller trashed files can exceed that limit. No automatic cleanup of older/bigger files is ever done.
Fix this issue by combining QDir:NoDotAndDotDot
with QDir::Dirs
and
QDir::Files
. We specifically do not need to recurse because we want to
cache whole directory sizes in the directorysizes file.