cui/source/options/optsave.cxx           |   16 +++++++++++++---
 include/svtools/restartdialog.hxx        |    3 +++
 svtools/source/dialogs/restartdialog.cxx |    3 +++
 svtools/uiconfig/ui/restartdialog.ui     |   19 +++++++++++++++++--
 4 files changed, 36 insertions(+), 5 deletions(-)

New commits:
commit 5766b29e49aa8cf15dc7a7b97a4347d74ba735ce
Author:     Tünde Tóth <toth.tu...@nisz.hu>
AuthorDate: Tue May 31 16:11:03 2022 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Fri Jun 24 12:04:38 2022 +0200

    tdf#149401 show "Restart LibreOffice" dialog changing AutoRecovery
    
    Changing "Save Autorecovery... information every ... minutes"
    option in Tools->Options...->Load/Save->General shows that
    dialog window to warn about its work.
    
    Change-Id: I91ae72ea1e52ec5c6d9286a43cd986386636076c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135221
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit 98cb1a3110848f7c974414ec3a4d24b4715a2626)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136327
    Tested-by: Jenkins

diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx
index 717fa623a668..43468715cd3a 100644
--- a/cui/source/options/optsave.cxx
+++ b/cui/source/options/optsave.cxx
@@ -25,6 +25,7 @@
 #include <svl/eitem.hxx>
 #include <svl/intitem.hxx>
 #include "optsave.hxx"
+#include <treeopt.hxx>
 #include <officecfg/Office/Common.hxx>
 #include <comphelper/processfactory.hxx>
 #include <unotools/moduleoptions.hxx>
@@ -37,6 +38,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <sfx2/sfxsids.hrc>
 #include <sfx2/docfilt.hxx>
+#include <svtools/restartdialog.hxx>
 #include <unotools/optionsdlg.hxx>
 #include <osl/diagnose.h>
 #include <tools/diagnose_ex.h>
@@ -225,7 +227,7 @@ void SvxSaveTabPage::DetectHiddenControls()
 bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
 {
     auto xChanges = comphelper::ConfigurationChanges::create();
-    bool bModified = false;
+    bool bModified = false, bRequestRestart = false;
     if(m_xLoadUserSettingsCB->get_state_changed_from_saved())
         
officecfg::Office::Common::Load::UserDefinedSettings::set(m_xLoadUserSettingsCB->get_active(),
 xChanges);
 
@@ -255,7 +257,7 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
     {
         rSet->Put( SfxBoolItem( SID_ATTR_AUTOSAVE,
                                m_xAutoSaveCB->get_active() ) );
-        bModified = true;
+        bModified = bRequestRestart = true;
     }
     if ( m_xWarnAlienFormatCB->get_state_changed_from_saved() )
     {
@@ -268,7 +270,7 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
     {
         rSet->Put( SfxUInt16Item( SID_ATTR_AUTOSAVEMINUTE,
                                  
static_cast<sal_uInt16>(m_xAutoSaveEdit->get_value()) ) );
-        bModified = true;
+        bModified = bRequestRestart = true;
     }
 
     if ( m_xUserAutoSaveCB->get_state_changed_from_saved() )
@@ -322,6 +324,14 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet )
         
aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::EFactory::WRITERGLOBAL, 
pImpl->aDefaultArr[APP_WRITER_GLOBAL]);
 
     xChanges->commit();
+
+    if (bRequestRestart)
+    {
+        OfaTreeOptionsDialog* 
pParentDlg(static_cast<OfaTreeOptionsDialog*>(GetDialogController()));
+        if (pParentDlg)
+            pParentDlg->SetNeedsRestart(svtools::RESTART_REASON_SAVE);
+    }
+
     return bModified;
 }
 
diff --git a/include/svtools/restartdialog.hxx 
b/include/svtools/restartdialog.hxx
index 95ca3ef4356d..001f322772a5 100644
--- a/include/svtools/restartdialog.hxx
+++ b/include/svtools/restartdialog.hxx
@@ -65,6 +65,9 @@ enum RestartReason {
     // For restructuring the Form menu,
     // %PRODUCTNAME must be restarted:
     RESTART_REASON_MSCOMPATIBLE_FORMS_MENU,
+    // For the modified save settings to take effect,
+    // %PRODUCTNAME must be restarted:
+    RESTART_REASON_SAVE,
     // To apply changes, %PRODUCTNAME,
     // %PRODUCTNAME must be restarted:
     RESTART_REASON_UI_CHANGE,
diff --git a/svtools/source/dialogs/restartdialog.cxx 
b/svtools/source/dialogs/restartdialog.cxx
index ba5c7d2a3304..30954f17638b 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -71,6 +71,9 @@ public:
         case svtools::RESTART_REASON_MSCOMPATIBLE_FORMS_MENU:
             reason_ = m_xBuilder->weld_widget("reason_mscompatible_formsmenu");
             break;
+        case svtools::RESTART_REASON_SAVE:
+            reason_ = m_xBuilder->weld_widget("reason_save");
+            break;
         case svtools::RESTART_REASON_UI_CHANGE:
             reason_ = m_xBuilder->weld_widget("reason_uichange");
             break;
diff --git a/svtools/uiconfig/ui/restartdialog.ui 
b/svtools/uiconfig/ui/restartdialog.ui
index c49218c03bc8..9772c1659ad7 100644
--- a/svtools/uiconfig/ui/restartdialog.ui
+++ b/svtools/uiconfig/ui/restartdialog.ui
@@ -273,6 +273,21 @@
                 <property name="position">13</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkLabel" id="reason_save">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="label" translatable="yes" 
context="restartdialog|reason_save">For the modified save settings to take 
effect, %PRODUCTNAME must be restarted.</property>
+                <property name="wrap">True</property>
+                <property name="max-width-chars">50</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">14</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkLabel" id="label">
                 <property name="visible">True</property>
@@ -284,7 +299,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">14</property>
+                <property name="position">15</property>
               </packing>
             </child>
             <child>
@@ -299,7 +314,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">15</property>
+                <property name="position">16</property>
               </packing>
             </child>
           </object>

Reply via email to