Skip to content

Have actions bound to Space not interfere with basic functionality

Prior to this commit, assigning the Space key as a keyboard shortcut to an action would lead to problems because keyboard shortcuts have global priority and would therefore consume any Space key press. In effect, this caused more local functionality (like pressing Space to activate a Button that has keyboard-focus) to not work. It also meant that we had to basically hard-code selection mode to the Space key to preserve other features.

This commit fixes this by having actions bound to the Space key only trigger when a DolphinView has keyboard-focus and the Space key press isn't typed as part of the type-ahead functionality there. This allows users to un- or rebind the Space key from any action without disabling other uses of the Space key as a side-effect.

When a user has un-bound all actions from Space, the Space key will fall back to its old behaviour in DolphinView prior to the introduction of the selection mode feature, which is selecting the current item.

This is implemented as follows:

  • Disable the keyboard shortcuts for a QAction bound to the Space key both on application startup and when the keyboard shortcuts are changed.
  • Have the DolphinView emit a signal when there is an unhandled or unnecessary Space key press while that DolphinView has focus.
  • Connect to that signal in DolphinMainWindow and trigger the action manually that was bound to the Space key. If no such action exists, order the DolphinView to select the current item, because that was the default behaviour prior to the introduction of the selection mode feature.

Since all keyboard shortcuts for the action bound to the Space key are disabled, this commit has the downside that any secondary shortcut assigned to that action will not function at all. The user is notified of this quirk when such an invalid configuration is detected.

BUG: 465489

Merge request reports