Re: Drag&Drop to OSX desktop

Christian Pernot <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
Le 22/11/2012 14:36, Neil Deakin a écrit :
> On 2012-11-22 6:03 AM, Christian Pernot wrote:
>> Hi,
>>
>> in a xulrunner application, we have drag&drop from distant files to the
>> user file manager or application.
>>
>> It works well on windows and linux (kde at least), but nothing happens
>> on OSX. Is there a special flavor for it ?
>> We use xulrunner 15.
>>
>> Here is the part of the code:
>>
>> ###########
>>
>> event.dataTransfer.setData("text/x-moz-url", url + "\n" + filename);
>> event.dataTransfer.setData("text/x-moz-url-data", url);
>> event.dataTransfer.setData("text/uri-list", url);
>> event.dataTransfer.setData("text/x-moz-url-desc", filename);
>> event.dataTransfer.setData("application/x-moz-file-promise-url", url);
>> event.dataTransfer.setData("application/x-moz-file-promise-dest-filename",
>>
>> filename);
>> event.dataTransfer.setData("application/x-moz-file-promise", null);
>> event.dataTransfer.effectAllowed = "copyMove";
>>
>
> Are you intentionally trying to use file promises? This should be used
> when the file does not exist. But since you pass null for the
> x-moz-file-promise type, this won't actually do anything.
>
> The code above actually starts a drag for a url.
>
> You may want to read over
> https://developer.mozilla.org/en-US/docs/DragDrop/Recommended_Drag_Types
> for help.
>
>
I used 
https://developer.mozilla.org/en-US/docs/DragDrop/Recommended_Drag_Types#Dragging_files_to_an_operating_system_folder 
but if I remember well, using something else than null for 
application/x-moz-file-promise made the transfer to fail.

Actually this code works well on windows and linux.

If I remove the file-promises data, it will only drag a url link.
I need to download the real file that is on the server, and not the 
picture thumbnail.
The idea is to give the system the informations to start the download 
itself. If I strictly follow the page on MDN, I should make the copy myself.

Maybe I don't do it right, but it's only OSX that refuses my code :)

Thank you
_______________________________________________
dev-tech-xul mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.