Bug 475163

Summary: [Feature] Search in folder names in addition to file names
Product: [Applications] lokalize Reporter: Yaron Shahrabani <sh.yaron>
Component: project managementAssignee: Simon Depiets <sdepiets>
Status: RESOLVED FIXED    
Severity: wishlist CC: aacid, karl, shafff
Priority: NOR    
Version: 23.08.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Yaron Shahrabani 2023-10-03 07:03:08 UTC
I was browsing through the list of files and folders in a project and I wanted to search for folders starting with plasma to translate first but the quick search is also filtering the names of the files so if there's a file called kcm_disks.po inside a folder called plasma-disks it doesn't appear.

Thank you.
Comment 1 Karl Ove Hufthammer 2024-07-28 19:04:26 UTC
I also find this annoying. I think the problem is that the search *only* looks at the filenames, not the folder names. One solution would be checkboxes for searching in either files or folders, but I think a better solution would be to just prefix the file names with the names of the folder(s) when doing the search (and separating (sub)folders by / characters). So for the file

foo/bar/baz.po

a search for either ‘foo’, ‘bar’ or ‘baz’ should display the file.

Since the search string is a regexp, we can easily modify the search to search in just the folder or the file name. Example:

ark/ark.po
ark/ark_json_.po
arkade/foo.po
keditbookmarks/keditbookmarks.po

A search for ‘ark’ would match all four files.
A search for ‘^ark’ would match the first three files.
A search for ‘ark/’ would match the first two files.
Comment 2 Bug Janitor Service 2024-10-18 01:52:53 UTC
A possibly relevant merge request was started @ https://invent.kde.org/sdk/lokalize/-/merge_requests/162
Comment 3 Albert Astals Cid 2024-10-21 20:56:05 UTC
Git commit d61f228f94b690589d496bd9d924e023797cb0ec by Albert Astals Cid, on behalf of Finley Watson.
Committed on 21/10/2024 at 20:56.
Pushed by aacid into branch 'master'.

Search across full relative paths of files and dirs in Project Overview

When using the search in Project Overview, if any part of the relative 
path from the project root to the file / dir matches, then the item is 
included in the search results: for a project with a tree containing 
'foo/bar.po', searching 'foo' will display 'foo/bar.po' and so will 
searching 'bar' or 'o/b' etc. This works into subdirectories, and 
also supports wildcards e.g. 'fo*.po' for our example above.

There are two other changes as well: enable alternating row colours 
because this is standard for other parts of Lokalize, and collapse 
directories when the search string is fewer than 3 characters, since 
we were already expanding directories by default for 3 or more chars.

M  +19   -14   src/project/projecttab.cpp
M  +9    -0    src/project/projecttab.h
M  +18   -31   src/project/projectwidget.cpp
M  +33   -5    src/project/projectwidget.h

https://invent.kde.org/sdk/lokalize/-/commit/d61f228f94b690589d496bd9d924e023797cb0ec