Bug 482470 - Desktop folder view's "Sort By" option reverts to "Unsorted" when adding files to the desktop via any method
Summary: Desktop folder view's "Sort By" option reverts to "Unsorted" when adding file...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Desktop icons & Folder View widget (other bugs)
Version First Reported In: 6.0.0
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: usability
: 501930 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-03-05 13:43 UTC by Katalin Rebhan
Modified: 2025-05-12 13:20 UTC (History)
6 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Katalin Rebhan 2024-03-05 13:43:32 UTC
SUMMARY
My desktop is set to sort files by name, with locked icons. When I drag a file from Dolphin to the desktop, the file is placed under the cursor and the Sort By option reverts to unsorted, despite the Locked option being set.

STEPS TO REPRODUCE
1. Lock desktop icons and set Sort By to something other than Unsorted
2. Drag a file from Dolphin to the desktop

OBSERVED RESULT
The file is placed under the cursor and the Sort By option reverts to Unsorted

EXPECTED RESULT
The file is sorted and placed as if it were pasted with ctrl+v, and the Sort By option doesn't change

SOFTWARE/OS VERSIONS
Operating System: NixOS 24.05
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.6.18 (64-bit)
Graphics Platform: Wayland
Processors: 24 × 13th Gen Intel® Core™ i7-13700F
Memory: 62.7 GiB of RAM
Graphics Processor: AMD Radeon RX 6800 XT

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2024-03-05 21:33:03 UTC
It looks like it's interpreting your drag as the desire to place those icons in the specified location, which would have to reset the sort mode to "Unsorted" to make it happen. Instead it should disable the "drop icons at this specific location" feature when the sort mode is something other than "Unsorted"
Comment 2 Patrick Silva 2024-03-06 01:14:53 UTC
Well, well...
Losing sorting configuration of icons on desktop is an old Plasma bug, and I thought of it a few hours ago. I never reported it before because I didn't know what steps exactly were triggering it. But finally someone found the cause. Thank you, Marco. :)
Comment 3 Nate Graham 2024-03-06 17:17:29 UTC
When not using the "Unsorted" mode, it should really just prevent you from moving icons at all, rather than letting you do it and then secretly changing the sorting mode.
Comment 4 Rudy Valencia 2025-02-09 00:51:24 UTC
SUMMARY:
This issue also happens when creating new items on the desktop (e.g., new folders or files) using the context menu option Create New > (item type).

STEPS TO REPRODUCE:
1. Ensure the desktop's Icons > Sort By is set to Name.
2. Right-click on the desktop and select Create New > (any item type).
3. Give the item any name.

OBSERVED RESULT:
The item is created close to where the right-click occurred, and the user's Sort By preference changes to Unsorted, whether or not Icons is set to Locked.

EXPECTED RESULT:
The item should be created and placed within the logical sorting order as deteremined by the user's Sort By preference, and the preference should be retained.

SOFTWARE/OS VERSIONS:
Operating System: Arch Linux (rolling)
KDE Plasma version: 6.2.5
KDE Frameworks version: 6.10.0
Qt version: 6.8.1
Kernel version: 6.12.10-arch1-1 (64-bit)
Graphics platform: Wayland

HARDWARE:
Processors: 24 × AMD Ryzen 9 7900X 12-Core Processor
Memory: 62.4 GiB of RAM
Graphics processor: AMD Radeon RX 6600
Comment 5 Nate Graham 2025-03-25 23:05:30 UTC
*** Bug 501930 has been marked as a duplicate of this bug. ***
Comment 6 Bug Janitor Service 2025-05-08 13:54:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2977
Comment 7 Akseli Lahtinen 2025-05-09 08:53:23 UTC
Git commit 03ef2343212bbc4be274b1b37788186df03a8cb3 by Akseli Lahtinen.
Committed on 09/05/2025 at 08:53.
Pushed by akselmo into branch 'master'.

FolderModel: When adding files, keep the current sorting

The sort mode got changed to unsorted if any file was added.
This was probably due to the infinite while loop that would happen
later when we're looking for a new blank spot from an index
that does not exist: This would return an empty QVariant that is
false by default.

We need to check if the index is valid. If it's not, we know
it's a new index and can create one, so it is a blank spot.
FIXED-IN: 6.3.6

M  +4    -8    containments/desktop/plugins/folder/foldermodel.cpp

https://invent.kde.org/plasma/plasma-desktop/-/commit/03ef2343212bbc4be274b1b37788186df03a8cb3
Comment 8 Akseli Lahtinen 2025-05-12 13:20:38 UTC
Git commit f1a9052dff63938fd96890c7f88c6aa508e5f9a6 by Akseli Lahtinen.
Committed on 12/05/2025 at 08:09.
Pushed by akselmo into branch 'Plasma/6.3'.

FolderModel: When adding files, keep the current sorting

The sort mode got changed to unsorted if any file was added.
This was probably due to the infinite while loop that would happen
later when we're looking for a new blank spot from an index
that does not exist: This would return an empty QVariant that is
false by default.

We need to check if the index is valid. If it's not, we know
it's a new index and can create one, so it is a blank spot.
FIXED-IN: 6.3.6


(cherry picked from commit 03ef2343212bbc4be274b1b37788186df03a8cb3)

10260acb FolderModel: When adding files, keep the current sorting
e64705c8 Fix comment, combine ifs

Co-authored-by: Akseli Lahtinen <akselmo@akselmo.dev>

M  +4    -8    containments/desktop/plugins/folder/foldermodel.cpp

https://invent.kde.org/plasma/plasma-desktop/-/commit/f1a9052dff63938fd96890c7f88c6aa508e5f9a6