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

New commits:
commit 639a610b9e04c4374d168185099ae5baa7454f6f
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Tue Mar 15 10:09:43 2022 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Thu Mar 17 14:47:25 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/+/131580
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Mert Tumer <mert.tu...@collabora.com>

diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx
index 6d456d469f21..64ce33400839 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
 {
@@ -62,6 +64,19 @@ bool isBuilderEnabled(const OUString& 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