Bug 427363 - Filter support for exclude
Summary: Filter support for exclude
Status: CONFIRMED
Alias: None
Product: dolphin
Classification: Applications
Component: bars: filter (other bugs)
Version First Reported In: 20.08.1
Platform: Manjaro Linux
: LO wishlist
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-05 14:20 UTC by Kristen McWilliam
Modified: 2024-12-05 15:42 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kristen McWilliam 2020-10-05 14:20:37 UTC
SUMMARY
When using the filter in Dolphin `Ctrl` + `I`, it should support a simple exclude like many are used to in search, like `-exclude_term`.


Example directory:

    Folder
    ├── doc2.assets
    ├── doc2.md
    ├── doc.assets
    └── doc.md


STEPS TO REPRODUCE
1. Filter: `-*.assets`


OBSERVED RESULT
Actual: blank results (all items filtered)


EXPECTED RESULT
    Folder
    ├── doc2.md
    └── doc.md


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.4.67-1-MANJARO
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1


ADDITIONAL INFORMATION
This is the form many are already used to from searching with things like Google and would be very nice to support in Dolphin.
Comment 1 Elvis Angelaccio 2020-10-05 20:55:56 UTC
Currently the filter bar uses the Qt regex engine which in turn is Perl regexes.

This would require switching to another filter engine which supports that kind of syntax.
Comment 2 Romain D. 2023-01-28 15:08:58 UTC
> This would require switching to another filter engine which supports that kind of syntax.

Or could the feature perhaps look like a "mode" for the filter bar, where the same regex engine is being used, but its result are negated?
Comment 3 Tuncay 2024-11-20 22:12:53 UTC
(In reply to Elvis Angelaccio from comment #1)
> This would require switching to another filter engine which supports that
> kind of syntax.

For exclusion rather than inclusion of the regex, there is no need to switch the engine. You have the full list of files and the filtered one. You only need to remove the filtered ones from the full list, to get the exclude list. In example:

1. Unfiltered
Filter:
    Folder
    ├── doc2.assets
    ├── doc2.md
    ├── doc.assets
    └── doc.md

2. Filtered
Filter: *.assets
    Folder
    ├── doc2.assets
    └── doc.assets

Take the Unfiltered list, then remove every file from the Filtered list. Voila you get the Excluded list:

3. Excluded
Filter: !*.assets
    Folder
    ├── doc2.md
    └── doc.md
Comment 4 TraceyC 2024-12-05 15:42:52 UTC
This seems reasonable
The code can be made to translate "-exclude" so that the Perl regex would do the right thing