I'm adding an NSPredicateEditor to my app to allow the user to seach for specific files and categories of files.
The default NSPredicateEditor template from Inteface Builder adds a control containing only "name", "address", and "sign" categories. I'm looking for more specific categories.
I know that I can add menu items to these menus in Interface Builder, but I would greatly prefer not to maintain a list myself of all of the various categories and values for file searches.
In Finder, a great variety of categories and values can be added to searches.
Using saving this search then using "Get Info" on the saved seach folder reveals the predicate used to generate the Finder's NSPredicateEditor:
((** = "this*"cdw) &&
(kMDItemContentTypeTree = "public.png"cd) &&
InRange(kMDItemLastUsedDate,$time.today(-2d),$time.today(+1d)) &&
InRange(kMDItemContentModificationDate,$time.today(-4d),$time.today(+1d)) &&
InRange(kMDItemContentCreationDate,$time.today(-8d),$time.today(+1d)) &&
(kMDItemDisplayName = "*screenshot*"cd) && (kMDItemTextContent = "content*"cdw))
Clicking the "Other" category type brings up a menu with a wide variety of even more specific categories.
My question is if this same complicated and customized NSPredicateEditor from Finder be added "for free" to my app? Or will I need to declare and then maintain a list of all of the search types my app supports?
No, this
NSRuleEditor
is part of the app Finder.Yes, with a few extra's. A similar editor is in the Open/Save File panel.