sc/source/ui/dbgui/dbnamdlg.cxx | 8 ++++++-- sc/source/ui/inc/dbnamdlg.hxx | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
New commits: commit a07351e8181353c0c0b6df5d2ccbad4615c6706b Author: Tünde Tóth <toth.tu...@nisz.hu> AuthorDate: Thu Jul 29 10:00:06 2021 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Mon Aug 2 21:19:36 2021 +0200 tdf#115520 sc UI: Define Database Range dialog disappeared if the name of the database range was invalid. Change-Id: If0eb08d35b2187f04ef93136acd6f7eafa3b588a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119652 Tested-by: Jenkins Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index 4939663f29b4..1043e899af6d 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -249,6 +249,7 @@ void ScDbNameDlg::Init() bSaved = true; xSaveObj->Save(); NameModifyHdl( *m_xEdName ); + bInvalid = false; } void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData ) @@ -376,17 +377,18 @@ bool ScDbNameDlg::IsRefInputMode() const IMPL_LINK_NOARG(ScDbNameDlg, OkBtnHdl, weld::Button&, void) { + bInvalid = false; AddBtnHdl(*m_xBtnAdd); // Pass the changes and the remove list to the view: both are // transferred as a reference only, so that no dead memory can // be created at this point: + if (!bInvalid) { ScDBDocFunc aFunc(*m_rViewData.GetDocShell()); aFunc.ModifyAllDBData(aLocalDbCol, aRemoveList); + response(RET_OK); } - - response(RET_OK); } IMPL_LINK_NOARG(ScDbNameDlg, CancelBtnHdl, weld::Button&, void) @@ -469,6 +471,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, weld::Button&, void) ERRORBOX(m_xDialog.get(), aStrInvalid); m_xEdAssign->SelectAll(); m_xEdAssign->GrabFocus(); + bInvalid = true; } } else @@ -476,6 +479,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, weld::Button&, void) ERRORBOX(m_xDialog.get(), ScResId(STR_INVALIDNAME)); m_xEdName->select_entry_region(0, -1); m_xEdName->grab_focus(); + bInvalid = true; } } diff --git a/sc/source/ui/inc/dbnamdlg.hxx b/sc/source/ui/inc/dbnamdlg.hxx index 01dc0aab66a9..4958f121d821 100644 --- a/sc/source/ui/inc/dbnamdlg.hxx +++ b/sc/source/ui/inc/dbnamdlg.hxx @@ -41,6 +41,7 @@ public: private: bool bSaved; + bool bInvalid; OUString aStrAdd; OUString aStrModify;