tdf#128748 replace warning dialog with tooltip
so the TreeList does not get the mouse release it expects stolen
from it by the dialog, leaving it stuck in "selecting" limbo
Change-Id: If83dcdd8697b2a67e67fb062ae65ad947f49e8cd
Reviewed-on: https://gerrit.libreoffice.org/83375
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx
index 448676f..526af7c 100644
--- a/dbaccess/source/ui/dlg/paramdialog.cxx
+++ b/dbaccess/source/ui/dlg/paramdialog.cxx
@@ -144,10 +144,10 @@ namespace dbaui
IMPL_LINK_NOARG(OParameterDialog, OnValueLoseFocusHdl, weld::Widget&, void)
{
CheckValueForError(false);
CheckValueForError();
}
bool OParameterDialog::CheckValueForError(bool bShowDialog)
bool OParameterDialog::CheckValueForError()
{
if (m_nCurrentlySelected != -1)
{
@@ -156,6 +156,8 @@ namespace dbaui
return false;
}
bool bRet = false;
Reference< XPropertySet > xParamAsSet;
m_xParams->getByIndex(m_nCurrentlySelected) >>= xParamAsSet;
if (xParamAsSet.is())
@@ -166,6 +168,7 @@ namespace dbaui
bool bValid = m_aPredicateInput.normalizePredicateString( sParamValue, xParamAsSet );
m_xParam->set_text(sParamValue);
m_xParam->set_message_type(bValid ? weld::EntryMessageType::Normal : weld::EntryMessageType::Error);
OUString sToolTip;
if ( bValid )
{
// with this the value isn't dirty anymore
@@ -184,22 +187,16 @@ namespace dbaui
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
if (bShowDialog)
{
OUString sMessage(DBA_RES(STR_COULD_NOT_CONVERT_PARAM));
sMessage = sMessage.replaceAll( "$name$", sName );
std::unique_ptr<weld::MessageDialog> xDialog(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::Ok,
sMessage));
xDialog->run();
m_xParam->grab_focus();
}
return true;
OUString sMessage(DBA_RES(STR_COULD_NOT_CONVERT_PARAM));
sToolTip = sMessage.replaceAll( "$name$", sName );
m_xParam->grab_focus();
bRet = true;
}
m_xParam->set_tooltip_text(sToolTip);
}
}
return false;
return bRet;
}
IMPL_LINK(OParameterDialog, OnButtonClicked, weld::Button&, rButton, void)
@@ -280,7 +277,7 @@ namespace dbaui
if (m_nCurrentlySelected != -1)
{
// do the transformation of the current text
if (CheckValueForError(true))
if (CheckValueForError())
{ // there was an error interpreting the text
m_xAllParams->select(m_nCurrentlySelected);
return true;
diff --git a/dbaccess/source/ui/inc/paramdialog.hxx b/dbaccess/source/ui/inc/paramdialog.hxx
index 5a434e4..bf3f453 100644
--- a/dbaccess/source/ui/inc/paramdialog.hxx
+++ b/dbaccess/source/ui/inc/paramdialog.hxx
@@ -98,7 +98,7 @@ namespace dbaui
DECL_LINK(OnEntryListBoxSelected, weld::TreeView&, void);
DECL_LINK(OnButtonClicked, weld::Button&, void);
DECL_LINK(OnValueLoseFocusHdl, weld::Widget&, void);
bool CheckValueForError(bool bShowDialog);
bool CheckValueForError();
bool OnEntrySelected();
};