<table><tr><td style="">davidhurka retitled this revision from "[DEMO] Enhance ToggleActionMenu with ImplicitDefaultAction mode." to "Replace ToolAction by ToggleActionMenu".<br />davidhurka edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-h3hi6pdzg2exn2k/">(Show Details)</a><br />davidhurka edited the test plan for this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-husm6p4tcxjpehj/">(Show Details)</a>
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D21971">View Revision</a></tr></table><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">(This is not a merge request.)</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">This replaces ToolAction by a near-drop-in replacement named ToggleActionMenu. The new annotation toolbar already uses this (D15580).</span><br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">This allows to use ToggleActionMenu as nearly drop-in replacement for ToolAction,</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Unlike ToolAction, ToggleActionMenu inherits from KActionMenu to be more flexible.<br />
* Menu can be set from outside, not hard coded.<br />
* Default action for toolbar button is controllable from outside. (Theoretically, the button could trigger //anything// now.)</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">without addi</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">* KAc</span>tion<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">al code statements.<br />
<br />
ImplicitDefaul</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Menu instead of KSelec</span>tAction<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> mode means that the default action of the toolbar buttons</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">: <br />
  - Pluggable in other menus, thus called “Menu”.</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">is determined by the last triggered action,</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">  - Doesn’t make the actions exclusive, so //any// actions can be added to the menu.</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">* ImplicitDefaultAction mode can choose the default action of the toolbar buttons automatically, by looking f</span>or the first checked action in the menu.<br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">This patch is</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Toolbar buttons use the default action //of// this menu,</span> not <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">fully tested</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">this menu itself as action</span>.<br />
<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">@simgunz asked about a functionality somewhere near this in D21755#482896</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">Because the default action is configurable now, D21622 and D21635 (where we tried to fine-tune ToolAction) become obsolete. <br />
<br />
Screenshot:<br />
Everything like before, here with mouse_selecttool added to Tools menu to show submenu capability.<br />
{F6884228}<br />
<br />
</span></div></div></div><br /><div><strong>CHANGES TO TEST PLAN</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">ToolAction replacement and ImplicitDefaultAction mode:<br />
 * Open Okular and look at toolbar button -> has correct tool selected.<br />
 * Open a document.<br />
 * Look at toolbar button menu -> Correct menu entries (like before, with ToolAction).<br />
 * Select some selection tools through shortcuts and toolbar button -> behaves correctly.<br />
Usage as submenu:<br />
 * Add ToggleActionMenu ("mouse_selecttool") to menubar (..../kxmlgui5/okular/part.rc) -> Submenu looks correctly, has no checkbox attached and so on...<br />
Toolbar buttons:<br />
 * Add diverse other actions to the menu -> still works as before.<br />
 * Add actions when toolbar buttons are already created -> actions are added to existing buttons.<br />
 * setDefaultAction() to some completely unrelated action. -> ToggleActionMenu does not get confused.<br />
</span></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R223 Okular</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D21971">https://phabricator.kde.org/D21971</a></div></div><br /><div><strong>To: </strong>davidhurka<br /><strong>Cc: </strong>ngraham, simgunz, okular-devel, johnzh, andisa, siddharthmanthan, maguirre, fbampaloukas, joaonetto, kezik, tfella, darcyshen, aacid<br /></div>