Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

drag promised files to Finder



Hello,

I'm using Trolltech's Qt library, which is based on Carbon.
Qt's drag & drop support is based on the Pasteboard Manager (and not the Drag
Manager!). Unfortunately, dragging of "virtual files" from your application to
Finder is not (yet?) supported in Qt, which is why I'm trying to improve this.

Apple explains how to use flavorTypePromiseHFS to do this using the Drag
Manager in Technical Note TN1085:
http://developer.apple.com/technotes/tn/tn1085.html

Here is what I'm actually doing:
1) creating pasteboard and so on + using PasteboardSetPromiseKeeper() to
   register the promise keeper callback function.
2) adding PromiseHFSFlavor item flavor, like this:

   PromiseHFSFlavor flavor;
   flavor.fileType       = 0;
   flavor.fileCreator    = 0;
   flavor.fdFlags        = 0;
   flavor.promisedFlavor = kDragPromisedFlavor;
   CFDataRef data = CFDataCreate(0, (const UInt8*)&flavor, sizeof(flavor));
   OSStatus err = PasteboardPutItemFlavor(
                    pasteboard, 0,
                    UTCreateStringForOSType(flavorTypePromiseHFS),
                    data, kPasteboardFlavorNoFlags);

3) adding kDragPromisedFlavor item flavor, like this:

   PasteboardPutItemFlavor(pasteboard, 0,
                           kDragPromisedFlavor, 0, kPasteboardFlavorNoFlags);

   (2) and (3) are in fact implemented as suggested in TN1085.

4) the promise callback is then properly called when dropping the file to the
   Finder, and in the callback here is what I'm doing:

   CFURLRef url = NULL;
   OSStatus err = PasteboardCopyPasteLocation(pasteboard, &url);

   However, here, PasteboardCopyPasteLocation() returns badPasteboardFlavorErr!

So my questions are:

- why is PasteboardCopyPasteLocation() not returning me the destination were to
  create my promised file?
- more generally, is TN1085 applicable to the Pasteboard Manager, or are Drag
  Manager and Pasteboard Manager totally different beasts ? Also, is is
  supported by the Finder itself?
- finally, I did not find any UTI for flavorTypePromiseHFS in
http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/utilist/chapter_4_section_1.html
  so it's why I used UTCreateStringForOSType with the flavorTypePromiseHFS
  constant. Perheaps is there a well defined UTI for file promises?


Best regards,

--
Eric Landuyt, Developer - mailto:email@hidden
DataRescue sa/nv, Home of the IDA Pro Disassembler - http://www.datarescue.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.