Properly check Shift toggling in DolphinRemoveAction
Review Request #128972 - Created Sept. 21, 2016 and submitted
The current state is updated sychronously as the event queue is emptied of events that will spontaneously change the keyboard state (QEvent::KeyPress and QEvent::KeyRelease events).
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.
Another solution could be adding a
bool isShiftPressedargument to DolphinRemoveAction::update() and setting it to true in keyPressEvent() and false in keyReleaseEvent(). The problem is that update() is called also in other places, so it would become quite ugly...
Toggling Shift when the context menu is open now works as expected.