The OS X Finder previews selected documents using quicklook.
[Q] How must my app be configured to be able intercept these requests and draw the preview?
Is there any way for my app to just forward the request of one file extension to another app that already handles a similar extension?
(This would be particularly useful for previewing my Ruby dsl using the existing ruby previewer. Or .scala files using the .java previewer built into XCode, for example.)
qlmanage -p -d1 somefile.java
gives:
Testing Quick Look preview with files:
somefile.java
[DEBUG] Registering <QLGenerator Built-in 0x7fbf5b00b890> for public.image
[DEBUG] Preview test for somefile.java -- file://localhost/Users/XXX/. Content type UTI: com.sun.java-source
[DEBUG] Previewing file://localhost/Users/XXX/somefile.java. Content type UTI: com.sun.java-source. Generator used: <QLGenerator Text.qlgenerator>
[DEBUG] Loading <QLGenerator Text.qlgenerator>
[DEBUG] Previewing file://localhost/Users/XXX/somefile.java finished
Note that com.sun.java-source
conforms to public.source-code
which conforms to public.plain-text
. Any type declared as conforming to public.plain-text
will use the Text generator except if there is a more specific plugin.
The mapping file extension / content type is provided by applications (or Quick Look plugins). Look at the documentation for more info.
Notes:
public.plain-text
in your application.public.plain-text
, you'll have to write a generator yourself.