From ae94c223e2e21e42fc7feca72402b910e5eab5c7 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Mon, 10 Oct 2016 15:04:53 +0200 Subject: safemode: Add uno command and menu entry Change-Id: I1843767160b79041c42e506eff0cf39399c74f26 Reviewed-on: https://gerrit.libreoffice.org/29668 Reviewed-by: Samuel Mehrbrodt Tested-by: Samuel Mehrbrodt --- sfx2/UIConfig_sfx.mk | 1 + sfx2/sdi/appslots.sdi | 5 ++ sfx2/sdi/sfx.sdi | 17 +++++++ sfx2/source/appl/appserv.cxx | 34 +++++++++++++ sfx2/uiconfig/ui/safemodequerydialog.ui | 84 +++++++++++++++++++++++++++++++++ 5 files changed, 141 insertions(+) create mode 100644 sfx2/uiconfig/ui/safemodequerydialog.ui (limited to 'sfx2') diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index c55e3c6fb992..554bf63785ed 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -41,6 +41,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/notebookbarpopup \ sfx2/uiconfig/ui/printeroptionsdialog \ sfx2/uiconfig/ui/querysavedialog \ + sfx2/uiconfig/ui/safemodequerydialog \ sfx2/uiconfig/ui/searchdialog \ sfx2/uiconfig/ui/securityinfopage \ sfx2/uiconfig/ui/singletabdialog \ diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi index 4921f27e0d3e..5df800d52389 100644 --- a/sfx2/sdi/appslots.sdi +++ b/sfx2/sdi/appslots.sdi @@ -225,6 +225,11 @@ interface Application ExecMethod = MiscExec_Impl ; StateMethod = MiscState_Impl ; ] + SID_SAFE_MODE + [ + ExecMethod = MiscExec_Impl ; + StateMethod = MiscState_Impl ; + ] } diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 7c24c75f65d7..edf0ea2b0382 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -5784,3 +5784,20 @@ SfxStringItem Insert3DModel SID_INSERT_3DMODEL ToolBoxConfig = TRUE, GroupId = GID_APPLICATION; ] + +SfxVoidItem SafeMode SID_SAFE_MODE +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = GID_APPLICATION; +] diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 5adbc7cad70e..b09613e081e6 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include #include #include @@ -291,6 +293,28 @@ namespace EndDialog(RET_OK); showDocument("LICENSE"); } + + class SafeModeQueryDialog : public ModalDialog + { + private: + DECL_LINK(RestartHdl, Button*, void); + public: + explicit SafeModeQueryDialog(); + }; + + SafeModeQueryDialog::SafeModeQueryDialog() + : ModalDialog(nullptr, "SafeModeQueryDialog", "sfx/ui/safemodequerydialog.ui") + { + get("restart")->SetClickHdl(LINK(this, SafeModeQueryDialog, RestartHdl)); + } + + IMPL_LINK_NOARG(SafeModeQueryDialog, RestartHdl, Button*, void) + { + EndDialog(RET_OK); + uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); + css::task::OfficeRestartManager::get(xContext)->requestRestart( + css::uno::Reference< css::task::XInteractionHandler >()); + } } void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) @@ -975,6 +999,12 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) bDone = true; break; } + case SID_SAFE_MODE: + { + ScopedVclPtrInstance< SafeModeQueryDialog > aDialog; + aDialog->Execute(); + break; + } default: break; @@ -1148,6 +1178,10 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) } break; } + case SID_SAFE_MODE: + { + break; + } default: break; diff --git a/sfx2/uiconfig/ui/safemodequerydialog.ui b/sfx2/uiconfig/ui/safemodequerydialog.ui new file mode 100644 index 000000000000..8a246910dd9f --- /dev/null +++ b/sfx2/uiconfig/ui/safemodequerydialog.ui @@ -0,0 +1,84 @@ + + + + + + False + 6 + Enter Safe Mode + False + dialog + + + False + vertical + 12 + + + False + end + + + gtk-cancel + True + True + True + True + True + True + True + + + False + True + 0 + True + + + + + _Restart + True + True + True + True + + + False + True + 1 + + + + + False + True + end + 0 + + + + + True + False + Are you sure you want to restart %PRODUCTNAME and enter the Safe Mode? + True + 80 + 2 + 0 + 0 + + + False + True + 1 + + + + + + cancel + restart + + + -- cgit