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

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Sat May 22 22:19:19 UTC 2021


 cui/source/customize/CommandCategoryListBox.cxx |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 60cba23bc0f5e8eafecc03c437f1133b62569fa6
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Sat May 22 22:51:36 2021 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sun May 23 00:18:41 2021 +0200

    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 <muhammet.kara at collabora.com>

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 <comphelper/sequenceashashmap.hxx>
 #include <comphelper/SetFlagContextHelper.hxx>
 #include <comphelper/string.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <i18nlangtag/languagetag.hxx>
 #include <i18nutil/searchopt.hxx>
 #include <sal/log.hxx>
@@ -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;
         }


More information about the Libreoffice-commits mailing list