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

New commits:
commit fe66cf8c8048bfd8a4386c0c711bd6912af9ec63
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Wed Apr 10 13:30:59 2024 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Wed Apr 10 14:54:41 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.)
    
    Change-Id: I66084448a1ba9427aaafef630187b4bf25219a2c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165926
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/cui/source/dialogs/tipofthedaydlg.cxx 
b/cui/source/dialogs/tipofthedaydlg.cxx
index bbb26a054be9..40bb606130f2 100644
--- a/cui/source/dialogs/tipofthedaydlg.cxx
+++ b/cui/source/dialogs/tipofthedaydlg.cxx
@@ -121,8 +121,21 @@ void TipOfTheDayDialog::UpdateTip()
 {
     constexpr sal_Int32 nNumberOfTips = std::size(TIPOFTHEDAY_STRINGARRAY);
 
-    if ((m_nCurrentTip >= nNumberOfTips) || (m_nCurrentTip < 0))
-        m_nCurrentTip = 0;
+    for (;;)
+    {
+        if ((m_nCurrentTip >= nNumberOfTips) || (m_nCurrentTip < 0))
+            m_nCurrentTip = 0;
+        if (std::get<1>(TIPOFTHEDAY_STRINGARRAY[m_nCurrentTip])
+                == "svx/ui/safemodedialog/SafeModeDialog"
+            && !officecfg::Office::Common::Misc::OfferSafeMode::get())
+        {
+            ++m_nCurrentTip;
+        }
+        else
+        {
+            break;
+        }
+    }
 
     //title
     m_xDialog->set_title(CuiResId(STR_TITLE)
diff --git a/framework/source/uielement/menubarmanager.cxx 
b/framework/source/uielement/menubarmanager.cxx
index 8194cfc8e25f..95e17053d3fb 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1343,6 +1343,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 e43a6ac23765..15b3a481195c 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5583,6 +5583,12 @@
         </info>
         <value>true</value>
       </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 aad28436eea3..82ecf8beda5a 100644
--- a/svx/source/dialog/crashreportdlg.cxx
+++ b/svx/source/dialog/crashreportdlg.cxx
@@ -40,8 +40,14 @@ CrashReportDialog::CrashReportDialog(weld::Window* pParent)
 {
     maLinkTemplate = mxLinkButton->get_uri();
 
+    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