After refreshing the view when
size count is selected as the sortRole,
count is 0 at first. When the actual count is loaded,
the sorting is done according to the count being 0.
This can break the sort order and cause view and model
to be out of sync.
Making sure we always resort all items
when the directory size/item count is changed fixes this
BUG:473999
Fixes a weird bug with the treeview if one has
```
[PreviewSettings]
Plugins=audiothumbnail
```
in their `dolphinrc`. It can be any PreviewSettings plugin, as long as there it at least one.
Check the bug report for more, but in short, the bug is reproducible like this:
```
create folder tree inside a test folder with
mkdir -p 1/A/B/C/D/E/F/G/H/I
mkdir -p 2/A/B/C/D/E/F/G/H/I
mkdir -p 3/A/B/C/D/E/F/G/H/I
make sure you see the test folder, and expand it
expand folder 1, no need to expand all sub folders
expand folder 2
collapse and expand test folder
3 loses its expansion arrow
if all folders are expanded, only 3 keeps its order
if 1 and all its subfolders are expanded, then test is toggled,
folder 2 also loses its expansion arrow
```
Video of the bug:
![Screencast_20231207_112700](/uploads/4fad2a62a5a9a67760fa7faa8e3bec40/Screencast_20231207_112700.webm)
The path to the bug is: `KFileItemModelRolesUpdater::slotPreviewFailed` -> `KFileItemModelRolesUpdater::applyResolvedRoles` -> `KFileItemModelRolesUpdater::rolesData` -> `KFileItemModelRolesUpdater::startDirectorySizeCounting`.
This causes Dolphin with preview plugins enabled trying to count the directories again, and the data gets reset even if there is something there. This then resets the `isExpandable` flag and that breaks the treeview, causing all kinds of issues, like being able to expand non-directories and makes things out of sync.
BUG:477607
Capturing an index is unsafe as it could be out of date when this is
processed. The user could have changed directory inserted a file or
changed sorting order.
This is to make sure that when the window is resized it is less
likely that the places panel will be resized only because the
status bar doesn't want to become very narrow in width.
The usage of a label to show this space information is problematic
because there are features/actions hidden behind clicking the
label. A button makes this clear. It also fixes the accessibility
of this control because previously this info would never be read
out by screen readers as it couldn't get keyboard focus.
A side-effect of this change is that the free disk space bar looks
more normal with non-Breeze styles. This had been a long-standing
issue.
When possible, use the devicePixelRatio from the scene which on Wayland
unlike the QApplication will properly support fractional scaling.
A KItemViewsUtils class is introduced that can be reused elsewhere.
Before this commit, Dolphin's main view would not react to any
context menu events. It only showed context menus based on
hard-coded mouse or keyboard events i.e. mouse right-click and
presses of the "Menu" key.
This commit removes those hard-coded reactions and instead makes it
so the view shows a context menu whenever a QContextMenuEvent is
received. Therefore, a context menu will now be opened when any
platform- or system-specific context menu triggers are invoked e.g.
the Shift+F10 keyboard shortcut.
Aside from this, the only side-effect is a partial removal of an
unrelated bug: Previously, the hover highlight on items was never
cleared when the header column in details view mode was hovered.
With this commit, the hover is now correctly cleared most of the
time.
This is a followup to 549fad2dae.
That previous commit made sure that the accessibility tree for
Dolphin's main view was complete even though the view had no
parent by explicitly setting an accessible parent.
The folders panel also has a view though and that previous commit
did not contain an explicit call to also set an accessible parent
for it. This commit rectifies that.
Fixes a sanity check & crash in the debug build.
Belongs to Dolphin issue #47.