summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-10-10 15:04:53 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-10-10 18:30:57 +0000
commitae94c223e2e21e42fc7feca72402b910e5eab5c7 (patch)
tree6fc362a324f57713fd2f9e4cf0607c978370fcb2 /sfx2
parent7433ba52d3a28ba946e522aa5d579679573569a2 (diff)
safemode: Add uno command and menu entry
Change-Id: I1843767160b79041c42e506eff0cf39399c74f26 Reviewed-on: https://gerrit.libreoffice.org/29668 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/UIConfig_sfx.mk1
-rw-r--r--sfx2/sdi/appslots.sdi5
-rw-r--r--sfx2/sdi/sfx.sdi17
-rw-r--r--sfx2/source/appl/appserv.cxx34
-rw-r--r--sfx2/uiconfig/ui/safemodequerydialog.ui84
5 files changed, 141 insertions, 0 deletions
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 <com/sun/star/system/SystemShellExecuteException.hpp>
#include <com/sun/star/task/XJobExecutor.hpp>
#include <com/sun/star/text/ModuleDispatcher.hpp>
+#include <com/sun/star/task/OfficeRestartManager.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/ui/dialogs/AddressBookSourcePilot.hpp>
#include <com/sun/star/ui/UIElementType.hpp>
#include <com/sun/star/ui/XUIElement.hpp>
@@ -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<PushButton>("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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+ <requires lib="gtk+" version="3.0"/>
+ <object class="GtkDialog" id="SafeModeQueryDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">Enter 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="cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="restart">
+ <property name="label">_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">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Are you sure you want to restart %PRODUCTNAME and enter the Safe Mode?</property>
+ <property name="wrap">True</property>
+ <property name="max_width_chars">80</property>
+ <property name="lines">2</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">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">cancel</action-widget>
+ <action-widget response="0">restart</action-widget>
+ </action-widgets>
+ </object>
+</interface>