mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 567377 - Support drag and drop for Linux. r=mak77
This commit is contained in:
parent
4ab0bcd6c5
commit
de4a6659f1
@ -750,6 +750,9 @@ const DownloadsView = {
|
||||
let dataTransfer = aEvent.dataTransfer;
|
||||
dataTransfer.mozSetDataAt("application/x-moz-file", localFile, 0);
|
||||
dataTransfer.effectAllowed = "copyMove";
|
||||
var url = Services.io.newFileURI(localFile).spec;
|
||||
dataTransfer.setData("text/uri-list", url);
|
||||
dataTransfer.setData("text/plain", url);
|
||||
dataTransfer.addElement(element);
|
||||
|
||||
aEvent.stopPropagation();
|
||||
|
@ -522,6 +522,12 @@ const DownloadsIndicatorView = {
|
||||
|
||||
onDrop: function DIV_onDrop(aEvent)
|
||||
{
|
||||
let dt = aEvent.dataTransfer;
|
||||
// If dragged item is from our source, do not try to
|
||||
// redownload already downloaded file.
|
||||
if (dt.mozGetDataAt("application/x-moz-file", 0))
|
||||
return;
|
||||
|
||||
let name = {};
|
||||
let url = browserDragAndDrop.drop(aEvent, name);
|
||||
if (url) {
|
||||
|
@ -682,6 +682,9 @@ var gDownloadDNDObserver =
|
||||
|
||||
var dt = aEvent.dataTransfer;
|
||||
dt.mozSetDataAt("application/x-moz-file", f, 0);
|
||||
var url = Services.io.newFileURI(f).spec;
|
||||
dt.setData("text/uri-list", url);
|
||||
dt.setData("text/plain", url);
|
||||
dt.effectAllowed = "copyMove";
|
||||
dt.addElement(dl);
|
||||
},
|
||||
@ -698,6 +701,11 @@ var gDownloadDNDObserver =
|
||||
onDrop: function(aEvent)
|
||||
{
|
||||
var dt = aEvent.dataTransfer;
|
||||
// If dragged item is from our source, do not try to
|
||||
// redownload already downloaded file.
|
||||
if (dt.mozGetDataAt("application/x-moz-file", 0))
|
||||
return;
|
||||
|
||||
var url = dt.getData("URL");
|
||||
var name;
|
||||
if (!url) {
|
||||
|
@ -66,6 +66,10 @@ const DownloadData = [
|
||||
state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED}
|
||||
];
|
||||
|
||||
function compareStrFunc(actualData, expectedData) {
|
||||
return expectedData === actualData;
|
||||
}
|
||||
|
||||
function compareFunc(actualData, expectedData) {
|
||||
return expectedData.equals(actualData);
|
||||
}
|
||||
@ -73,12 +77,24 @@ function compareFunc(actualData, expectedData) {
|
||||
var dragRealFile = [[
|
||||
{ type :"application/x-moz-file",
|
||||
data : realFile,
|
||||
eqTest : compareFunc }
|
||||
eqTest : compareFunc },
|
||||
{ type : "text/uri-list",
|
||||
data : realFilePath,
|
||||
eqTest : compareStrFunc },
|
||||
{ type : "text/plain",
|
||||
data : realFilePath,
|
||||
eqTest : compareStrFunc }
|
||||
]];
|
||||
var dragMissingFile = [[
|
||||
{ type :"application/x-moz-file",
|
||||
data : missingFile,
|
||||
eqTest : compareFunc }
|
||||
eqTest : compareFunc },
|
||||
{ type : "text/uri-list",
|
||||
data : missingFilePath,
|
||||
eqTest : compareStrFunc },
|
||||
{ type : "text/plain",
|
||||
data : missingFilePath,
|
||||
eqTest : compareStrFunc }
|
||||
]];
|
||||
|
||||
function test() {
|
||||
|
Loading…
Reference in New Issue
Block a user