Re: Dragging webloc URLs
Christiaan Hofman <[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Jan 21, 2010, at 1:46, David Dunham wrote: > On 20 Jan 2010, at 16:01, Christiaan Hofman wrote: > >> In the past, it was possible to drag .webloc files from Finder and drop them in various applications. The pasteboard flavor on the pasteboard holding the URL referenced by the .webloc was 'url', corresponding to (NS) pasteboard type "CorePasteboardFlavorType 0x75726C20". This can be very useful, because it allows you to drag URLs e.g. from Safari to another app in a 2-step process, because you can't always drag directly to the receiving app. >> >> However, in SL this does not work anymore, the 'url' flavor is not put on the pasteboard anymore by Finder. >> >> So my question is whether anybody knows whether there's any replacement for this rather useful feature? Or is this a bug? > > > The URL types I handle in Opal are "WebURLsWithTitlesPboardType" and "public.url" -- not entirely sure what they correspond to in what version of the OS. (I think the former is from Safari, and I added public.url a couple years ago, probably 10.5 time frame.) That's another thing, about the opposite direction (dragging URLs from our app to Finder). WebURLsWithTitlesPboardType is not accepted by Finder anymore (I seem to recall this worked). Of course that one was never documented. Currently the only way to drag multiple URLs seems to be the new pasteboard API, but that's not compatible with 10.5 and therefore not acceptable to me. Or using Core Pasteboard, but that's not compatible with NSPasteboard. BTW, "public.url" = kUTTypeURL. Another useful one is "public.url-name", which is like the titles in "WebURLsWithTitlesPboardType", I don't know why Apple does not document that (and define a kUTTypeURLName). > I'm getting something useful when I drag in a .webloc file, but I don't know what type is being used. > > David Dunham A Sharp, LLC It seems to depend on the webloc. I always get the file path and URL for the .webloc file (typically in NSFilenamesPboardType and "public.file-url", as well as some 'shadow' ones). Only sometimes do I get "CorePasteboardFlavorType 0x75726C20", which is the flavor name for 4-char code 'url ', which contains the target URL as a string. Sometimes I also get the target URL in "public.url". But again, most of the time I don't get the target URL at all anymore, big regression. Christiaan