summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorKatarina Behrens <bubli@bubli.org>2022-01-28 18:03:58 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-02-01 20:39:05 +0100
commit3b79c7347d14756e072265b39081bc3866e1196d (patch)
tree5f98c31818790f32b12d6080050234f54d8fac6c /sfx2
parent290957ad1383565c97201360defdeae9ae5ef502 (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> (cherry picked from commit 4bb0ffa4684dada708ecdf727f4fc9f500a9bced) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129081 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
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 04de9a437550..217694520427 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -923,7 +923,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);
}
}