[Libreoffice-commits] core.git: cui/source include/svtools
Katarina Behrens
Katarina.Behrens at cib.de
Tue Mar 6 12:05:33 UTC 2018
cui/source/inc/treeopt.hxx | 13 +++++++++++--
cui/source/options/optjava.cxx | 22 +++++++++++++---------
cui/source/options/optjava.hxx | 4 ++++
cui/source/options/treeopt.cxx | 20 +++++++++++++++++++-
include/svtools/restartdialog.hxx | 2 ++
5 files changed, 49 insertions(+), 12 deletions(-)
New commits:
commit 683a68cb5106e99db0fbe892b5784d837cf8cb27
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu Mar 1 12:23:21 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: I6e61fa1fc41199c2f16cb80da771202c255f3810
Reviewed-on: https://gerrit.libreoffice.org/50566
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index e71302449678..032e432bfc05 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;
@@ -119,14 +121,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;
@@ -136,6 +140,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;
@@ -182,6 +189,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 50264e96e777..79e210f125a3 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>
@@ -125,6 +126,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();
@@ -191,6 +193,7 @@ void SvxJavaOptionsPage::dispose()
jfw_unlock();
#endif
+ m_pParentDlg.clear();
m_pJavaEnableCB.clear();
m_pJavaBox.clear();
m_pJavaPathText.clear();
@@ -286,8 +289,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 );
}
}
}
@@ -326,8 +328,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 );
}
}
}
@@ -562,6 +563,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 )
{
@@ -578,8 +585,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() )
@@ -629,9 +635,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 4ff782ae761f..993aaaf7ec86 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
@@ -2037,6 +2049,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:
More information about the Libreoffice-commits
mailing list