summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2022-05-18 22:22:06 -0800
committerJim Raykowski <raykowj@gmail.com>2022-05-22 03:13:20 +0200
commitbb1d48498c9fdedf8e78344765f6c6eda6f4707c (patch)
tree7018ce5dea6bac3740542f18d951586f58d48e05 /sfx2
parentb6266207b55a7633dc82b02142215757512adfb7 (diff)
tdf#84502 related: Show keyboard shortcut in sidebar tab bar tab button
tooltip Change-Id: Ia0d48ac437c6a18c4e1624dd9b154ee7a8514f1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134594 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/TabBar.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index d874a3191300..59649ec152d3 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -28,6 +28,7 @@
#include <comphelper/processfactory.hxx>
#include <o3tl/safeint.hxx>
#include <vcl/commandevent.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
#include <svtools/acceleratorexecute.hxx>
@@ -226,7 +227,11 @@ void TabBar::CreateTabItem(weld::Toolbar& rItem, const DeckDescriptor& rDeckDesc
rItem.set_accessible_name(rDeckDescriptor.msTitle);
rItem.set_accessible_description(rDeckDescriptor.msHelpText);
rItem.set_tooltip_text(rDeckDescriptor.msHelpText);
- rItem.set_item_tooltip_text("toggle", rDeckDescriptor.msHelpText);
+ const OUString sCommand = ".uno:SidebarDeck." + rDeckDescriptor.msId;
+ OUString sShortcut = vcl::CommandInfoProvider::GetCommandShortcut(sCommand, mxFrame);
+ if (!sShortcut.isEmpty())
+ sShortcut = u" (" + sShortcut + u")";
+ rItem.set_item_tooltip_text("toggle", rDeckDescriptor.msHelpText + sShortcut);
}
css::uno::Reference<css::graphic::XGraphic> TabBar::GetItemImage(const DeckDescriptor& rDeckDescriptor) const