summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2023-07-24 23:05:50 +0200
committerRafael Lima <rafael.palma.lima@gmail.com>2023-07-26 13:25:10 +0200
commit6fa4e5965b2a79ae6735f4191a2261713a42356e (patch)
tree225f6909bf441c1b28eae49fdd7840663774e0f1 /vcl/source
parent7dc697addd0895b8aee0c051c0d4d4125414f012 (diff)
tdf#149318 Set HID for menus that have sub menus
This patch fixes the following issue when pressing F1 while hovering on a menu entry that has submenus: 1) Place the mouse over a menu entry that has submenus (f.i. in Draw go to Format - Table) 2) A submenu will appear, however leave the mouse over "Table" 3) Press F1... the help ID used will be "slot:0" because LO is trying to find the help ID of the selected entry in the submenu, but since none is selected, then the generic "slot:0" value is used. To fix this problem, this patch assigns a Help ID for the submenu (not for its entries) so that when no entry is focused, then the submenu HID is used. IMPORTANT: note that pressing F1 on menus only work with gen and win. Due to bug 156376 pressing F1 on menus does not work with kf5 and gtk3 (yet). Change-Id: I717e7669faac47a12c929129c0de98dee7f44439 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154862 Tested-by: Jenkins Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/window/menuwindow.cxx19
1 files changed, 13 insertions, 6 deletions
diff --git a/vcl/source/window/menuwindow.cxx b/vcl/source/window/menuwindow.cxx
index 36ed07f0730d..802c62e285f8 100644
--- a/vcl/source/window/menuwindow.cxx
+++ b/vcl/source/window/menuwindow.cxx
@@ -91,17 +91,24 @@ bool MenuWindow::ImplHandleHelpEvent(vcl::Window* pMenuWindow, Menu const * pMen
Help* pHelp = Application::GetHelp();
if ( pHelp )
{
- // is an id available, then call help with the id, otherwise
- // use help-index
+ // Check if there is a Help ID available, or else use
+ // the command URL
OUString aCommand = pMenu->GetItemCommand( nId );
- OUString aHelpId( pMenu->GetHelpId( nId ) );
+ OUString aHelpId;
+
+ // If no entry is selected, use the general menu Help ID
+ if (nId <= 0)
+ aHelpId = pMenu->GetHelpId();
+ else
+ aHelpId = pMenu->GetHelpId(nId);
+
if( aHelpId.isEmpty() )
aHelpId = OOO_HELP_INDEX;
- if ( !aCommand.isEmpty() )
- pHelp->Start(aCommand);
- else
+ if ( !aHelpId.isEmpty() )
pHelp->Start(aHelpId);
+ else
+ pHelp->Start(aCommand);
}
bDone = true;
}