[Libreoffice-commits] core.git: sfx2/source sfx2/uiconfig
Caolán McNamara
caolanm at redhat.com
Sat Mar 3 20:48:59 UTC 2018
sfx2/source/appl/appserv.cxx | 44 +++++++++++++++++---------------
sfx2/uiconfig/ui/safemodequerydialog.ui | 43 ++++++++++---------------------
2 files changed, 38 insertions(+), 49 deletions(-)
New commits:
commit 66bed5a89d3418c5f634f0dc3213ca600a3abd60
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Mar 3 17:13:53 2018 +0000
weld SafeMode dialog
and rework as an explicit MessageDialog
Change-Id: I1f99bf30d70b309d3f46f818f83bdbd759f97f45
Reviewed-on: https://gerrit.libreoffice.org/50683
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 4b5c0080dc28..bc04d9b178a6 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -334,28 +334,32 @@ namespace
}
};
- class SafeModeQueryDialog : public ModalDialog
+ class SafeModeQueryDialog
{
private:
- DECL_LINK(RestartHdl, Button*, void);
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::MessageDialog> m_xDialog;
public:
- explicit SafeModeQueryDialog();
- };
-
- SafeModeQueryDialog::SafeModeQueryDialog()
- : ModalDialog(nullptr, "SafeModeQueryDialog", "sfx/ui/safemodequerydialog.ui")
- {
- get<PushButton>("restart")->SetClickHdl(LINK(this, SafeModeQueryDialog, RestartHdl));
- }
+ SafeModeQueryDialog(weld::Window* pParent)
+ : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/safemodequerydialog.ui"))
+ , m_xDialog(m_xBuilder->weld_message_dialog("SafeModeQueryDialog"))
+ {
+ m_xDialog->set_primary_text(Translate::GetReadStringHook()(m_xDialog->get_primary_text()));
+ }
- IMPL_LINK_NOARG(SafeModeQueryDialog, RestartHdl, Button*, void)
- {
- EndDialog(RET_OK);
- sfx2::SafeMode::putFlag();
- uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
- css::task::OfficeRestartManager::get(xContext)->requestRestart(
- css::uno::Reference< css::task::XInteractionHandler >());
- }
+ short run()
+ {
+ short nRet = m_xDialog->run();
+ if (nRet == RET_OK)
+ {
+ sfx2::SafeMode::putFlag();
+ uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+ css::task::OfficeRestartManager::get(xContext)->requestRestart(
+ css::uno::Reference< css::task::XInteractionHandler >());
+ }
+ return nRet;
+ }
+ };
}
void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
@@ -1026,8 +1030,8 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
}
case SID_SAFE_MODE:
{
- ScopedVclPtrInstance< SafeModeQueryDialog > aDialog;
- aDialog->Execute();
+ SafeModeQueryDialog aDialog(GetRequestFrameWeld(rReq));
+ aDialog.run();
break;
}
diff --git a/sfx2/uiconfig/ui/safemodequerydialog.ui b/sfx2/uiconfig/ui/safemodequerydialog.ui
index 4a01791f52b2..b9409d0a5d5a 100644
--- a/sfx2/uiconfig/ui/safemodequerydialog.ui
+++ b/sfx2/uiconfig/ui/safemodequerydialog.ui
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.2 -->
<interface domain="sfx">
<requires lib="gtk+" version="3.0"/>
- <object class="GtkDialog" id="SafeModeQueryDialog">
+ <object class="GtkMessageDialog" id="SafeModeQueryDialog">
<property name="can_focus">False</property>
- <property name="border_width">6</property>
<property name="title" translatable="yes" context="safemodequerydialog|SafeModeQueryDialog">Enter Safe Mode</property>
- <property name="resizable">False</property>
<property name="type_hint">dialog</property>
+ <property name="message_type">question</property>
+ <property name="text" translatable="yes" context="safemodequerydialog|label">Are you sure you want to restart %PRODUCTNAME and enter safe mode?</property>
<child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
+ <object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">12</property>
+ <property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
+ <object class="GtkButtonBox">
<property name="can_focus">False</property>
- <property name="layout_style">end</property>
+ <property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
@@ -35,7 +35,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="restart">
+ <object class="GtkButton" id="ok">
<property name="label" translatable="yes" context="safemodequerydialog|restart">_Restart</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -51,33 +51,18 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
+ <property name="fill">False</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" context="safemodequerydialog|label">Are you sure you want to restart %PRODUCTNAME and enter 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="-6">cancel</action-widget>
- <action-widget response="0">restart</action-widget>
+ <action-widget response="-5">ok</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
More information about the Libreoffice-commits
mailing list