From 60cba23bc0f5e8eafecc03c437f1133b62569fa6 Mon Sep 17 00:00:00 2001 From: Muhammet Kara Date: Sat, 22 May 2021 22:51:36 +0300 Subject: tdf#116491: Customize: Hide experimental commands when not in experimental mode Change-Id: Ibc88e9c90b261b5294fab8041e0b530016f45f33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116006 Tested-by: Jenkins Reviewed-by: Muhammet Kara --- cui/source/customize/CommandCategoryListBox.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx index 5b8903f3d199..7823607114e8 100644 --- a/cui/source/customize/CommandCategoryListBox.cxx +++ b/cui/source/customize/CommandCategoryListBox.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -222,6 +223,7 @@ void CommandCategoryListBox::FillFunctionsList( // Setup search filter parameters m_searchOptions.searchString = filterTerm; utl::TextSearch textSearch(m_searchOptions); + const bool bInExperimentalMode = officecfg::Office::Common::Misc::ExperimentalMode::get(); for (const auto& rInfo : xCommands) { @@ -234,11 +236,17 @@ void CommandCategoryListBox::FillFunctionsList( = vcl::CommandInfoProvider::GetTooltipForCommand(rInfo.Command, aProperties, m_xFrame); OUString sPopupLabel = (vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties)) .replaceFirst("~", ""); + bool bIsExperimental + = vcl::CommandInfoProvider::IsExperimental(rInfo.Command, m_sModuleLongName); + + // Hide experimental commands when not in experimental mode + bool bHideExperimental = bIsExperimental && !bInExperimentalMode; // Apply the search filter - if (!filterTerm.isEmpty() && !textSearch.searchForward(sUIName) - && !textSearch.searchForward(sLabel) && !textSearch.searchForward(sTooltipLabel) - && !textSearch.searchForward(sPopupLabel)) + if (bHideExperimental + || (!filterTerm.isEmpty() && !textSearch.searchForward(sUIName) + && !textSearch.searchForward(sLabel) && !textSearch.searchForward(sTooltipLabel) + && !textSearch.searchForward(sPopupLabel))) { continue; } -- cgit