[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - cui/source include/svtools

Katarina Behrens Katarina.Behrens at cib.de
Tue Mar 6 13:25:59 UTC 2018


 cui/source/inc/treeopt.hxx        |   13 +++++++++++--
 cui/source/options/optjava.cxx    |   21 ++++++++++++---------
 cui/source/options/optjava.hxx    |    4 ++++
 cui/source/options/treeopt.cxx    |   19 ++++++++++++++++++-
 include/svtools/restartdialog.hxx |    4 +++-
 5 files changed, 48 insertions(+), 13 deletions(-)

New commits:
commit 5bf62a3e7d15108a4754e0b15db9d1cb97bfc3a0
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Mar 6 14:05:54 2018 +0100

    After Java settings have changed, restart LibO for real
    
    Previously restart LibO dialog was shown, but did nothing. I haven't
    found an easy way to close all frames with 3 modal dialogs opened, so
    now restart dialog simply pops up later (after user bonks OK button
    on Tools > Options dialog)
    
    Change-Id: I5638420163da90d514ba251bd84e226d4c74e62b

diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 9cac9922a408..1eb79df44b9b 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_CUI_SOURCE_INC_TREEOPT_HXX
 #define INCLUDED_CUI_SOURCE_INC_TREEOPT_HXX
 
+#include <sfx2/basedlgs.hxx>
+#include <svtools/restartdialog.hxx>
 #include <tools/resary.hxx>
 #include <vcl/fixed.hxx>
 
@@ -126,14 +128,16 @@ class SvxColorTabPage;
 class OfaTreeOptionsDialog : public SfxModalDialog
 {
 private:
-    SvTreeListEntry*    pCurrentPageEntry;
-
     VclPtr<OKButton>       pOkPB;
     VclPtr<PushButton>     pBackPB;
 
     VclPtr<SvTreeListBox>  pTreeLB;
     VclPtr<VclBox>         pTabBox;
 
+    VclPtr<vcl::Window>    m_pParent;
+
+    SvTreeListEntry*       pCurrentPageEntry;
+
     OUString               sTitle;
     OUString               sNotLoadedError;
 
@@ -147,6 +151,9 @@ private:
     // check "for the current document only" and set focus to "Western" languages box
     bool                   bIsForSetDocumentLanguage;
 
+    bool                   bNeedsRestart;
+    svtools::RestartReason eRestartReason;
+
     css::uno::Reference < css::awt::XContainerWindowProvider >
                     m_xContainerWinProvider;
 
@@ -194,6 +201,8 @@ public:
 
     // helper functions to call the language settings TabPage from the SpellDialog
     static void         ApplyLanguageOptions(const SfxItemSet& rSet);
+
+    void                SetNeedsRestart( svtools::RestartReason eReason );
 };
 
 // class OfaPageResource -------------------------------------------------
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index cbb18b2ef84c..5c175dfbd925 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -21,6 +21,7 @@
 
 #include "optaboutconfig.hxx"
 #include "optjava.hxx"
+#include "treeopt.hxx"
 #include <dialmgr.hxx>
 
 #include <officecfg/Office/Common.hxx>
@@ -158,6 +159,7 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet&
     get(m_pExperimentalCB, "experimental");
     get(m_pMacroCB, "macrorecording");
     get(m_pExpertConfigBtn, "expertconfig");
+    m_pParentDlg.reset( dynamic_cast<OfaTreeOptionsDialog*>(getNonLayoutParent(pParent)) );
     m_sAccessibilityText = get<FixedText>("a11y")->GetText();
     m_sAddDialogText = get<FixedText>("selectruntime")->GetText();
 
@@ -224,6 +226,7 @@ void SvxJavaOptionsPage::dispose()
 
     jfw_unlock();
 #endif
+    m_pParentDlg.clear();
     m_pJavaEnableCB.clear();
     m_pJavaBox.clear();
     m_pJavaPathText.clear();
@@ -331,8 +334,7 @@ IMPL_LINK_NOARG_TYPED(SvxJavaOptionsPage, ParameterHdl_Impl, Button*, void)
             (void)eErr;
             if ( bRunning )
             {
-                SolarMutexGuard aGuard;
-                svtools::executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, svtools::RESTART_REASON_ASSIGNING_JAVAPARAMETERS);
+                RequestRestart( svtools::RESTART_REASON_ASSIGNING_JAVAPARAMETERS );
             }
         }
     }
@@ -376,8 +378,7 @@ IMPL_LINK_NOARG_TYPED(SvxJavaOptionsPage, ClassPathHdl_Impl, Button*, void)
             (void)eErr;
             if ( bRunning )
             {
-                SolarMutexGuard aGuard;
-                svtools::executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, svtools::RESTART_REASON_ASSIGNING_FOLDERS);
+                RequestRestart( svtools::RESTART_REASON_ASSIGNING_FOLDERS );
             }
         }
     }
@@ -636,6 +637,11 @@ void SvxJavaOptionsPage::AddFolder( const OUString& _rFolder )
 #endif
 }
 
