cui/source/dialogs/cuihyperdlg.cxx | 10 ++++++---- cui/source/dialogs/hldocntp.cxx | 4 ++-- cui/source/dialogs/hltpbase.cxx | 2 +- cui/source/inc/cuihyperdlg.hxx | 3 ++- cui/source/inc/hldocntp.hxx | 2 +- cui/source/inc/hltpbase.hxx | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-)
New commits: commit 6fef768289f4dfa441a109282d253154a20a6123 Author: Gabor Kelemen <kelem...@ubuntu.com> AuthorDate: Fri Dec 17 17:28:38 2021 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Tue Dec 21 23:28:59 2021 +0100 tdf#109390 Warn about empty New Document only on Apply, not OK Creating new document type hyperlink shows a warning about empty file name only when pressing Apply, and closes silently on OK Change-Id: I00e7b20a12df8e35e154e3cf532067cbad72c614 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127010 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx index e695ea331d34..3eef90cdf696 100644 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ b/cui/source/dialogs/cuihyperdlg.cxx @@ -182,14 +182,16 @@ void SvxHpLinkDlg::Close() pViewFrame->ToggleChildWindow(SID_HYPERLINK_DIALOG); } -void SvxHpLinkDlg::Apply() +void SvxHpLinkDlg::Apply( bool bWarn ) { SfxItemSetFixed<SID_HYPERLINK_GETLINK, SID_HYPERLINK_SETLINK> aItemSet( SfxGetpApp()->GetPool() ); SvxHyperlinkTabPageBase* pCurrentPage = static_cast<SvxHyperlinkTabPageBase*>( GetTabPage( GetCurPageId() ) ); - if ( pCurrentPage->AskApply() ) + // tdf#109390: only show warning that the dialog was not filled properly + // if the user pressed Apply + if ( pCurrentPage->AskApply( bWarn ) ) { pCurrentPage->FillItemSet( &aItemSet ); @@ -205,7 +207,7 @@ void SvxHpLinkDlg::Apply() /// Click on OK button IMPL_LINK_NOARG(SvxHpLinkDlg, ClickOkHdl_Impl, weld::Button&, void) { - Apply(); + Apply( false ); m_xDialog->response(RET_OK); } @@ -216,7 +218,7 @@ IMPL_LINK_NOARG(SvxHpLinkDlg, ClickOkHdl_Impl, weld::Button&, void) |************************************************************************/ IMPL_LINK_NOARG(SvxHpLinkDlg, ClickApplyHdl_Impl, weld::Button&, void) { - Apply(); + Apply( true ); } /************************************************************************* diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx index 8cf22584aa9a..980a10d8c225 100644 --- a/cui/source/dialogs/hldocntp.cxx +++ b/cui/source/dialogs/hldocntp.cxx @@ -241,11 +241,11 @@ void SvxHyperlinkNewDocTp::SetInitFocus() |* Ask page whether an insert is possible |* \************************************************************************/ -bool SvxHyperlinkNewDocTp::AskApply() +bool SvxHyperlinkNewDocTp::AskApply( bool bShowWarning ) { INetURLObject aINetURLObject; bool bRet = ImplGetURLObject(m_xCbbPath->get_active_text(), m_xCbbPath->GetBaseURL(), aINetURLObject); - if ( !bRet ) + if ( !bRet && bShowWarning ) { std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(mpDialog->getDialog(), VclMessageType::Warning, VclButtonsType::Ok, diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx index 820d34a3eb6b..abd707422aa3 100644 --- a/cui/source/dialogs/hltpbase.cxx +++ b/cui/source/dialogs/hltpbase.cxx @@ -293,7 +293,7 @@ void SvxHyperlinkTabPageBase::DoApply () } // Ask page whether an insert is possible -bool SvxHyperlinkTabPageBase::AskApply () +bool SvxHyperlinkTabPageBase::AskApply ( bool /* bShowWarning */ ) { // default-implementation return true; diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx index b43361edfea1..fc94a2c973ef 100644 --- a/cui/source/inc/cuihyperdlg.hxx +++ b/cui/source/inc/cuihyperdlg.hxx @@ -106,7 +106,8 @@ private: void Activate() override; virtual void Close() override; - void Apply(); + void Apply( bool bWarn ); + bool AskApply (bool bShowWarning); public: SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window* pParent); diff --git a/cui/source/inc/hldocntp.hxx b/cui/source/inc/hldocntp.hxx index 95a11dd9f1fc..7e153d6912c3 100644 --- a/cui/source/inc/hldocntp.hxx +++ b/cui/source/inc/hldocntp.hxx @@ -52,7 +52,7 @@ public: static std::unique_ptr<IconChoicePage> Create(weld::Container* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); - virtual bool AskApply () override; + virtual bool AskApply ( bool bShowWarning ) override; virtual void DoApply () override; virtual void SetInitFocus() override; diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx index 2ad0007c83cb..0bfb7dfcf526 100644 --- a/cui/source/inc/hltpbase.hxx +++ b/cui/source/inc/hltpbase.hxx @@ -105,7 +105,7 @@ public: mxDocumentFrame = rxDocumentFrame; } - virtual bool AskApply (); + virtual bool AskApply ( bool bShowWarning ); virtual void DoApply (); virtual void SetInitFocus(); virtual void SetMarkStr ( const OUString& aStrMark );