Bug 388259

Summary: Drag and drop across dolphin instances: cursor must be moved after modifier key is pressed for modifier key to take effect
Product: [Frameworks and Libraries] frameworks-kio Reporter: suse
Component: generalAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal CC: akontsevich, bugseforuns, elvis.angelaccio, gstengel, hakan, jonbien, kdelibs-bugs, nate, notuxius
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=404071
Latest Commit: Version Fixed In: 20.04.0 with Qt 5.15
Sentry Crash Report:

Description suse 2017-12-26 22:09:24 UTC
Moving files via drag and drop works works mostly fine when holding the SHIFT key. (Without SHIFT it's a copy operation instead.)

However, I figured out a case where it is not working.
1. Drag a files and move the mouse cursor to the destination.
2. Press the SHIFT key.
3. Release the mouse button without any(!) movement since pressing the SHIFT key.

Following these steps will perform a copy instead of a file movement.

Workaround:
Move the mouse at least one pixel after pressing the SHIFT key. Then the expected file-move-operation will perform.
Comment 1 Nate Graham 2017-12-27 01:16:30 UTC
Confirmed on both X11 and Wayland with Dolphin 17.12.x, 17.08.x, and 17.04.x.
Comment 2 Nate Graham 2018-03-29 19:24:29 UTC
*** Bug 391548 has been marked as a duplicate of this bug. ***
Comment 3 Alexander Mentyu 2018-06-07 15:05:49 UTC
Copying if applied by default if cursor wasn't moved undex Xorg

Under Wayland there is a denied type coursor and context menu
Related - https://bugs.kde.org/show_bug.cgi?id=383794

Plasma: 5.12.5
Apps: 18.04.1
Frameworks: 5.46.0
Qt: 5.11.0
Kernel: 4.17.0-1-MANJARO
OS: Netrunner Rolling
Video: Intel 4400
Driver: xf86-video-intel 1:2.99.917+831+ge7bfc906-1
Mesa 3D: 18.1.1
Screen: 1600x900
Xorg-Server: 1.20
wayland-protocols 1.13-1
wayland 1.14.0-1
Comment 4 Nate Graham 2019-02-08 17:56:18 UTC
This menu comes from KIO; moving it there.
Comment 5 Nate Graham 2019-02-08 17:56:31 UTC
*** Bug 404071 has been marked as a duplicate of this bug. ***
Comment 6 Elvis Angelaccio 2019-02-10 16:07:21 UTC
(In reply to suse from comment #0)
> Moving files via drag and drop works works mostly fine when holding the
> SHIFT key. (Without SHIFT it's a copy operation instead.)
> 
> However, I figured out a case where it is not working.
> 1. Drag a files and move the mouse cursor to the destination.
> 2. Press the SHIFT key.
> 3. Release the mouse button without any(!) movement since pressing the SHIFT
> key.

Hmm, seems to work for me.
Comment 7 suse 2019-02-10 23:01:36 UTC
(In reply to Elvis Angelaccio from comment #6)
> Hmm, seems to work for me.

Re-tested with Dolphin 18.12.1 (plasma 5.14.5; Framewor 5.54.0: Qt 5.12.0)
and I'm still able to reproduce.

I'm using two instances of dolphin and do a drag an drop between those two.
Comment 8 Elvis Angelaccio 2019-02-16 11:11:19 UTC
(In reply to suse from comment #7)
> (In reply to Elvis Angelaccio from comment #6)
> I'm using two instances of dolphin and do a drag an drop between those two.

Ah, that's the key. I was able to reproduce using two different dolphin processes.
Comment 9 Elvis Angelaccio 2019-02-17 12:26:02 UTC
It seems this is a bug in Qt. For some reason the QDropEvent sets Qt::CopyAction rather than Qt::MoveAction as the drop action, when using two different processes.
Comment 10 Elvis Angelaccio 2019-02-17 12:33:50 UTC
(In reply to Elvis Angelaccio from comment #9)
> It seems this is a bug in Qt

or maybe in the platform integration plugin.
Comment 11 Elvis Angelaccio 2019-04-11 17:37:02 UTC
*** Bug 406364 has been marked as a duplicate of this bug. ***
Comment 12 Nate Graham 2020-01-16 20:48:23 UTC
*** Bug 416357 has been marked as a duplicate of this bug. ***
Comment 13 Aleksey Kontsevich 2020-01-16 21:49:54 UTC
Any chance this will be fixed? Annoying - years passed with this bug while it is a standard file manager operation and strange it appears at all and exists for years.
Comment 14 Elvis Angelaccio 2020-03-15 18:13:22 UTC
(In reply to Elvis Angelaccio from comment #9)
> It seems this is a bug in Qt. For some reason the QDropEvent sets
> Qt::CopyAction rather than Qt::MoveAction as the drop action, when using two
> different processes.

I can't reproduce the bug anymore using Qt 5.15. I'm going to assume this has been fixed in recent versions of Qt or the platform integration plugin.

If anyone can still reproduce it, what's your Qt and Plasma version?
Comment 15 Aleksey Kontsevich 2020-03-15 21:40:36 UTC
> I can't reproduce the bug anymore using Qt 5.15. I'm going to assume this
> has been fixed in recent versions of Qt or the platform integration plugin.
> 
> If anyone can still reproduce it, what's your Qt and Plasma version?

openSUSE currently has 5.14.1 version, Whil check when 5.15 be available.
Comment 16 Patrick Silva 2020-03-15 22:21:21 UTC
I'm using Qt 5.15 beta on Arch Linux.
On Wayland all modifiers work as expected.
On X11 only shift works as expected. If I press crtrl+shift or ctrl then release the mouse button without any cursor movement, the dragged file is copied to destination.
Comment 17 Patrick Silva 2020-03-15 22:27:29 UTC
(In reply to Patrick Silva from comment #16)
> On X11 only shift works as expected. If I press crtrl+shift or ctrl then
> release the mouse button without any cursor movement, the dragged file is
> copied to destination.

ope, I meant only ctrl (copy) modifier works as expected on X11.
Shift (move) and ctrl+shift (link) copy the file to destination.
Comment 18 Aleksey Kontsevich 2020-03-16 02:24:11 UTC
> Shift (move) and ctrl+shift (link) copy the file to destination.

Exactly!
Comment 19 Patrick Silva 2020-03-16 18:30:06 UTC
(In reply to Patrick Silva from comment #16)
> I'm using Qt 5.15 beta on Arch Linux.
> On Wayland all modifiers work as expected.

Well, this is weird, but all modifiers stopped working as expected on Wayland after reboot/relogin. lol
Now ctrl and shift keys open the context menu and ctrl+shift copies the dragged file to destination.
Comment 20 Nate Graham 2020-03-25 15:37:12 UTC
This is partially fixed with Qt 5.15, and the remaining bits are fixed with https://phabricator.kde.org/D28017
Comment 21 Aleksey Kontsevich 2020-03-25 15:53:19 UTC
(In reply to Nate Graham from comment #20)
> https://phabricator.kde.org/D28017

Were fixing this for 7 years????!!!! Just "Great"!
Comment 22 Aleksey Kontsevich 2020-03-25 15:53:36 UTC
Thanks for the fix BTW! :)
Comment 23 Patrick Silva 2020-03-26 15:03:17 UTC
Fixed on X11. :)
But it's still broken on Wayland. :(

dolphin 20.03.80 built from sources
Operating System: Arch Linux 
KDE Plasma Version: 5.18.3
KDE Frameworks Version: 5.68.0
Qt Version: 5.15.0 beta2