summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2018-03-01 12:23:21 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-04-13 02:29:40 +0200
commitf8d654bba844050a01a232eb8013561da57ed6e0 (patch)
treeb5d39f1ffb59f3a03fd88355d159abe7542df4d7
parentafaa944633cb94205fb835c1d93775fa51ead749 (diff)
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: I6e61fa1fc41199c2f16cb80da771202c255f3810 Reviewed-on: https://gerrit.libreoffice.org/50566 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> (cherry picked from commit 683a68cb5106e99db0fbe892b5784d837cf8cb27) Reviewed-on: https://gerrit.libreoffice.org/50829 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--cui/source/inc/treeopt.hxx13
-rw-r--r--cui/source/options/optjava.cxx22
-rw-r--r--cui/source/options/optjava.hxx4
-rw-r--r--cui/source/options/treeopt.cxx20
-rw-r--r--include/svtools/restartdialog.hxx2
5 files changed, 49 insertions, 12 deletions
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index efad9eb74137..29870a16bc88 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -24,6 +24,8 @@
#include <memory>
+#include <sfx2/basedlgs.hxx>
+#include <svtools/restartdialog.hxx>
#include <vcl/fixed.hxx>
class SfxModule;
@@ -129,14 +131,16 @@ class SvxColorTabPage;
class OfaTreeOptionsDialog final: 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;
@@ -146,6 +150,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;
@@ -192,6 +199,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 ExtensionsTabPage -----------------------------------------------
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index b3443d7734c4..150a13011480 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -26,6 +26,7 @@
#include "optaboutconfig.hxx"
#include "optjava.hxx"
+#include <treeopt.hxx>
#include <dialmgr.hxx>
#include <officecfg/Office/Common.hxx>
@@ -126,6 +127,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();
@@ -192,6 +194,7 @@ void SvxJavaOptionsPage::dispose()
jfw_unlock();
#endif
+ m_pParentDlg.clear();
m_pJavaEnableCB.clear();
m_pJavaBox.clear();
m_pJavaPathText.clear();
@@ -287,8 +290,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl, Button*, void)
aParameterList = m_pParamDlg->GetParameters();
if ( jfw_isVMRunning() )
{
- SolarMutexGuard aGuard;
- svtools::executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, svtools::RESTART_REASON_ASSIGNING_JAVAPARAMETERS);
+ RequestRestart( svtools::RESTART_REASON_ASSIGNING_JAVAPARAMETERS );
}
}
}
@@ -327,8 +329,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl, Button*, void)
sClassPath = m_pPathDlg->GetClassPath();
if ( jfw_isVMRunning() )
{
- SolarMutexGuard aGuard;
- svtools::executeRestartDialog(comphelper::getProcessComponentContext(), nullptr, svtools::RESTART_REASON_ASSIGNING_FOLDERS);
+ RequestRestart( svtools::RESTART_REASON_ASSIGNING_FOLDERS );
}
}
}
@@ -559,6 +560,12 @@ 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 )
{
@@ -575,8 +582,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() )
@@ -626,9 +632,7 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
if ( jfw_isVMRunning() ||
( ( 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 0e2d7a62dee5..c533369f6a47 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -32,6 +32,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>
@@ -46,6 +47,7 @@ typedef void* JavaInfo;
class SvxJavaParameterDlg;
class SvxJavaClassPathDlg;
class SvxJavaListBox;
+class OfaTreeOptionsDialog;
// class SvxJavaOptionsPage ----------------------------------------------
@@ -63,6 +65,7 @@ private:
VclPtr<SvxJavaParameterDlg> m_pParamDlg;
VclPtr<SvxJavaClassPathDlg> m_pPathDlg;
+ VclPtr<OfaTreeOptionsDialog> m_pParentDlg;
#if HAVE_FEATURE_JAVA
std::vector<std::unique_ptr<JavaInfo>> m_parJavaInfo;
@@ -102,6 +105,7 @@ private:
void AddJRE( JavaInfo const * _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 fccf0c14df59..a924be6442f8 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -476,12 +476,16 @@ struct OptionsGroupInfo
};
#define INI_LIST() \
+ m_pParent ( pParent ),\
pCurrentPageEntry ( nullptr ),\
sTitle ( GetText() ),\
sNotLoadedError ( CuiResId( RID_SVXSTR_LOAD_ERROR ) ),\
bForgetSelection ( false ),\
bIsFromExtensionManager( false ), \
- bIsForSetDocumentLanguage( false )
+ bIsForSetDocumentLanguage( false ), \
+ bNeedsRestart ( false ), \
+ eRestartReason( svtools::RESTART_REASON_NONE )
+
void OfaTreeOptionsDialog::InitWidgets()
{
@@ -595,6 +599,7 @@ void OfaTreeOptionsDialog::dispose()
pEntry = pTreeLB->Next(pEntry);
}
deleteGroupNames();
+ m_pParent.clear();
pOkPB.clear();
pBackPB.clear();
pTreeLB.clear();
@@ -702,6 +707,13 @@ IMPL_LINK_NOARG(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
@@ -2043,6 +2055,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 74a90bde9c67..996bdc010085 100644
--- a/include/svtools/restartdialog.hxx
+++ b/include/svtools/restartdialog.hxx
@@ -54,6 +54,8 @@ enum RestartReason {
// "For the extension to work properly,
// %PRODUCTNAME must be restarted."
RESTART_REASON_OPENGL,
+ // No particular reason
+ RESTART_REASON_NONE
};
// Must be called with the solar mutex locked: