[Libreoffice-commits] core.git: cui/inc cui/source cui/uiconfig

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 20 06:23:07 UTC 2019


 cui/inc/strings.hrc                             |    4 ++++
 cui/source/customize/CommandCategoryListBox.cxx |    1 +
 cui/source/customize/cfgutil.cxx                |   12 ++++++++++++
 cui/source/inc/cfgutil.hxx                      |    3 +++
 cui/uiconfig/ui/menuassignpage.ui               |    1 +
 5 files changed, 21 insertions(+)

New commits:
commit fdb5ce011cb043475869d0b607ea25b8f32b4314
Author:     Jim Raykowski <raykowj at gmail.com>
AuthorDate: Thu Dec 5 02:55:57 2019 -0900
Commit:     Heiko Tietze <heiko.tietze at documentfoundation.org>
CommitDate: Fri Dec 20 07:22:04 2019 +0100

    tdf#108458 Show tooltips in CuiConfigFunctionListBox
    
    Change-Id: I6644e939c644c827e2b3ad019b975a3845585063
    Reviewed-on: https://gerrit.libreoffice.org/84555
    Tested-by: Jenkins
    Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>

diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 1ade0c0d6b38..3169862f2e54 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -396,6 +396,10 @@
 
 #define RID_SVXSTR_EDIT_PATHS                       NC_("optpathspage|editpaths", "Edit Paths: %1")
 
+#define RID_SVXSTR_COMMANDLABEL                     NC_("RID_SVXSTR_COMMANDLABEL", "Label")
+#define RID_SVXSTR_COMMANDNAME                      NC_("RID_SVXSTR_COMMANDLABEL", "Command")
+#define RID_SVXSTR_COMMANDTIP                       NC_("RID_SVXSTR_COMMANDLABEL", "Tooltip")
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index 7576d0771edc..d9e3f57b1352 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -243,6 +243,7 @@ void CommandCategoryListBox::FillFunctionsList(
         SfxGroupInfo_Impl* pGrpInfo = m_aGroupInfo.back().get();
         pGrpInfo->sCommand = rInfo.Command;
         pGrpInfo->sLabel   = sUIName;
+        pGrpInfo->sTooltip = sTooltipLabel;
         pFunctionListBox->append(OUString::number(reinterpret_cast<sal_Int64>(m_aGroupInfo.back().get())), sUIName, xImage);
     }
 }
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index b464ff53f4e4..e52ed440d311 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -278,6 +278,7 @@ CuiConfigFunctionListBox::CuiConfigFunctionListBox(std::unique_ptr<weld::TreeVie
 {
     m_xTreeView->make_sorted();
     m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 35, m_xTreeView->get_height_rows(9));
+    m_xTreeView->connect_query_tooltip(LINK(this, CuiConfigFunctionListBox, QueryTooltip));
 }
 
 CuiConfigFunctionListBox::~CuiConfigFunctionListBox()
@@ -285,6 +286,17 @@ CuiConfigFunctionListBox::~CuiConfigFunctionListBox()
     ClearAll();
 }
 
+IMPL_LINK(CuiConfigFunctionListBox, QueryTooltip, const weld::TreeIter&, rIter, OUString)
+{
+    SfxGroupInfo_Impl *pData = reinterpret_cast<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter).toInt64());
+    if (!pData)
+        return OUString();
+    OUString aLabel = CuiResId(RID_SVXSTR_COMMANDLABEL) + ": ";
+    OUString aName = CuiResId(RID_SVXSTR_COMMANDNAME) + ": ";
+    OUString aTip = CuiResId(RID_SVXSTR_COMMANDTIP) + ": ";
+    return  aLabel + pData->sLabel + "\n" + aName + pData->sCommand+ "\n" + aTip + pData->sTooltip;
+}
+
 void CuiConfigFunctionListBox::ClearAll()
 /*  Description
     Deletes all entries in the FunctionListBox, all UserData and all
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index e930c24ac3ec..bfce0d6b13f4 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -92,6 +92,7 @@ struct SfxGroupInfo_Impl
     OUString    sCommand;
     OUString    sLabel;
     OUString    sHelpText;
+    OUString    sTooltip;
 
                 SfxGroupInfo_Impl( SfxCfgKind n, sal_uInt16 nr, void* pObj = nullptr ) :
                     nKind( n ), nUniqueID( nr ), pObject( pObj ) {}
@@ -175,6 +176,8 @@ public:
     OUString      GetHelpText( bool bConsiderParent = true );
     OUString      GetCurCommand() const;
     OUString      GetCurLabel() const;
+
+    DECL_LINK(QueryTooltip, const weld::TreeIter& rIter, OUString);
 };
 
 struct SvxConfigGroupBoxResource_Impl;
diff --git a/cui/uiconfig/ui/menuassignpage.ui b/cui/uiconfig/ui/menuassignpage.ui
index 7f37aad311b0..44d06931ebe4 100644
--- a/cui/uiconfig/ui/menuassignpage.ui
+++ b/cui/uiconfig/ui/menuassignpage.ui
@@ -322,6 +322,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
+                <property name="has_tooltip">True</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
                 <property name="model">liststore1</property>


More information about the Libreoffice-commits mailing list