[Libreoffice-commits] core.git: sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 7 13:22:12 UTC 2020
sw/source/ui/dbui/addresslistdialog.cxx | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit 403776b17706107001d49cf5eed3c4415c4d8b9d
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 7 09:13:22 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu May 7 15:21:21 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>
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 977a81addb2b..77291826ebb0 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -161,6 +161,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent)
bool bEnableEdit = false;
bool bEnableOK = true;
+ bool bSelected = false;
m_xListLB->unselect_all();
SwDBConfig aDb;
@@ -178,6 +179,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();
@@ -203,7 +205,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