Bug 500502 - Dolphin size column does not update for folders when a new file is created
Summary: Dolphin size column does not update for folders when a new file is created
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: view-engine: details mode (show other bugs)
Version: 23.08.5
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
: 501248 (view as bug list)
Depends on:
Blocks:
 
Reported: 2025-02-21 04:06 UTC by j.mikkola
Modified: 2025-04-13 14:04 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot of a folder wrongly shown contents (34.49 KB, image/png)
2025-02-21 06:31 UTC, j.mikkola
Details
Screenshot phase 1 (36.11 KB, image/png)
2025-02-21 13:06 UTC, j.mikkola
Details
Screenshot phase 2 (29.18 KB, image/png)
2025-02-21 13:12 UTC, j.mikkola
Details
Screenshot phase 3 (28.51 KB, image/png)
2025-02-21 13:17 UTC, j.mikkola
Details

Note You need to log in before you can comment on or make changes to this bug.
Description j.mikkola 2025-02-21 04:06:27 UTC
SUMMARY


STEPS TO REPRODUCE
1. Open Dolphin with tabs and views saved from earlier session with shortcut "win+E" 
2. none
3. none

OBSERVED RESULT
The "files" view shows in a tab a folder with files and expanded sub folders containing populated but not expanded sub folders as containing "0 items" and without the expanding arrowhead. Some of these not expanded folder are shown as populated and some as empty.

EXPECTED RESULT
All not expanded sub folders should be shown with information about their contents and with the expanding arrow.

SOFTWARE/OS VERSIONS
kinfo says:
Operating System: openSUSE Leap 15.6
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12
Kernel Version: 6.4.0-150600.23.33-default (64-bit)
Graphics Platform: offscreen
Processors: 6 x AMD FX(tm)-6300 Six-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: AMD CAICOS


ADDITIONAL INFORMATION
Refreshing the view (F5) does not help.
Opening a sub folder in a new tab (middle click) shows the contents of the claimed-empty folder, the original tab still claims the folders as empty, F5 again makes no change.

General observation about Dolphin: files or folders changed by other applications are not shown as changed before a manual view refresh (F5).
Comment 1 j.mikkola 2025-02-21 04:21:26 UTC
Just checked: Properties/Alt+Return dialog shows the folder contents and, sometimes, after closing the sub folder contents MAY be updated.
Comment 2 j.mikkola 2025-02-21 06:31:47 UTC
Created attachment 178679 [details]
Screenshot of a folder wrongly shown contents

Unless files named ~* (temporary, I guess) are not meant to be taken into account, looks like to be related to this issue.
Comment 3 j.mikkola 2025-02-21 11:52:29 UTC
A typo in earlier texts: "files or folders changed by other applications are not shown as changed" 
should be 
"files or folders changed by other applications are not ALWAYS shown as changed"
Comment 4 Akseli Lahtinen 2025-02-21 12:09:25 UTC
I am not having the exact same bug, but I am setting this as confirmed.

My repro steps:
1. Set view to details mode
2. Create folder structure such as foo/bar/baz
3. Create new text file to baz folder

The dropdown arrow appears, but the Size column doesn't increase the file count for the folder(s). However, pressing F5, closing and opening Dolphin, navigating away from the view, etc. refresh the count.

So I think what you're encountering is mostly fixed, there's just this one edge-case that still doesn't work in newer versions of Dolphin.

dolphin 25.03.70
Operating System: Fedora Linux 41
KDE Plasma Version: 6.3.80
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.2
Kernel Version: 6.12.15-200.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Comment 5 j.mikkola 2025-02-21 13:06:40 UTC
Created attachment 178687 [details]
Screenshot phase 1

No F5 used at this stage.
Comment 6 j.mikkola 2025-02-21 13:12:33 UTC
Created attachment 178688 [details]
Screenshot phase 2

Middle-click on "level0" folder icon .
Comment 7 j.mikkola 2025-02-21 13:17:13 UTC
Created attachment 178689 [details]
Screenshot phase 3

Middle-click on phase 2 "l2" folder icon.  Text file created with Kate after tree creation.
Comment 8 j.mikkola 2025-02-21 13:24:30 UTC
After the phases F5 repairs the folders' content indication.

Not sure if these will bring anything new into the subject, though... -just checked the results if I do something similar
Comment 9 Bug Janitor Service 2025-03-03 15:13:26 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/930
Comment 10 Filip 2025-03-09 19:29:37 UTC
*** Bug 501248 has been marked as a duplicate of this bug. ***
Comment 11 Akseli Lahtinen 2025-03-13 12:26:44 UTC
Git commit dd2cc41fdeed515f8b7921caa9da823e3cba424c by Akseli Lahtinen.
Committed on 13/03/2025 at 12:26.
Pushed by akselmo into branch 'master'.

KFileItemModelRolesUpdater: reset size and count before updating folders

Folder count would not update properly when user would delete file from
a folder, or add a new file to it.

Previously when size value is set to -2 after update, the update will
never be called again unless user presses F5. This change will instead
reset that -2 to 0 whenever we are requesting for calculating
directory sizes. 

We never updated the count when a file was deleted, so that has been added as well.

This change also calculates the item counts from the processedAmount, which is the total amount of items we're processing. From there we remove the unwanted items and get the final count.

For remote files, we set the count to -1 since we don't calculate them.

M  +58   -7    src/kitemviews/kfileitemmodelrolesupdater.cpp
M  +4    -0    src/kitemviews/kfileitemmodelrolesupdater.h

https://invent.kde.org/system/dolphin/-/commit/dd2cc41fdeed515f8b7921caa9da823e3cba424c
Comment 12 A. Ismail 2025-04-12 04:18:14 UTC
(In reply to Akseli Lahtinen from comment #11)
> Git commit dd2cc41fdeed515f8b7921caa9da823e3cba424c by Akseli Lahtinen.
> Committed on 13/03/2025 at 12:26.
> Pushed by akselmo into branch 'master'.
> 
> KFileItemModelRolesUpdater: reset size and count before updating folders
> 
> Folder count would not update properly when user would delete file from
> a folder, or add a new file to it.
> 
> Previously when size value is set to -2 after update, the update will
> never be called again unless user presses F5. This change will instead
> reset that -2 to 0 whenever we are requesting for calculating
> directory sizes. 
> 
> We never updated the count when a file was deleted, so that has been added
> as well.
> 
> This change also calculates the item counts from the processedAmount, which
> is the total amount of items we're processing. From there we remove the
> unwanted items and get the final count.
> 
> For remote files, we set the count to -1 since we don't calculate them.
> 
> M  +58   -7    src/kitemviews/kfileitemmodelrolesupdater.cpp
> M  +4    -0    src/kitemviews/kfileitemmodelrolesupdater.h
> 
> https://invent.kde.org/system/dolphin/-/commit/
> dd2cc41fdeed515f8b7921caa9da823e3cba424c

I tried on Both Fedora 41 (Dolphin 24.12.3) and Debian unstable (25.03.90-1) with the latest upstream release and the bug is still there. Did I miss something or the patch wasn't integrated into the latest release?
Comment 13 A. Ismail 2025-04-13 14:04:46 UTC
(In reply to A. Ismail from comment #12)

> I tried on Both Fedora 41 (Dolphin 24.12.3) and Debian unstable (25.03.90-1)
> with the latest upstream release and the bug is still there. Did I miss
> something or the patch wasn't integrated into the latest release?

Nevermind I checked Dolphin's code used in Debian sid and it doesn't have the patch so it is a Debian problem.