diff options
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/customize/SvxNotebookbarConfigPage.cxx | 22 | ||||
-rw-r--r-- | cui/source/customize/cfg.cxx | 16 | ||||
-rw-r--r-- | cui/source/inc/SvxNotebookbarConfigPage.hxx | 1 | ||||
-rw-r--r-- | cui/source/inc/cfg.hxx | 1 | ||||
-rw-r--r-- | cui/uiconfig/ui/menuassignpage.ui | 2 |
5 files changed, 39 insertions, 3 deletions
diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx index 99c15b8f3ca9..91ce6352ddca 100644 --- a/cui/source/customize/SvxNotebookbarConfigPage.cxx +++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx @@ -240,7 +240,7 @@ void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(std::u16string_view sClassId if (xImage.is()) rTreeView.set_image(rIter, xImage, -1); rTreeView.set_text(rIter, aName, 0); - rTreeView.set_id(rIter, sUIItemId); + rTreeView.set_id(rIter, sUIItemCommand); } } @@ -438,8 +438,6 @@ void SvxNotebookbarConfigPage::SelectElement() weld::TreeView& rTreeView = m_xContentsListBox->get_widget(); rTreeView.bulk_insert_for_each( aEntries.size(), [this, &rTreeView, &aEntries](weld::TreeIter& rIter, int nIdx) { - OUString sId(OUString::number(nIdx)); - rTreeView.set_id(rIter, sId); if (aEntries[nIdx].sActionName != "Null") { if (aEntries[nIdx].sVisibleValue == "True") @@ -467,6 +465,9 @@ SvxNotebookbarEntriesListBox::SvxNotebookbarEntriesListBox(std::unique_ptr<weld: m_xControl->connect_toggled(LINK(this, SvxNotebookbarEntriesListBox, CheckButtonHdl)); m_xControl->connect_key_press(Link<const KeyEvent&, bool>()); m_xControl->connect_key_press(LINK(this, SvxNotebookbarEntriesListBox, KeyInputHdl)); + // remove the inherited connect_query_tooltip then add the new one + m_xControl->connect_query_tooltip(Link<const weld::TreeIter&, OUString>()); + m_xControl->connect_query_tooltip(LINK(this, SvxNotebookbarEntriesListBox, QueryTooltip)); } SvxNotebookbarEntriesListBox::~SvxNotebookbarEntriesListBox() {} @@ -540,4 +541,19 @@ IMPL_LINK(SvxNotebookbarEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, return SvxMenuEntriesListBox::KeyInputHdl(rKeyEvent); } +IMPL_LINK(SvxNotebookbarEntriesListBox, QueryTooltip, const weld::TreeIter&, rIter, OUString) +{ + OUString sCommand = m_xControl->get_id(rIter); + if (sCommand.isEmpty()) + return OUString(); + OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(m_pPage->GetFrame())); + auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommand, aModuleName); + OUString sTooltipLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sCommand, aProperties, + m_pPage->GetFrame()); + return CuiResId(RID_CUISTR_COMMANDLABEL) + ": " + + m_xControl->get_text(rIter).replaceFirst("~", "") + "\n" + + CuiResId(RID_CUISTR_COMMANDNAME) + ": " + sCommand + "\n" + + CuiResId(RID_CUISTR_COMMANDTIP) + ": " + sTooltipLabel.replaceFirst("~", ""); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index eefa264ba3bd..f5ed658512e9 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -937,6 +937,7 @@ SvxMenuEntriesListBox::SvxMenuEntriesListBox(std::unique_ptr<weld::TreeView> xCo m_xControl->enable_toggle_buttons(weld::ColumnToggleType::Check); CreateDropDown(); m_xControl->connect_key_press(LINK(this, SvxMenuEntriesListBox, KeyInputHdl)); + m_xControl->connect_query_tooltip(LINK(this, SvxMenuEntriesListBox, QueryTooltip)); } SvxMenuEntriesListBox::~SvxMenuEntriesListBox() @@ -968,6 +969,21 @@ IMPL_LINK(SvxMenuEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, bool) return true; } +IMPL_LINK(SvxMenuEntriesListBox, QueryTooltip, const weld::TreeIter&, rIter, OUString) +{ + SvxConfigEntry *pEntry = weld::fromId<SvxConfigEntry*>(m_xControl->get_id(rIter)); + if (!pEntry || pEntry->GetCommand().isEmpty()) + return OUString(); + const OUString sCommand(pEntry->GetCommand()); + OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(m_pPage->GetFrame())); + auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommand, aModuleName); + OUString sTooltipLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sCommand, aProperties, + m_pPage->GetFrame()); + return CuiResId(RID_CUISTR_COMMANDLABEL) + ": " + pEntry->GetName().replaceFirst("~", "") + "\n" + + CuiResId(RID_CUISTR_COMMANDNAME) + ": " + sCommand + "\n" + + CuiResId(RID_CUISTR_COMMANDTIP) + ": " + sTooltipLabel.replaceFirst("~", ""); +} + /****************************************************************************** * * SvxConfigPage is the abstract base class on which the Menu and Toolbar diff --git a/cui/source/inc/SvxNotebookbarConfigPage.hxx b/cui/source/inc/SvxNotebookbarConfigPage.hxx index 7e417463ab30..2f239161dfb6 100644 --- a/cui/source/inc/SvxNotebookbarConfigPage.hxx +++ b/cui/source/inc/SvxNotebookbarConfigPage.hxx @@ -77,6 +77,7 @@ class SvxNotebookbarEntriesListBox final : public SvxMenuEntriesListBox void ChangedVisibility(int nRow); DECL_LINK(CheckButtonHdl, const weld::TreeView::iter_col&, void); DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(QueryTooltip, const weld::TreeIter& rIter, OUString); public: SvxNotebookbarEntriesListBox(std::unique_ptr<weld::TreeView> xControl, SvxConfigPage* pPg); diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index 12dbae01751e..bde738e17c82 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -348,6 +348,7 @@ public: } DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(QueryTooltip, const weld::TreeIter& rIter, OUString); void CreateDropDown(); }; diff --git a/cui/uiconfig/ui/menuassignpage.ui b/cui/uiconfig/ui/menuassignpage.ui index 64c9efc4d756..2f554d4b91e3 100644 --- a/cui/uiconfig/ui/menuassignpage.ui +++ b/cui/uiconfig/ui/menuassignpage.ui @@ -563,6 +563,7 @@ <object class="GtkTreeView" id="toolcontents"> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="has_tooltip">True</property> <property name="no_show_all">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> @@ -619,6 +620,7 @@ <object class="GtkTreeView" id="menucontents"> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="has_tooltip">True</property> <property name="no_show_all">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> |