Bug 479960

Summary: Drag and drop opens hovered files
Product: [Applications] dolphin Reporter: sasori.nami
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: akselmo, kde, kfm-devel, nate
Priority: HI    
Version: 23.08.4   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In: 24.05
Sentry Crash Report:

Description sasori.nami 2024-01-17 20:20:30 UTC
SUMMARY
Whenever I drag and drop content to another directory I often have to hover over some files to get to the desired destination directory. Invariably, one of the files I hover opens up in its default application before I can reach the desired destination folder. This is extremely annoying as it prevents me from using the drag & drop feature. I understand this is supposed to work like this for directories (if I hover a directory for too long, it opens: that's the desired behavior), but the fact that it happens with files too seems very new (I've been using dolphin on 3 computers for 7 years, and only noticed this behavior in the past 5-6 months).
Most of the times, it happens as I select files from the bottom of the list and try to drag them to the top folders in the list (which requires some scrolling up). Usually I would drag my selection to the top of the detail-view, which would auto scroll after a few milliseconds. Now it opens up the file I'm hovering as it starts to auto-scroll.


STEPS TO REPRODUCE
1. Select a file (A) and drag it across other files.
2. Hover a little too long (a second or two) over another file (B).
3. Watch the file you were hovering (B) opening in it's default application.

OBSERVED RESULT
Files being hovered during the drag and drop operation are opened in their default application.

EXPECTED RESULT
Only folders should have this behavior. Hovering files should not trigger any action related to that file.


SOFTWARE/OS VERSIONS
Linux: Linux kernel 6.1.71-1-MANJARO (64-bit)
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.113.0
Qt Version: 5.15.12

ADDITIONAL INFORMATION
- Plasma is configured to open files on double-click (one click selects them)
- I've tried switching the dolphin setting "View Modes  > Details > Open files and folders", but neither option fixes the problem (although it is a bit easier to avoid it when "By clicking on icon or name" is selected).
- I've tried disabling previews for files in dolphin but that didn't fix the problem
Comment 1 sasori.nami 2024-01-17 20:26:43 UTC
Also to note: if I disable "Dolphin settings > Navigation > Open folders during drag operations", the bug is fixed, but I also lose the ability to open directories as I hover them. Maybe a check on the mime-type is missing in the code that offers this feature...
Comment 2 sasori.nami 2024-01-17 21:51:08 UTC
After some perusing of the codebase, I think this might be a regression due to https://github.com/KDE/dolphin/commit/9967a5cdee3ca7027871a6b2b640e94435d6b7af#diff-46d537eafe5dbb0ecc4080dd9ee5eefbb7442d29997063b37d91f12817dfe933L537
Bear in mind, I'm just an enthusiast Python/Qt dev (via PySide). I can barely read C++. I might be completely wrong.
Comment 3 Akseli Lahtinen 2024-02-02 09:47:11 UTC
Can reproduce on Plasma 6 as well.

Operating System: Fedora Linux 39
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.0
Kernel Version: 6.6.13-200.fc39.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600
Comment 4 Bug Janitor Service 2024-02-02 10:31:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/711
Comment 5 Akseli Lahtinen 2024-03-08 11:37:24 UTC
Git commit 803bbd1ae191a89ffdb3889acb6621431525f96d by Akseli Lahtinen.
Committed on 08/03/2024 at 11:37.
Pushed by akselmo into branch 'master'.

Start autoActivationTimer only if hovering over a directory

Before starting autoActivationTimer, check that we're hovering the item on top of a directory.
If we don't check for it, the the autoActivationTimer will try to open the hovered item 
in it's default application, which can be distracting and break the actual action
the user was trying to do, like moving the file to a directory. 

M  +11   -0    src/kitemviews/kfileitemmodel.cpp
M  +2    -0    src/kitemviews/kfileitemmodel.h
M  +2    -1    src/kitemviews/kitemlistcontroller.cpp
M  +6    -0    src/kitemviews/kitemmodelbase.cpp
M  +9    -0    src/kitemviews/kitemmodelbase.h

https://invent.kde.org/system/dolphin/-/commit/803bbd1ae191a89ffdb3889acb6621431525f96d
Comment 6 sasori.nami 2024-03-08 15:47:49 UTC
Thank you :)