Bug 327708 - remaining space on harddrive should be updated in both views in split view after deleting file(s)
Summary: remaining space on harddrive should be updated in both views in split view af...
Alias: None
Product: dolphin
Classification: Applications
Component: split view (show other bugs)
Version: 4.11.2
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
Depends on:
Reported: 2013-11-16 23:03 UTC by m.wege
Modified: 2014-05-22 16:46 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.14.0


Note You need to log in before you can comment on or make changes to this bug.
Description m.wege 2013-11-16 23:03:18 UTC
When I delete a file in split view, the remaining space on the harddrive is only updated in the part of the split view where the file is deleted. It is not updated in the other part of the split view and other instances of Dolphin even though they show files from the same drive.

Reproducible: Always
Comment 1 Christoph Feck 2013-11-16 23:51:09 UTC
Fixing the split view should be doable, but for other instances, it is different. I am not sure the kernel allows to notify applications when disk usage changes. They probably have to poll, which is bad for battery usage.
Comment 2 Frank Reininghaus 2013-11-18 15:49:10 UTC
Thanks for the bug report. In


the polling (which is done every 10 seconds) was restricted to visible windows to prevent wasting energy - hiding a window stops the polling.

The problem is that showing the window again does not re-start the polling, because StatusBarSpaceInfo::showEvent(QShowEvent* event) only does that if the QShowEvent is not spontaneous.

I think that the problem can also be reproduced when splitting the view because the status bar is temporarily hidden and then re-shown while splitting, which might be considered a "spontaneous" event.

So the fix would probably be to remove the "if (!event->spontaneous())" check, unless it has a purpose that I have overlooked so far. One possible downside would be that this might increase Dolphin's energy consumption in some situations - the polling timers of both split views will fire at different times, which will wake up the CPU and other parts of the system twice as often as now.
Comment 3 Frank Reininghaus 2014-05-22 16:46:37 UTC
Git commit de197075a70905701f18b04d3249fd684de7f79d by Frank Reininghaus.
Committed on 22/05/2014 at 16:42.
Pushed by freininghaus into branch 'master'.

Keep the "free space" information updated in all visible views

The old code would watch the free space on a mount point, i.e.,
determine the free space again, in 10-second intervals, only until the
view became invisible once (even if it was invisible only for a very
short moment, i.e., while splitting the view).

This commit ensures that the mount point is watched again as soon as
the corresponding view becomes visible again.

Moreover, the object that watches the free space for a mount point is
shared among all views that show URLs that belong to this mount point.
To achieve this, there is a central cache which can be used to obtain
an existing MountPointObserver for a certain path. If necessary, a new
MountPointObserver is created and added to the cache.

The MountPointObserver is removed from the cache and destroyed only if
no views use it any more, and no new users appear until the next update
(which happens every 10 seconds). This prevents that the free space is
measured repeatedly when changing the current directory on the same
mount point.

Many thanks to Emmanuel Pescosta for the initial ideas to factor out
the "free space" code and to establish a central storage for the
"observer" objects, and for providing many good suggestions how to
improve the code!
REVIEW: 118208
FIXED-IN: 4.14.0

M  +3    -0    dolphin/src/CMakeLists.txt
C  +26   -43   dolphin/src/statusbar/mountpointobserver.cpp [from: dolphin/src/statusbar/statusbarspaceinfo.h - 057% similarity]
A  +109  -0    dolphin/src/statusbar/mountpointobserver.h     [License: GPL (v2+)]
A  +99   -0    dolphin/src/statusbar/mountpointobservercache.cpp     [License: GPL (v2+)]
C  +23   -30   dolphin/src/statusbar/mountpointobservercache.h [from: dolphin/src/statusbar/statusbarspaceinfo.h - 060% similarity]
A  +89   -0    dolphin/src/statusbar/spaceinfoobserver.cpp     [License: GPL (v2+)]
C  +16   -30   dolphin/src/statusbar/spaceinfoobserver.h [from: dolphin/src/statusbar/statusbarspaceinfo.h - 061% similarity]
M  +19   -38   dolphin/src/statusbar/statusbarspaceinfo.cpp
M  +4    -6    dolphin/src/statusbar/statusbarspaceinfo.h