summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-10-03 11:46:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-10-03 13:44:15 +0200
commit8e7679cb34f587d08d2485f6aee1b85fdbf2d699 (patch)
tree475c51995e2244bfde24463750ab5c9ddf044c70 /dbaccess
parent522eb21e2d66550850b152c37255857b54ad36d7 (diff)
fix DbaIndexDialog EditingActive
Change-Id: I7f0fe341fef08358d71b13e646065b26f8a73951 Reviewed-on: https://gerrit.libreoffice.org/80114 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx22
-rw-r--r--dbaccess/source/ui/inc/indexdialog.hxx3
2 files changed, 21 insertions, 4 deletions
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 );