Skip to content

KFilePlacesView: Improve keyboard context menu triggering

  1. This commit makes it so when a context menu is invoked by keyboard the context menu will be opened for the index with keyboard focus instead of opening the context menu at the position of the event. This is preferable because identifying the correct position requires more knowledge about the internals of the view, can therefore not be easily determined from the outside, and is furthermore more prone to positioning errors. This fixes that the wrong context menu would appear when invoking it through https://commits.kde.org/kxmlgui/feb5d78b8a81a52caaa177c94adc047d80299dd2.
  2. There was no way to open e.g. "Show All Entries" by keyboard alone because the context menu would always open for an index even when no index was selected. This is fixed by opening a context menu for the view background when no item is selected e.g. after unselecting using Ctrl+Space.
  3. Prior to this commit, the current index would always reset when a context menu was closed. This is however bothersome, unexpected, and confusing when working with the places panel using a keyboard. This commit skips the resetting of the current index if the context menu was opened by keyboard.

With all that done, all the functionality of the places view can now be used nicely while only using a keyboard.

Merge request reports