summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-03 17:13:53 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-03-03 21:48:38 +0100
commit66bed5a89d3418c5f634f0dc3213ca600a3abd60 (patch)
tree5492f4f1a3750294fbe46183e83b4090da6152e1 /sfx2/source
parent102c0cc175602d1bca654813cc184f52e80f94cb (diff)
weld SafeMode dialog
and rework as an explicit MessageDialog Change-Id: I1f99bf30d70b309d3f46f818f83bdbd759f97f45 Reviewed-on: https://gerrit.libreoffice.org/50683 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/appserv.cxx44
1 files changed, 24 insertions, 20 deletions
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;
}