Bug 426573

Summary: Folder view trashes selected files when pressing Ctrl+d
Product: [Plasma] plasmashell Reporter: g111
Component: Desktop icons & Folder View widgetAssignee: Eike Hein <hein>
Status: RESOLVED FIXED    
Severity: normal CC: bugseforuns, nate, plasma-bugs
Priority: NOR    
Version: 5.18.5   
Target Milestone: 1.0   
Platform: Ubuntu   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=429403
Latest Commit: Version Fixed In: 5.18.6
Sentry Crash Report:

Description g111 2020-09-15 18:05:49 UTC
SUMMARY
I always wondered why files disappeared from my ~/Desktop folder that I had configured in a folder view widget on my desktop. I think I have found what the problem is...

I often have several konsole windows on the desktop. To close them I press and hold ctrl+d. After the last konsole window has been closed a ctrl+d event might be triggered against the desktop. If in such a case a file is selected in the folder view, it is being deleted (moved into the trashcan).

I could not find a way to turn off this folder-view-delete-hotkey configuration.

STEPS TO REPRODUCE
1. put the folder view widget on the desktop
2. select a file or folder in the widget
3. open one or more konsole windows
4. press and hold ctrl+d to close the konsole windows

OBSERVED RESULT
The selected file or folder in the folder view is going to be deleted.

EXPECTED RESULT
Nothing should happen after the last konsole windows has closed.

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 20.04
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Kernel Version: 5.4.0-47-generic
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-2600K CPU @ 3.40GHz
Memory: 7,7 GiB of RAM

ADDITIONAL INFORMATION
There should not exist a hotkey to remove a file by default. At least a requester should pop up to ask if you really want to delete something.
Comment 1 Nate Graham 2020-09-15 18:28:21 UTC
Can confirm, but not sure if this is intentional or a bug. Will investigate.

FWIW the files aren't deleted, they're just moved to the trash. So it's undoable. Still annoying though.
Comment 2 Nate Graham 2020-09-15 18:31:12 UTC
Ctrl+D isn't a standard shortcut for "Move to Trash" so it's probably local to Folder view somehow.
Comment 3 Nate Graham 2020-09-15 19:12:57 UTC
I can't seem to find it. :(
Comment 4 Nate Graham 2020-09-15 19:30:46 UTC
Found it, with help from Eike Hein.

Folder View has code to do this:

> Keys.onPressed: {
>    event.accepted = true;
>    if (event.matches(StandardKey.Delete)) {

StandardKey.Delete includes Ctrl+D as a shortcut.
Comment 5 Bug Janitor Service 2020-09-15 19:35:48 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-integration/-/merge_requests/6
Comment 6 Nate Graham 2020-09-15 21:06:17 UTC
Git commit 15c7926377065da0fea111be303816dca91d087a by Nate Graham.
Committed on 15/09/2020 at 19:40.
Pushed by ngraham into branch 'master'.

Use KDE shortcuts for "move to trash" action coming from QStandardKey

QKeySequence::Delete is the Qt "Move to trash" action, which, by
default, includes Ctrl+D as a shortcut. This is something we don't want
in KDE software, so we need to intercept this action in our integration
plugin and give it the standard KDE shortcuts instead, as we do for
other actions.
FIXED-IN: 5.20

M  +2    -0    src/platformtheme/kdeplatformtheme.cpp

https://invent.kde.org/plasma/plasma-integration/commit/15c7926377065da0fea111be303816dca91d087a
Comment 7 Nate Graham 2020-09-15 21:06:46 UTC
Git commit b629b1d297b9758fe6207a45e960655cdf50bfd0 by Nate Graham.
Committed on 15/09/2020 at 21:06.
Pushed by ngraham into branch 'Plasma/5.18'.

Use KDE shortcuts for "move to trash" action coming from QStandardKey

QKeySequence::Delete is the Qt "Move to trash" action, which, by
default, includes Ctrl+D as a shortcut. This is something we don't want
in KDE software, so we need to intercept this action in our integration
plugin and give it the standard KDE shortcuts instead, as we do for
other actions.
FIXED-IN: 5.20


(cherry picked from commit 15c7926377065da0fea111be303816dca91d087a)

M  +2    -0    src/platformtheme/kdeplatformtheme.cpp

https://invent.kde.org/plasma/plasma-integration/commit/b629b1d297b9758fe6207a45e960655cdf50bfd0
Comment 8 g111 2020-09-16 08:11:07 UTC
Thank you all! This was the fastest analyzing and resolving of an issue that I have reported yet!
Comment 9 Nate Graham 2020-09-17 15:50:05 UTC
:)
Comment 10 Nate Graham 2021-03-10 21:24:18 UTC
*** Bug 404619 has been marked as a duplicate of this bug. ***