Skip to content

TrashSizeCache: Use correct flags for QDirIterator

Wolfgang Müller requested to merge wylfen/kio:fix-trash-size into master

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:

  1. The kioworker no longer correctly reports the size of the trash
  2. 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.

CCBUG: 479283

Merge request reports

Loading