[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 19 08:09:29 UTC 2020
sw/source/ui/dbui/addresslistdialog.cxx | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit 1f31f36fb92befc66f507d45f8a020f89f49e93b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 7 09:13:22 2020 +0100
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Tue May 19 10:08:57 2020 +0200
Related: tdf#132678 select first entry if nothing else selected
Change-Id: I94fae0f774c587d85e682414f5d54f35f0161c30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93614
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit 403776b17706107001d49cf5eed3c4415c4d8b9d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94270
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 1f982922f85e..8c2e5780348b 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -166,6 +166,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent)
bool bEnableEdit = false;
bool bEnableOK = true;
+ bool bSelected = false;
m_xListLB->unselect_all();
SwDBConfig aDb;
@@ -183,6 +184,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent)
if (rName == rCurrentData.sDataSource)
{
m_xListLB->select(*m_xIter);
+ bSelected = true;
m_xListLB->set_text(*m_xIter, rCurrentData.sCommand, 1);
pUserData->nCommandType = rCurrentData.nCommandType;
pUserData->xSource = rConfigItem.GetSource();
@@ -208,7 +210,10 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent)
}
}
- m_xOK->set_sensitive(m_xListLB->n_children() > 0 && bEnableOK);
+ bool bHasChildren = m_xListLB->n_children() > 0;
+ if (bHasChildren && !bSelected)
+ m_xListLB->select(0); // select the first entry if nothing else selected
+ m_xOK->set_sensitive(bHasChildren && bEnableOK);
m_xEditPB->set_sensitive(bEnableEdit);
m_xRemovePB->set_sensitive(m_xListLB->n_children() > 0);
m_xFilterPB->set_sensitive(m_xListLB->n_children() > 0);
More information about the Libreoffice-commits
mailing list