Show dialog when starting in safe mode
Change-Id: Ie4b5f5b7309735dfa844bbaba9cb2763a3de3dc1
This commit is contained in:
parent
8ac6b51cc4
commit
f9a427680f
8 changed files with 384 additions and 0 deletions
|
@ -1056,6 +1056,22 @@ void handleCrashReport()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void handleSafeMode()
|
||||||
|
{
|
||||||
|
static const char SERVICENAME_SAFEMODE[] = "com.sun.star.comp.svx.SafeModeUI";
|
||||||
|
|
||||||
|
css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
|
||||||
|
|
||||||
|
Reference< css::frame::XSynchronousDispatch > xSafeModeUI(
|
||||||
|
xContext->getServiceManager()->createInstanceWithContext(SERVICENAME_SAFEMODE, xContext),
|
||||||
|
css::uno::UNO_QUERY_THROW);
|
||||||
|
|
||||||
|
css::util::URL aURL;
|
||||||
|
css::uno::Any aRet = xSafeModeUI->dispatchWithReturnValue(aURL, css::uno::Sequence< css::beans::PropertyValue >());
|
||||||
|
bool bRet = false;
|
||||||
|
aRet >>= bRet;
|
||||||
|
}
|
||||||
|
|
||||||
/** @short check if recovery must be started or not.
|
/** @short check if recovery must be started or not.
|
||||||
|
|
||||||
@param bCrashed [boolean ... out!]
|
@param bCrashed [boolean ... out!]
|
||||||
|
@ -2029,6 +2045,11 @@ void Desktop::OpenClients()
|
||||||
// need some time, where the user won't see any results and wait for finishing the office startup...
|
// need some time, where the user won't see any results and wait for finishing the office startup...
|
||||||
bool bAllowRecoveryAndSessionManagement = ( !rArgs.IsNoRestore() ) && ( !rArgs.IsHeadless() );
|
bool bAllowRecoveryAndSessionManagement = ( !rArgs.IsNoRestore() ) && ( !rArgs.IsHeadless() );
|
||||||
|
|
||||||
|
// Enter safe mode if requested
|
||||||
|
if (rArgs.IsSafeMode())
|
||||||
|
handleSafeMode();
|
||||||
|
|
||||||
|
|
||||||
#if HAVE_FEATURE_BREAKPAD
|
#if HAVE_FEATURE_BREAKPAD
|
||||||
if (crashReportInfoExists())
|
if (crashReportInfoExists())
|
||||||
handleCrashReport();
|
handleCrashReport();
|
||||||
|
|
|
@ -146,6 +146,8 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
|
||||||
svx/source/dialog/rlrcitem \
|
svx/source/dialog/rlrcitem \
|
||||||
svx/source/dialog/rubydialog \
|
svx/source/dialog/rubydialog \
|
||||||
svx/source/dialog/rulritem \
|
svx/source/dialog/rulritem \
|
||||||
|
svx/source/dialog/SafeModeDialog \
|
||||||
|
svx/source/dialog/SafeModeUI \
|
||||||
svx/source/dialog/SpellDialogChildWindow \
|
svx/source/dialog/SpellDialogChildWindow \
|
||||||
svx/source/dialog/srchctrl \
|
svx/source/dialog/srchctrl \
|
||||||
svx/source/dialog/srchdlg \
|
svx/source/dialog/srchdlg \
|
||||||
|
|
|
@ -64,6 +64,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
|
||||||
svx/uiconfig/ui/redlinecontrol \
|
svx/uiconfig/ui/redlinecontrol \
|
||||||
svx/uiconfig/ui/redlinefilterpage \
|
svx/uiconfig/ui/redlinefilterpage \
|
||||||
svx/uiconfig/ui/redlineviewpage \
|
svx/uiconfig/ui/redlineviewpage \
|
||||||
|
svx/uiconfig/ui/safemodedialog \
|
||||||
svx/uiconfig/ui/savemodifieddialog \
|
svx/uiconfig/ui/savemodifieddialog \
|
||||||
svx/uiconfig/ui/sidebararea \
|
svx/uiconfig/ui/sidebararea \
|
||||||
svx/uiconfig/ui/sidebarshadow \
|
svx/uiconfig/ui/sidebarshadow \
|
||||||
|
|
65
svx/source/dialog/SafeModeDialog.cxx
Normal file
65
svx/source/dialog/SafeModeDialog.cxx
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
* This file is part of the LibreOffice project.
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "SafeModeDialog.hxx"
|
||||||
|
|
||||||
|
#include <config_folders.h>
|
||||||
|
|
||||||
|
#include <rtl/bootstrap.hxx>
|
||||||
|
#include <osl/file.hxx>
|
||||||
|
|
||||||
|
SafeModeDialog::SafeModeDialog(vcl::Window* pParent):
|
||||||
|
Dialog(pParent, "SafeModeDialog", "svx/ui/safemodedialog.ui")
|
||||||
|
{
|
||||||
|
get(mpBtnContinue, "btn_continue");
|
||||||
|
get(mpBtnQuit, "btn_quit");
|
||||||
|
get(mpBtnRestart, "btn_restart");
|
||||||
|
get(mpCBCustomizations, "check_customizations");
|
||||||
|
get(mpCBExtensions, "check_extensions");
|
||||||
|
get(mpCBFull, "check_full");
|
||||||
|
|
||||||
|
mpBtnContinue->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl));
|
||||||
|
mpBtnQuit->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl));
|
||||||
|
mpBtnRestart->SetClickHdl(LINK(this, SafeModeDialog, BtnHdl));
|
||||||
|
}
|
||||||
|
|
||||||
|
SafeModeDialog::~SafeModeDialog()
|
||||||
|
{
|
||||||
|
disposeOnce();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SafeModeDialog::dispose()
|
||||||
|
{
|
||||||
|
mpBtnContinue.clear();
|
||||||
|
mpBtnQuit.clear();
|
||||||
|
mpBtnRestart.clear();
|
||||||
|
mpCBCustomizations.clear();
|
||||||
|
mpCBExtensions.clear();
|
||||||
|
mpCBFull.clear();
|
||||||
|
|
||||||
|
Dialog::dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPL_LINK(SafeModeDialog, BtnHdl, Button*, pBtn, void)
|
||||||
|
{
|
||||||
|
if (pBtn == mpBtnContinue.get())
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
else if (pBtn == mpBtnQuit.get())
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
else if (pBtn == mpBtnRestart.get())
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
44
svx/source/dialog/SafeModeDialog.hxx
Normal file
44
svx/source/dialog/SafeModeDialog.hxx
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
* This file is part of the LibreOffice project.
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INCLUDED_SVX_SOURCE_DIALOG_SAFEMODEDIALOG_HXX
|
||||||
|
#define INCLUDED_SVX_SOURCE_DIALOG_SAFEMODEDIALOG_HXX
|
||||||
|
|
||||||
|
#include <vcl/dialog.hxx>
|
||||||
|
#include <vcl/button.hxx>
|
||||||
|
#include <vcl/fixed.hxx>
|
||||||
|
#include <vcl/edit.hxx>
|
||||||
|
#include <vcl/vclmedit.hxx>
|
||||||
|
|
||||||
|
class SafeModeDialog : public Dialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit SafeModeDialog(vcl::Window* pParent);
|
||||||
|
|
||||||
|
virtual ~SafeModeDialog() override;
|
||||||
|
|
||||||
|
virtual void dispose() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
VclPtr<Button> mpBtnContinue;
|
||||||
|
VclPtr<Button> mpBtnQuit;
|
||||||
|
VclPtr<Button> mpBtnRestart;
|
||||||
|
|
||||||
|
VclPtr<CheckBox> mpCBExtensions;
|
||||||
|
VclPtr<CheckBox> mpCBCustomizations;
|
||||||
|
VclPtr<CheckBox> mpCBFull;
|
||||||
|
|
||||||
|
DECL_LINK(BtnHdl, Button*, void);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
99
svx/source/dialog/SafeModeUI.cxx
Normal file
99
svx/source/dialog/SafeModeUI.cxx
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
* This file is part of the LibreOffice project.
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cppuhelper/implbase.hxx>
|
||||||
|
#include <com/sun/star/frame/XSynchronousDispatch.hpp>
|
||||||
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||||
|
|
||||||
|
#include <comphelper/processfactory.hxx>
|
||||||
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
|
|
||||||
|
#include <vcl/svapp.hxx>
|
||||||
|
|
||||||
|
#include "SafeModeDialog.hxx"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
class SafeModeUI : public ::cppu::WeakImplHelper< css::lang::XServiceInfo,
|
||||||
|
css::frame::XSynchronousDispatch > // => XDispatch!
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit SafeModeUI(const css::uno::Reference< css::uno::XComponentContext >& xContext);
|
||||||
|
virtual ~SafeModeUI() override;
|
||||||
|
|
||||||
|
// css.lang.XServiceInfo
|
||||||
|
virtual OUString SAL_CALL getImplementationName()
|
||||||
|
throw(css::uno::RuntimeException, std::exception) override;
|
||||||
|
|
||||||
|
virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName)
|
||||||
|
throw(css::uno::RuntimeException, std::exception) override;
|
||||||
|
|
||||||
|
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
|
||||||
|
throw(css::uno::RuntimeException, std::exception) override;
|
||||||
|
|
||||||
|
|
||||||
|
virtual css::uno::Any SAL_CALL dispatchWithReturnValue(const css::util::URL& aURL,
|
||||||
|
const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
|
||||||
|
throw(css::uno::RuntimeException, std::exception) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
css::uno::Reference< css::uno::XComponentContext > mxContext;
|
||||||
|
};
|
||||||
|
|
||||||
|
SafeModeUI::SafeModeUI(const css::uno::Reference<css::uno::XComponentContext>& xContext):
|
||||||
|
mxContext(xContext)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SafeModeUI::~SafeModeUI()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OUString SAL_CALL SafeModeUI::getImplementationName()
|
||||||
|
throw(css::uno::RuntimeException, std::exception)
|
||||||
|
{
|
||||||
|
return OUString("com.sun.star.comp.svx.SafeModeUI");
|
||||||
|
}
|
||||||
|
|
||||||
|
sal_Bool SAL_CALL SafeModeUI::supportsService(const OUString& sServiceName)
|
||||||
|
throw(css::uno::RuntimeException, std::exception)
|
||||||
|
{
|
||||||
|
return cppu::supportsService(this, sServiceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
css::uno::Sequence< OUString > SAL_CALL SafeModeUI::getSupportedServiceNames()
|
||||||
|
throw(css::uno::RuntimeException, std::exception)
|
||||||
|
{
|
||||||
|
css::uno::Sequence< OUString > lServiceNames { "com.sun.star.dialog.SafeModeUI" };
|
||||||
|
return lServiceNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
css::uno::Any SAL_CALL SafeModeUI::dispatchWithReturnValue(const css::util::URL&,
|
||||||
|
const css::uno::Sequence< css::beans::PropertyValue >& )
|
||||||
|
throw(css::uno::RuntimeException, std::exception)
|
||||||
|
{
|
||||||
|
SolarMutexGuard aGuard;
|
||||||
|
css::uno::Any aRet;
|
||||||
|
ScopedVclPtrInstance<SafeModeDialog> xDialog(nullptr);
|
||||||
|
xDialog->Execute();
|
||||||
|
return aRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
|
||||||
|
com_sun_star_comp_svx_SafeModeUI_get_implementation(
|
||||||
|
css::uno::XComponentContext *context,
|
||||||
|
css::uno::Sequence<css::uno::Any> const &)
|
||||||
|
{
|
||||||
|
return cppu::acquire(new SafeModeUI(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
148
svx/uiconfig/ui/safemodedialog.ui
Normal file
148
svx/uiconfig/ui/safemodedialog.ui
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.18.3 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.12"/>
|
||||||
|
<object class="GtkDialog" id="SafeModeDialog">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="border_width">6</property>
|
||||||
|
<property name="title" translatable="yes">Safe Mode</property>
|
||||||
|
<property name="resizable">False</property>
|
||||||
|
<property name="type_hint">dialog</property>
|
||||||
|
<child internal-child="vbox">
|
||||||
|
<object class="GtkBox" id="dialog-vbox1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">12</property>
|
||||||
|
<child internal-child="action_area">
|
||||||
|
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="layout_style">end</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="btn_continue">
|
||||||
|
<property name="label" translatable="yes">_Continue in Safe Mode</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="has_default">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="btn_quit">
|
||||||
|
<property name="label" translatable="yes">_Quit</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="btn_restart">
|
||||||
|
<property name="label" translatable="yes">_Make Changes and Restart</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
<property name="position">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="label1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">%PRODUCTNAME is now running in Safe Mode, which temporarily disables your custom settings and extensions.
|
||||||
|
|
||||||
|
You can make some or all these changes permanent:</property>
|
||||||
|
<property name="wrap">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="check_extensions">
|
||||||
|
<property name="label" translatable="yes">Disable all extensions</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="check_customizations">
|
||||||
|
<property name="label" translatable="yes">Reset customizations (Settings and User Interface modifications)</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="check_full">
|
||||||
|
<property name="label" translatable="yes">Reset the whole User Profile</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<object class="GtkActionGroup" id="actiongroup1"/>
|
||||||
|
</interface>
|
|
@ -36,6 +36,10 @@
|
||||||
constructor="com_sun_star_comp_svx_CrashReportUI_get_implementation">
|
constructor="com_sun_star_comp_svx_CrashReportUI_get_implementation">
|
||||||
<service name="com.sun.star.dialog.CrashReportUI"/>
|
<service name="com.sun.star.dialog.CrashReportUI"/>
|
||||||
</implementation>
|
</implementation>
|
||||||
|
<implementation name="com.sun.star.comp.svx.SafeModeUI"
|
||||||
|
constructor="com_sun_star_comp_svx_SafeModeUI_get_implementation">
|
||||||
|
<service name="com.sun.star.dialog.SafeModeUI"/>
|
||||||
|
</implementation>
|
||||||
<implementation name="com.sun.star.drawing.EnhancedCustomShapeEngine"
|
<implementation name="com.sun.star.drawing.EnhancedCustomShapeEngine"
|
||||||
constructor="com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation">
|
constructor="com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation">
|
||||||
<service name="com.sun.star.drawing.CustomShapeEngine"/>
|
<service name="com.sun.star.drawing.CustomShapeEngine"/>
|
||||||
|
|
Loading…
Reference in a new issue