[Libreoffice-commits] core.git: officecfg/registry vcl/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Wed Jul 13 14:29:12 UTC 2016


 officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs |    2 +-
 vcl/source/helper/commandinfoprovider.cxx                       |   10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 80f9ad9011843dbc9d166147402366438bcfe29a
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed Jul 13 15:52:26 2016 +0200

    Make TooltipLabel default to PopupLabel
    
    Because we often have similiar tooltip and menu names.
    
    Change-Id: I0ab66269b0b1f2985f23cf92289b3da69b6ddfd3
    Reviewed-on: https://gerrit.libreoffice.org/27186
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs
index 54714b6..678bea7 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI/Commands.xcs
@@ -43,7 +43,7 @@
       </prop>
       <prop oor:name="TooltipLabel" oor:type="xs:string" oor:localized="true">
         <info>
-          <desc>Used for Tooltips (Toolbar and Glade Widgets that have their 'action_name' specified.)</desc>
+          <desc>Used for Tooltips (Toolbar and Glade Widgets that have their 'action_name' specified.). Defaults to PopupLabel, then Label if empty.</desc>
         </info>
       </prop>
       <prop oor:name="TargetURL" oor:type="xs:string" oor:localized="false">
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index 7a03c80..00fa0c8 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -18,6 +18,8 @@
  */
 
 #include <vcl/commandinfoprovider.hxx>
+#include <vcl/mnemonic.hxx>
+#include <comphelper/string.hxx>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/compbase.hxx>
 #include <cppuhelper/basemutex.hxx>
@@ -163,8 +165,12 @@ OUString CommandInfoProvider::GetTooltipForCommand (
     SetFrame(rxFrame);
 
     OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName));
-    if (sLabel.isEmpty())
-        sLabel = GetCommandProperty("Name", rsCommandName);
+    if (sLabel.isEmpty()) {
+        sLabel = GetPopupLabelForCommand(rsCommandName, rxFrame);
+        // Remove '...' at the end and mnemonics (we don't want those in tooltips)
+        sLabel = comphelper::string::stripEnd(sLabel, '.');
+        sLabel = MnemonicGenerator::EraseAllMnemonicChars(sLabel);
+    }
 
     // Command can be just an alias to another command,
     // so need to get the shortcut of the "real" command.


More information about the Libreoffice-commits mailing list