dbaccess/source/ui/dlg/indexdialog.cxx | 22 +++++++++++++++++++--- dbaccess/source/ui/inc/indexdialog.hxx | 3 ++- 2 files changed, 21 insertions(+), 4 deletions(-)
New commits: commit 8e7679cb34f587d08d2485f6aee1b85fdbf2d699 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Oct 3 11:46:44 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Oct 3 13:44:15 2019 +0200 fix DbaIndexDialog EditingActive Change-Id: I7f0fe341fef08358d71b13e646065b26f8a73951 Reviewed-on: https://gerrit.libreoffice.org/80114 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/dbaccess/source/ui/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx index 4bf1dc2c1f75..072c507e4da7 100644 --- a/dbaccess/source/ui/dlg/indexdialog.cxx +++ b/dbaccess/source/ui/dlg/indexdialog.cxx @@ -72,6 +72,7 @@ namespace dbaui const Reference< XComponentContext >& _rxContext) : GenericDialogController(pParent, "dbaccess/ui/indexdesigndialog.ui", "IndexDesignDialog") , m_xConnection(_rxConnection) + , m_bEditingActive(false) , m_bEditAgain(false) , m_bNoHandlerCall(false) , m_xContext(_rxContext) @@ -145,7 +146,7 @@ namespace dbaui void DbaIndexDialog::updateToolbox() { - m_xActions->set_item_sensitive("ID_INDEX_NEW", true); + m_xActions->set_item_sensitive("ID_INDEX_NEW", !m_bEditingActive); int nSelected = m_xIndexList->get_selected_index(); bool bSelectedAnything = nSelected != -1; @@ -426,6 +427,17 @@ namespace dbaui IMPL_LINK_NOARG(DbaIndexDialog, OnCloseDialog, weld::Button&, void) { + if (m_bEditingActive) + { + OSL_ENSURE(!m_bEditAgain, "DbaIndexDialog::OnCloseDialog: somebody was faster than hell!"); + // this means somebody entered a new name, which was invalid, which cause us to posted us an event, + // and before the event arrived the user clicked onto "close". VERY fast, this user... + m_xIndexList->end_editing(); + if (m_bEditAgain) + // could not commit the new name (started a new - asynchronous - edit trial) + return; + } + // the currently selected entry std::unique_ptr<weld::TreeIter> xSelected(m_xIndexList->make_iterator()); // the selected index @@ -471,13 +483,16 @@ namespace dbaui delete pEntry; } - IMPL_STATIC_LINK_NOARG(DbaIndexDialog, OnEntryEditing, const weld::TreeIter&, bool) + IMPL_LINK_NOARG(DbaIndexDialog, OnEntryEditing, const weld::TreeIter&, bool) { + m_bEditingActive = true; return true; } IMPL_LINK(DbaIndexDialog, OnEntryEdited, const IterString&, rIterString, bool) { + m_bEditingActive = false; + const weld::TreeIter& rEntry = rIterString.first; OUString sNewName = rIterString.second; @@ -647,7 +662,8 @@ namespace dbaui void DbaIndexDialog::IndexSelected() { -//TODO m_xIndexList->EndSelection(); + if (m_bEditingActive) + m_xIndexList->end_editing(); std::unique_ptr<weld::TreeIter> xSelected(m_xIndexList->make_iterator()); if (!m_xIndexList->get_selected(xSelected.get())) diff --git a/dbaccess/source/ui/inc/indexdialog.hxx b/dbaccess/source/ui/inc/indexdialog.hxx index eda10e99c695..1ed17eac2d49 100644 --- a/dbaccess/source/ui/inc/indexdialog.hxx +++ b/dbaccess/source/ui/inc/indexdialog.hxx @@ -40,6 +40,7 @@ namespace dbaui std::unique_ptr<OIndexCollection> m_xIndexes; std::unique_ptr<weld::TreeIter> m_xPreviousSelection; + bool m_bEditingActive; bool m_bEditAgain; bool m_bNoHandlerCall; @@ -77,7 +78,7 @@ namespace dbaui DECL_LINK( OnIndexSelected, weld::TreeView&, void ); DECL_LINK( OnIndexAction, const OString&, void ); - DECL_STATIC_LINK(DbaIndexDialog, OnEntryEditing, const weld::TreeIter&, bool); + DECL_LINK( OnEntryEditing, const weld::TreeIter&, bool ); DECL_LINK( OnEntryEdited, const IterString&, bool ); DECL_LINK( OnModifiedClick, weld::Button&, void ); DECL_LINK( OnModified, IndexFieldsControl&, void ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits