Skip to content

Split ToggleActionMenu to ToggleActionMenu and QuickSelectAction

David Hurka requested to merge davidhurka/okular:split-toggleactionmenu into master

This separates ToggleActionMenu in two classes with different purposes:

  1. ToggleActionMenu contains the code that expands KActionMenu by setDefaultAction()
  2. QuickSelectAction implements the former ImplicitDefaultAction mode, i. e. it listens to QMenu::triggered() to update the default action automatically.

QuickSelectAction now has dontUseAsDefaultAction(), which allows to add actions which make no sense as default action.

QuickSelectAction exposes initializeDefaultAction(whenToInitialize), which allows to search a default action at startup (when the toolbar is shown), as well as during runtime (when the current default action has to be removed). removeAction(QAction*, reinitialize?) can also reinitialize the default action automatically, so the default action is never an action not present in the menu.

setDefaultAction() still works as defined by ToggleActionMenu, and is overridden when initializeDefaultAction() is executed the next time.

updateButtons() looses some intelligence, and just sets the default action now, not differentiating between properties.

Popup modes are no longer restricted. Instead, frameworks/kwidgetsaddons!24 (merged) shall simplify KActionMenu API in this point.

Additionally, there are new autotests for both classes.

Edited by David Hurka

Merge request reports