vcl/jsdialog/enabled.cxx |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit feb8e7c58dc72d01febc914fd6575757f3f7e746
Author:     Szymon Kłos <[email protected]>
AuthorDate: Tue Mar 15 10:09:43 2022 +0100
Commit:     Szymon Kłos <[email protected]>
CommitDate: Thu Mar 17 20:08:08 2022 +0100

    jsdialog: enable dialog on demand by env var
    
    It will be possible to enable some dialogs by environment variable:
    
    
SAL_JSDIALOG_ENABLE=modules/scalc/ui/validationdialog.ui:modules/scalc/ui/validationcriteriapage.ui
    
    (you can specify multiple items with ':' separator)
    
    Change-Id: Iba1e6b7ac77716f40c9073a8064206c420f2d081
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131597
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <[email protected]>

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 31b18a3ae347..100741447b6e 100644
--- a/vcl/jsdialog/enabled.cxx
+++ b/vcl/jsdialog/enabled.cxx
@@ -7,7 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <comphelper/string.hxx>
 #include <jsdialog/enabled.hxx>
+#include <vector>
 
 namespace jsdialog
 {
@@ -60,6 +62,19 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool 
bMobile)
         return true;
     }
 
+    const char* pEnabledDialog = getenv("SAL_JSDIALOG_ENABLE");
+    if (pEnabledDialog)
+    {
+        OUString sAllEnabledDialogs(pEnabledDialog, strlen(pEnabledDialog), 
RTL_TEXTENCODING_UTF8);
+        std::vector<OUString> aEnabledDialogsVector
+            = comphelper::string::split(sAllEnabledDialogs, ':');
+        for (const auto& rDialog : aEnabledDialogsVector)
+        {
+            if (rUIFile == rDialog)
+                return true;
+        }
+    }
+
     return false;
 }
 

Reply via email to