cui/source/dialogs/tipofthedaydlg.cxx                      |   17 +++++++++++--
 framework/source/uielement/menubarmanager.cxx              |    6 ++++
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    6 ++++
 svx/source/dialog/crashreportdlg.cxx                       |    9 ++++++
 4 files changed, 35 insertions(+), 3 deletions(-)

New commits:
commit 93afc6258d67366d56bbd2f3358658ef390d6bfb
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Wed Apr 10 13:30:59 2024 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Fri Apr 12 00:54:03 2024 +0200

    New Expert Configuration setting to not offer Safe Mode in the UI
    
    /org.openoffice.Office/Common/Misc/OfferSafeMode (default: true), 
controlling:
    * "Help - Restart in Safe Mode..." menu entry
    * "Restart LibreOffice to enter safe mode" checkbox in the "Crash Report" 
dialog
    * "To start temporarily with a fresh user profile,..." tip of the day
    
    (It does not control the --safe-mode command line argument, though.)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165926
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>
    (cherry picked from commit fe66cf8c8048bfd8a4386c0c711bd6912af9ec63)
    Conflicts:
            cui/source/dialogs/tipofthedaydlg.cxx
            framework/source/uielement/menubarmanager.cxx
            officecfg/registry/schema/org/openoffice/Office/Common.xcs
            svx/source/dialog/crashreportdlg.cxx
    
    Change-Id: I66084448a1ba9427aaafef630187b4bf25219a2c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165928
    Tested-by: allotropia jenkins <jenk...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/cui/source/dialogs/tipofthedaydlg.cxx 
b/cui/source/dialogs/tipofthedaydlg.cxx
index 25722420ddfc..e3fc7e31e1a4 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -72,8 +72,21 @@ static bool file_exists(const OUString& fileName)
 
 void TipOfTheDayDialog::UpdateTip()
 {
-    if ((nCurrentTip + 1 > nNumberOfTips) || (nCurrentTip < 0))
-        nCurrentTip = 0;
+    for (;;)
+    {
+        if ((nCurrentTip + 1 > nNumberOfTips) || (nCurrentTip < 0))
+            nCurrentTip = 0;
+        if (std::get<1>(TIPOFTHEDAY_STRINGARRAY[nCurrentTip])
+                == "svx/ui/safemodedialog/SafeModeDialog"
+            && !officecfg::Office::Common::Misc::OfferSafeMode::get())
+        {
+            ++nCurrentTip;
+        }
+        else
+        {
+            break;
+        }
+    }
     m_xDialog->set_title(CuiResId(STR_TITLE) + ": " + 
OUString::number(nCurrentTip + 1) + "/"
                          + OUString::number(nNumberOfTips));
 
diff --git a/framework/source/uielement/menubarmanager.cxx 
b/framework/source/uielement/menubarmanager.cxx
index f7a41c75f9e3..68df9ce6586d 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -54,6 +54,7 @@
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertyvalue.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <svtools/menuoptions.hxx>
 #include <svtools/javainteractionhandler.hxx>
 #include <uno/current_context.hxx>
@@ -1455,6 +1456,11 @@ void MenuBarManager::FillMenu(
                 {
                     continue;
                 }
+                if (aCommandURL == ".uno:SafeMode"
+                    && !officecfg::Office::Common::Misc::OfferSafeMode::get())
+                {
+                    continue;
+                }
 
                 if ( nType == css::ui::ItemType::DEFAULT )
                 {
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index b47794f128c4..307caf9f2895 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5813,6 +5813,12 @@
           <desc>Number of saved searches in the Find and Replace dialog.</desc>
         </info>
       </prop>
+      <prop oor:name="OfferSafeMode" oor:type="xs:boolean" 
oor:nillable="false">
+        <info>
+          <desc>Offer Safe Mode to the user.</desc>
+        </info>
+        <value>true</value>
+      </prop>
     </group>
     <group oor:name="Forms">
       <info>
diff --git a/svx/source/dialog/crashreportdlg.cxx 
b/svx/source/dialog/crashreportdlg.cxx
index d09fde9b1882..9d3512c56fb7 100644
--- a/svx/source/dialog/crashreportdlg.cxx
+++ b/svx/source/dialog/crashreportdlg.cxx
@@ -16,6 +16,7 @@
 #include <desktop/crashreport.hxx>
 #include <sfx2/safemode.hxx>
 #include <comphelper/processfactory.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <osl/file.hxx>
 
 #include <com/sun/star/task/OfficeRestartManager.hpp>
@@ -33,8 +34,14 @@ CrashReportDialog::CrashReportDialog(weld::Window* pParent)
 {
     maSuccessMsg = mxEditPostUpload->get_text();
 
+    auto const offerSafeMode = 
officecfg::Office::Common::Misc::OfferSafeMode::get();
+    mxCBSafeMode->set_visible(offerSafeMode);
+
     auto nWidth = mxEditPreUpload->get_preferred_size().Width();
-    nWidth = std::max(nWidth, mxCBSafeMode->get_size_request().Width());
+    if (offerSafeMode)
+    {
+        nWidth = std::max(nWidth, mxCBSafeMode->get_size_request().Width());
+    }
     mxEditPreUpload->set_size_request(nWidth, -1);
     mxCBSafeMode->set_size_request(nWidth, -1);
 

Reply via email to