Bug 449544

Summary: KFilePlacesView flipped from giant icons to tiny icons with a single added entry
Product: [Frameworks and Libraries] frameworks-kio Reporter: Fabian Vogt <fabian>
Component: PlacesAssignee: KIO Bugs <kio-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: felixernst, kde, kdelibs-bugs-null, nate
Priority: NOR    
Version First Reported In: 5.88.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Fabian Vogt 2022-02-03 08:24:44 UTC
I recently changed that the live medium is booted over USB in openQA tests, which added a new device in file dialog's places view. This added item however causes the entire view to show tiny icons now, while without it had giant icons before.

Without USB: https://openqa.opensuse.org/tests/2171982#step/dolphin/22
With USB: https://openqa.opensuse.org/tests/2173471#step/dolphin/23

Looking at the code, this is apparently intended as it only tries icon sizes in multiples of 16px, but it is a bit weird and surprising. It also animates between those 16px icon sizes smoothly, but that indicates to the user that intermediate steps should be possible.
Comment 1 Felix Ernst 2022-02-04 13:53:49 UTC
I believe the "Removable Devices" label is the reason the smallest size is chosen. I couldn't easily test if my MR https://invent.kde.org/frameworks/kio/-/merge_requests/703 also looks at category names but it probably does.

It isn't an exact fix to this bug specifically but fixing this is a nice side-effect of the change I wanted to do anyway.
Comment 2 Felix Ernst 2024-10-13 16:00:12 UTC
Git commit c70e10edfc6ac20fc5d7a092fd87894b09dd91ab by Felix Ernst.
Committed on 13/10/2024 at 16:00.
Pushed by felixernst into branch 'master'.

[KFilePlacesView] Improve automatic resize heuristic

The old logic always chose the smallest possible icon size if any of
the items in the places view had a name that is too long to fit into
the view. This meant that in most typical scenarios, in which a user
has at least one device with a long name, the smallest possible icon
size was chosen.

This commit makes it so the widest 20 percent of texts are ignored
if there is a big difference in width between them and the widest
of the other 80 percent. This way, bigger icon sizes are chosen if
everything fits aside from the text of these few unusually wide names.

The basic advantage of this change is that users have way taller
click targets for the items on the places panel when there is enough
space. If users do not like this, they were never supposed to use the
automatic resize behaviour to begin with, and they can set a fixed
size.

M  +30   -4    src/filewidgets/kfileplacesview.cpp

https://invent.kde.org/frameworks/kio/-/commit/c70e10edfc6ac20fc5d7a092fd87894b09dd91ab