diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-09-14 02:02:38 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-09-13 23:06:38 +0000 |
commit | 74fd959945dbbfbc3dcc331a08ff8fc7c6410295 (patch) | |
tree | dbabc8792b2d774cb8d7d456bb3b2765a73484e4 /framework | |
parent | loplugin:override (diff) | |
download | core-74fd959945dbbfbc3dcc331a08ff8fc7c6410295.tar.gz core-74fd959945dbbfbc3dcc331a08ff8fc7c6410295.zip |
tdf#74377 Keyboard shortcuts for context menus
Configurable through the options dialog. The default behavior
depends on the current vclplug (hide for gtk2/3 and OS X, show
otherwise).
Menus currently affected by this change:
- SfxDispatcher based context menus
- chart2 context menus
- vcl's Edit control context menu
- Several MenuBarManager based toolbar dropdowns.
Change-Id: Iad9fb99dc90e01c17cba9c07c1a2b262b920e11d
Reviewed-on: https://gerrit.libreoffice.org/28849
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Tested-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 8e1f55917dc0..a7ed57273b88 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -746,6 +746,7 @@ IMPL_LINK_TYPED( MenuBarManager, Activate, Menu *, pMenu, bool ) bool bDontHide = SvtMenuOptions().IsEntryHidingEnabled(); const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); bool bShowMenuImages = rSettings.GetUseImagesInMenus(); + bool bShowShortcuts = m_bHasMenuBar || rSettings.GetContextMenuShortcuts(); bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED ); SolarMutexGuard g; @@ -794,18 +795,23 @@ IMPL_LINK_TYPED( MenuBarManager, Activate, Menu *, pMenu, bool ) } // Try to set accelerator keys - if ( m_bHasMenuBar ) { - RetrieveShortcuts( m_aMenuItemHandlerVector ); + if ( bShowShortcuts ) + RetrieveShortcuts( m_aMenuItemHandlerVector ); + std::vector< MenuItemHandler* >::iterator p; for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); ++p ) { MenuItemHandler* pMenuItemHandler = *p; - // Set key code, workaround for hard-coded shortcut F1 mapped to .uno:HelpIndex - // Only non-popup menu items can have a short-cut - if ( pMenuItemHandler->aMenuItemURL == aCmdHelpIndex ) + if ( !bShowShortcuts ) + { + pMenu->SetAccelKey( pMenuItemHandler->nItemId, vcl::KeyCode() ); + } + else if ( pMenuItemHandler->aMenuItemURL == aCmdHelpIndex ) { + // Set key code, workaround for hard-coded shortcut F1 mapped to .uno:HelpIndex + // Only non-popup menu items can have a short-cut vcl::KeyCode aKeyCode( KEY_F1 ); pMenu->SetAccelKey( pMenuItemHandler->nItemId, aKeyCode ); } |