diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-10-07 18:19:25 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-10-10 09:31:28 +0200 |
commit | f9a427680f59be8591b5e5d750ce0189a6becd54 (patch) | |
tree | b18ee924bc4732db60ac52ed4c7c9427a6cd5ff1 /svx | |
parent | 8ac6b51cc484a36bfd789588a03cbf8e978e4236 (diff) |
Show dialog when starting in safe mode
Change-Id: Ie4b5f5b7309735dfa844bbaba9cb2763a3de3dc1
Diffstat (limited to 'svx')
-rw-r--r-- | svx/Library_svx.mk | 2 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 1 | ||||
-rw-r--r-- | svx/source/dialog/SafeModeDialog.cxx | 65 | ||||
-rw-r--r-- | svx/source/dialog/SafeModeDialog.hxx | 44 | ||||
-rw-r--r-- | svx/source/dialog/SafeModeUI.cxx | 99 | ||||
-rw-r--r-- | svx/uiconfig/ui/safemodedialog.ui | 148 | ||||
-rw-r--r-- | svx/util/svx.component | 4 |
7 files changed, 363 insertions, 0 deletions
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index e564af8401fd..2c91b137305a 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -146,6 +146,8 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/dialog/rlrcitem \ svx/source/dialog/rubydialog \ svx/source/dialog/rulritem \ + svx/source/dialog/SafeModeDialog \ + svx/source/dialog/SafeModeUI \ svx/source/dialog/SpellDialogChildWindow \ svx/source/dialog/srchctrl \ svx/source/dialog/srchdlg \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index bd9c6d8ba288..65b9bdedd088 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -64,6 +64,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/redlinecontrol \ svx/uiconfig/ui/redlinefilterpage \ svx/uiconfig/ui/redlineviewpage \ + svx/uiconfig/ui/safemodedialog \ svx/uiconfig/ui/savemodifieddialog \ svx/uiconfig/ui/sidebararea \ svx/uiconfig/ui/sidebarshadow \ diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx new file mode 100644 index 000000000000..c9f6e4c7fb99 --- /dev/null +++ b/svx/source/dialog/SafeModeDialog.cxx @@ -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: */ diff --git a/svx/source/dialog/SafeModeDialog.hxx b/svx/source/dialog/SafeModeDialog.hxx new file mode 100644 index 000000000000..ac71cf41a5ac --- /dev/null +++ b/svx/source/dialog/SafeModeDialog.hxx @@ -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: */ diff --git a/svx/source/dialog/SafeModeUI.cxx b/svx/source/dialog/SafeModeUI.cxx new file mode 100644 index 000000000000..15da084119f0 --- /dev/null +++ b/svx/source/dialog/SafeModeUI.cxx @@ -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: */ diff --git a/svx/uiconfig/ui/safemodedialog.ui b/svx/uiconfig/ui/safemodedialog.ui new file mode 100644 index 000000000000..8ac77b2c7400 --- /dev/null +++ b/svx/uiconfig/ui/safemodedialog.ui @@ -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> diff --git a/svx/util/svx.component b/svx/util/svx.component index 31c8005fd692..eeecf60080ac 100644 --- a/svx/util/svx.component +++ b/svx/util/svx.component @@ -36,6 +36,10 @@ constructor="com_sun_star_comp_svx_CrashReportUI_get_implementation"> <service name="com.sun.star.dialog.CrashReportUI"/> </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" constructor="com_sun_star_drawing_EnhancedCustomShapeEngine_get_implementation"> <service name="com.sun.star.drawing.CustomShapeEngine"/> |