summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-05-07 09:13:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-05-07 15:21:21 +0200
commit403776b17706107001d49cf5eed3c4415c4d8b9d (patch)
treea0d984cf6373c40dc607bd9f5fb845dbda341365 /sw/source/ui
parentfd1a4fddad5932c514199de0f8a7b5a2f82ce437 (diff)
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@redhat.com>
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx7
1 files changed, 6 insertions, 1 deletions
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);