Bug 480246

Summary: Column sorting is reset when moving to a different dir
Product: [Applications] dolphin Reporter: Antonio Rojas <arojas>
Component: view-engine: details modeAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kfm-devel, nate
Priority: NOR Keywords: qt6
Version: 24.01.90   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 24.02.2
Sentry Crash Report:

Description Antonio Rojas 2024-01-23 21:51:50 UTC
Since commit 5186f09cabf0af4b0683e75b0bcde1061f84a67e the column sorting in details view is reset when navigating to a different dir

STEPS TO REPRODUCE
1. Click on a column header to sort by that column (different from the currently sorted one)
2. Navigate to some subdir

OBSERVED RESULT
Sorted column is reset

EXPECTED RESULT
Sorted columns is preserved

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux x86_64
KDE Plasma Version: 5.92.0
KDE Frameworks Version: 24.01.90
Qt Version: 6.7.0 beta 1

ADDITIONAL INFORMATION
Comment 1 Bug Janitor Service 2024-01-28 15:36:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/707
Comment 2 Bug Janitor Service 2024-04-08 17:07:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/760
Comment 3 Méven Car 2024-04-09 05:53:44 UTC
Git commit 13cf4c096fc673e43a22746342d25c506bde8405 by Méven Car, on behalf of Felix Ernst.
Committed on 09/04/2024 at 05:53.
Pushed by meven into branch 'master'.

Fix saving sort role after change from header

This is a partial revert of
5186f09cabf0af4b0683e75b0bcde1061f84a67e. That commit tried to
simplify code, however this lead to the saving of view properties
being skipped, introducing the linked bug.

The issue is that by the time the slotSortRoleChangedFromHeader()
method is called, the model already changed its sort role.
Therefore the check if the new role is identical to the old sort
role fails and no saving would occur.

With this partial revert the header will continue to change the
sort role itself (which allows a minor optimization of not double
sorting when also changing the sort order at the same time). The
method slotSortRoleChangedFromHeader() is then only responsible
for saving that change in the ViewProperties and telling the
SortBy menu in the user interface that the sorting has changed.

M  +4    -1    src/views/dolphinview.cpp

https://invent.kde.org/system/dolphin/-/commit/13cf4c096fc673e43a22746342d25c506bde8405