Bug 354301 - Shift key toggles "delete" and "move to trash" entries the wrong order
Summary: Shift key toggles "delete" and "move to trash" entries the wrong order
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 16.12.2
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords: wayland
: 362235 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-24 13:03 UTC by g111
Modified: 2017-09-07 19:32 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 16.08.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description g111 2015-10-24 13:03:03 UTC
The toggle between the "move to trash" and "delete" entry in the right mouse context menu works in a wrong way.

Per default the entry is "move to trash" => this is ok.
When pressing shift nothing happens with the entry. It should change to "delete".
When releasing the shift key, the entry is toggled to "delete" and stays this way.
Holding shift again toggles back to "move to trash", but it should be "delete".
Releasing shift again toggles back to "delete", but it should be "move to trash".

=> So the shift key exactly behaves negated.

Reproducible: Always

Steps to Reproduce:
Open the context menu on a file by clicking the right mouse button. Press shift to toggle between the "move to trash" and "delete" entry.


Actual Results:  
1. open the context menu on a file by clicking the right mouse button.
2. Check that the menu entry reads "move to trash".
3. Hold down the shift key => The entry still is "move to trash".
4. Release the shift key => The entry changes to "delete".
5 Hold down the shift key again => The entry changes to "move to trash"
6. Release the shift key => The entry changes to "delete".
7. goto 5

Expected Results:  
1. open the context menu on a file by clicking the right mouse button.
2. The menu entry reads "move to trash".
3. Hold down the shift key => The entry changes to "delete".
4. Release the shift key => The entry changes to "move to trash".
5. goto 3
Comment 1 Wolfgang Bauer 2016-02-23 11:15:57 UTC
I can confirm this on openSUSE with the latest dolphin 15.12.2.

In short: pressing Shift doesn't toggle "Move to Trash" to "Delete", only *releasing* it again does.
Afterwards every press and release toggles, so the behavior is completely opposite to what it should be.
Comment 2 Carlos 2016-04-27 12:00:31 UTC
*** Bug 362235 has been marked as a duplicate of this bug. ***
Comment 3 Elvis Angelaccio 2016-09-21 09:40:57 UTC
I can reproduce, confirming.
Comment 4 Elvis Angelaccio 2016-09-21 10:48:27 UTC
Patch up for review: https://git.reviewboard.kde.org/r/128972/
Comment 5 Elvis Angelaccio 2016-09-21 16:25:06 UTC
Git commit 3775ef19eaca057985b92cfa3716d3c3a1d22f0f by Elvis Angelaccio.
Committed on 21/09/2016 at 16:13.
Pushed by elvisangelaccio into branch 'Applications/16.08'.

Properly check Shift toggling in DolphinRemoveAction

Documentation of QGuiApplication::keyboardModifiers() says that "It should
be noted this may not reflect the actual keys held on the input device at
the time of calling but rather the modifiers as last reported in one of
the above events".

Since this method is called in DolphinContextMenu's keyPressEvent()
and keyReleaseEvent(), the first time that keyboardModifiers() is
called it doesn't report that shift has been pressed.

Replacing this method with queryKeyboardModifiers() does the job
because the latter doesn't care about the event queue.
FIXED-IN: 16.08.2
REVIEW: 128972

M  +1    -1    src/dolphinremoveaction.cpp

http://commits.kde.org/dolphin/3775ef19eaca057985b92cfa3716d3c3a1d22f0f
Comment 6 Alexander Mentyu 2017-08-23 16:20:13 UTC
This bug reappeared for me in Wayland session.

Distribution: KDE neon Developer Edition Unstable Branches
KDE Plasma Version: 5.10.90
KDE Frameworks Version: 5.37.0
Qt Version: 5.9.1
Kernel Version: 4.10.0-32-generic
Comment 7 Elvis Angelaccio 2017-08-24 15:51:13 UTC
Yep, QGuiApplication::queryKeyboardModifiers() doesn't seem to work on Wayland.
Comment 8 Elvis Angelaccio 2017-09-07 19:32:32 UTC
Git commit 2fd85facf85b39f84eeada10bcf80060bb72ab51 by Elvis Angelaccio.
Committed on 07/09/2017 at 19:31.
Pushed by elvisangelaccio into branch 'master'.

Fix DolphinRemoveAction Shift toggling on Wayland

QGuiApplication::queryKeyboardModifiers() does not work on Wayland [1].
We don't need it in the first place, since we already know (thanks to
the key events) whether Shift has been pressed or released.
So we can just pass this information to DolphinRemoveAction::update().

[1]: https://bugreports.qt.io/browse/QTBUG-62786

Differential Revision: https://phabricator.kde.org/D7519

M  +2    -2    src/dolphincontextmenu.cpp
M  +2    -1    src/dolphinpart.cpp
M  +22   -7    src/dolphinremoveaction.cpp
M  +13   -3    src/dolphinremoveaction.h

https://commits.kde.org/dolphin/2fd85facf85b39f84eeada10bcf80060bb72ab51