+void SvxJavaOptionsPage::RequestRestart( svtools::RestartReason eReason )
+{
+    if ( m_pParentDlg )
+        m_pParentDlg->SetNeedsRestart( eReason );
+}
 
 VclPtr<SfxTabPage> SvxJavaOptionsPage::Create( vcl::Window* pParent, const SfxItemSet* rAttrSet )
 {
@@ -652,8 +658,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
         SvtMiscOptions aMiscOpt;
         aMiscOpt.SetExperimentalMode( m_pExperimentalCB->IsChecked() );
         bModified = true;
-        SolarMutexGuard aGuard;
-        svtools::executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, svtools::RESTART_REASON_EXP_FEATURES);
+        RequestRestart( svtools::RESTART_REASON_EXP_FEATURES );
     }
 
     if ( m_pMacroCB->IsValueChangedFromSaved() )
@@ -714,9 +719,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
                     if ( bRunning ||
                         ( ( pInfo->nRequirements & JFW_REQUIRE_NEEDRESTART ) == JFW_REQUIRE_NEEDRESTART ) )
                     {
-                        svtools::executeRestartDialog(
-                            comphelper::getProcessComponentContext(), this,
-                            svtools::RESTART_REASON_JAVA);
+                        RequestRestart( svtools::RESTART_REASON_JAVA );
                     }
 
                     eErr = jfw_setSelectedJRE( pInfo );
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index 3631d4499e6b..fa8f730c947b 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -31,6 +31,7 @@
 #include <sfx2/tabdlg.hxx>
 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
 #include <svtools/dialogclosedlistener.hxx>
+#include <svtools/restartdialog.hxx>
 #include <svtools/simptabl.hxx>
 #include "radiobtnbox.hxx"
 
@@ -45,6 +46,7 @@ typedef void* JavaInfo;
 class   SvxJavaParameterDlg;
 class   SvxJavaClassPathDlg;
 class   SvxJavaListBox;
+class   OfaTreeOptionsDialog;
 
 // class SvxJavaOptionsPage ----------------------------------------------
 
@@ -62,6 +64,7 @@ private:
 
     VclPtr<SvxJavaParameterDlg>        m_pParamDlg;
     VclPtr<SvxJavaClassPathDlg>        m_pPathDlg;
+    VclPtr<OfaTreeOptionsDialog>       m_pParentDlg;
 
 #if HAVE_FEATURE_JAVA
     JavaInfo**              m_parJavaInfo;
@@ -103,6 +106,7 @@ private:
     void                    AddJRE( JavaInfo* _pInfo );
     void                    HandleCheckEntry( SvTreeListEntry* _pEntry );
     void                    AddFolder( const OUString& _rFolder );
+    void                    RequestRestart( svtools::RestartReason eReason );
 
 public:
     SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet );
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 36d64cb1f388..5bab843fe73e 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -490,6 +490,7 @@ struct OptionsGroupInfo
 };
 
 #define INI_LIST() \
+    m_pParent           ( pParent),\
     pCurrentPageEntry   ( nullptr ),\
     sTitle              ( GetText() ),\
     sNotLoadedError     (       CUI_RES( RID_SVXSTR_LOAD_ERROR ) ),\
@@ -497,7 +498,9 @@ struct OptionsGroupInfo
     mpColorPage         ( nullptr ),\
     bForgetSelection    ( false ),\
     bIsFromExtensionManager( false ), \
-    bIsForSetDocumentLanguage( false )
+    bIsForSetDocumentLanguage( false ),\
+    bNeedsRestart( false ),\
+    eRestartReason( svtools::RESTART_REASON_NONE )
 
 void OfaTreeOptionsDialog::InitWidgets()
 {
@@ -608,6 +611,7 @@ void OfaTreeOptionsDialog::dispose()
     delete pColorPageItemSet;
     pColorPageItemSet = nullptr;
     deleteGroupNames();
+    m_pParent.clear();
     pOkPB.clear();
     pBackPB.clear();
     pTreeLB.clear();
@@ -719,6 +723,13 @@ IMPL_LINK_NOARG_TYPED(OfaTreeOptionsDialog, OKHdl_Impl, Button*, void)
         pEntry = pTreeLB->Next(pEntry);
     }
     EndDialog(RET_OK);
+
+    if ( bNeedsRestart )
+    {
+        SolarMutexGuard aGuard;
+        ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
+                                    static_cast<vcl::Window*>(m_pParent), eRestartReason);
+    }
 }
 
 // an opened group shall be completely visible
@@ -2131,6 +2142,12 @@ void  OfaTreeOptionsDialog::InsertNodes( const VectorOfNodes& rNodeList )
     }
 }
 
+void OfaTreeOptionsDialog::SetNeedsRestart( svtools::RestartReason eReason)
+{
+    bNeedsRestart = true;
+    eRestartReason = eReason;
+}
+
 short OfaTreeOptionsDialog::Execute()
 {
     std::unique_ptr< SvxDicListChgClamp > pClamp;
diff --git a/include/svtools/restartdialog.hxx b/include/svtools/restartdialog.hxx
index e04f5f67cb84..80e850b202bc 100644
--- a/include/svtools/restartdialog.hxx
+++ b/include/svtools/restartdialog.hxx
@@ -47,9 +47,11 @@ enum RestartReason {
     RESTART_REASON_ASSIGNING_FOLDERS,
         // "For the assigned folders and archives to take effect,
         // %PRODUCTNAME must be restarted."
-    RESTART_REASON_EXP_FEATURES
+    RESTART_REASON_EXP_FEATURES,
         // "For the modified experimental features to take effect,
         // %PRODUCTNAME must be restarted."
+    RESTART_REASON_NONE
+        // No particular reason
 };
 
 // Must be called with the solar mutex locked:


More information about the Libreoffice-commits mailing list