summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorKatarina Behrens <bubli@bubli.org>2022-01-28 18:03:58 +0100
committerKatarina Behrens <bubli@bubli.org>2022-01-29 09:58:54 +0100
commit4bb0ffa4684dada708ecdf727f4fc9f500a9bced (patch)
treeefad9c34d228889b7e6ee03a8be3ccb4d7f2954d /sfx2
parented79bc866bf5fee5037ceb55f582d10807244164 (diff)
tdf#122708: on GetFocus, select something also when items are filtered
Previously if nothing was selected, we picked item with ID 1 to select/highlight. But if a filter is active, such item may not match the active filter (case in point: document template no. 1 matches 'Writer templates' filter, but not 'Impress templates' one) Try harder to find an item to select by looking at the list of filtered items too Change-Id: I9cb053b884dc724c7a6199ec002d83024ed83976 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129117 Tested-by: Jenkins Reviewed-by: Katarina Behrens <bubli@bubli.org>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/control/thumbnailview.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 37043f8767c0..3e85c4c911fc 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -924,7 +924,14 @@ void ThumbnailView::GetFocus()
if (nSelected == -1 && !mItemList.empty())
{
- SelectItem(1);
+ ThumbnailViewItem* pFirst = nullptr;
+ if (!mFilteredItemList.empty()) {
+ pFirst = mFilteredItemList[0];
+ } else {
+ pFirst = mItemList[0].get();
+ }
+
+ SelectItem(pFirst->mnId);
}
}