sw/source/ui/frmdlg/cption.cxx | 7 +++++++ sw/source/uibase/inc/cption.hxx | 1 + sw/source/uibase/uiview/viewdlg2.cxx | 11 +++++++---- vcl/jsdialog/enabled.cxx | 10 ++++------ 4 files changed, 19 insertions(+), 10 deletions(-)
New commits: commit 6b36c22cd3197e79ac3420bdca98eb5574b64f81 Author: Skyler Grey <[email protected]> AuthorDate: Fri Aug 19 12:23:20 2022 +0100 Commit: Szymon Kłos <[email protected]> CommitDate: Mon Aug 22 07:40:24 2022 +0200 Make the insert caption dialog an async jsdialog - Using StartExecuteAsync instead of Execute to execute the dialog makes it run asyncly - We need to add a handler for the OK button, otherwise the event won't be fired when it's clicked. There seem to be varying names for this throughout the codebase, I've chosen OKHdl as it's short, appears to be relatively common and fits well with the existing OptionHdl and CaptionHdl that the other buttons on the dialog use - Lastly, we need to enable the JSDialog builder in vcl/jsdialog/enabled.cxx so that the dialog becomes a JSDialog Still TODO: - Convert the dialogs that open when you press "auto" or "options" buttons (will be in a followup review) Change-Id: Ieabbc4e69c4aa065506f7dc6c823d83e4d784c2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138313 Reviewed-by: Szymon Kłos <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 867e16fa56dc..8d8752fb7783 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -137,6 +137,7 @@ SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, SwView &rV) m_xSepEdit->connect_changed(aLk); m_xFormatBox->connect_changed(LINK(this, SwCaptionDialog, SelectListBoxHdl)); + m_xOKButton->connect_clicked(LINK(this, SwCaptionDialog, OKHdl)); m_xOptionButton->connect_clicked(LINK(this, SwCaptionDialog, OptionHdl)); m_xAutoCaptionButton->connect_clicked(LINK(this, SwCaptionDialog, CaptionHdl)); @@ -265,6 +266,12 @@ SwCaptionDialog::SwCaptionDialog(weld::Window *pParent, SwView &rV) DrawSample(); } +IMPL_LINK_NOARG(SwCaptionDialog, OKHdl, weld::Button&, void) +{ + Apply(); + m_xDialog->response(RET_OK); +} + void SwCaptionDialog::Apply() { InsCaptionOpt aOpt; diff --git a/sw/source/uibase/inc/cption.hxx b/sw/source/uibase/inc/cption.hxx index b442857a44b8..f5640d2b877b 100644 --- a/sw/source/uibase/inc/cption.hxx +++ b/sw/source/uibase/inc/cption.hxx @@ -64,6 +64,7 @@ class SwCaptionDialog final : public SfxDialogController DECL_LINK(ModifyComboHdl, weld::ComboBox&, void); DECL_LINK(OptionHdl, weld::Button&, void); DECL_LINK(CaptionHdl, weld::Button&, void); + DECL_LINK(OKHdl, weld::Button&, void); void Apply(); diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index dd0da7acef95..c1131f1f590b 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -46,15 +46,18 @@ using namespace css; -void SwView::ExecDlgExt(SfxRequest const &rReq) +void SwView::ExecDlgExt(SfxRequest const& rReq) { - switch ( rReq.GetSlot() ) + switch (rReq.GetSlot()) { case FN_INSERT_CAPTION: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - ScopedVclPtr<VclAbstractDialog> pDialog(pFact->CreateSwCaptionDialog(GetFrameWeld(), *this )); - pDialog->Execute(); + VclPtr<VclAbstractDialog> pDialog( + pFact->CreateSwCaptionDialog(GetFrameWeld(), *this)); + pDialog->StartExecuteAsync([pDialog](sal_Int32) { + pDialog->disposeOnce(); + }); break; } case SID_INSERT_SIGNATURELINE: diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index 7c1fe9b6f6b2..f608dad9f3e8 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -64,12 +64,10 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"modules/swriter/ui/splittable.ui" || rUIFile == u"cui/ui/splitcellsdialog.ui" || rUIFile == u"sfx/ui/documentpropertiesdialog.ui" - || rUIFile == u"sfx/ui/custominfopage.ui" - || rUIFile == u"sfx/ui/cmisinfopage.ui" - || rUIFile == u"sfx/ui/descriptioninfopage.ui" - || rUIFile == u"sfx/ui/documentinfopage.ui" - || rUIFile == u"sfx/ui/linefragment.ui" - || rUIFile == u"sfx/ui/editdurationdialog.ui") + || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == u"sfx/ui/cmisinfopage.ui" + || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == u"sfx/ui/documentinfopage.ui" + || rUIFile == u"sfx/ui/linefragment.ui" || rUIFile == u"sfx/ui/editdurationdialog.ui" + || rUIFile == u"modules/swriter/ui/insertcaption.ui") { return true; }
