зеркало из https://github.com/mozilla/gecko-dev.git
Bug 846765 - Dragging from Downloads window and dropping in Finder creates weird shortcut. r=BenWa
This commit is contained in:
Родитель
a5fb99687b
Коммит
1fbeffb203
|
@ -471,6 +471,38 @@ nsClipboard::PasteboardDictFromTransferable(nsITransferable* aTransferable)
|
|||
if (tiffData)
|
||||
CFRelease(tiffData);
|
||||
}
|
||||
else if (flavorStr.EqualsLiteral(kFileMime)) {
|
||||
uint32_t len = 0;
|
||||
nsCOMPtr<nsISupports> genericFile;
|
||||
rv = aTransferable->GetTransferData(flavorStr, getter_AddRefs(genericFile), &len);
|
||||
if (NS_FAILED(rv)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> file(do_QueryInterface(genericFile));
|
||||
if (!file) {
|
||||
nsCOMPtr<nsISupportsInterfacePointer> ptr(do_QueryInterface(genericFile));
|
||||
|
||||
if (ptr) {
|
||||
ptr->GetData(getter_AddRefs(genericFile));
|
||||
file = do_QueryInterface(genericFile);
|
||||
}
|
||||
}
|
||||
|
||||
if (!file) {
|
||||
continue;
|
||||
}
|
||||
|
||||
nsAutoString fileURI;
|
||||
rv = file->GetPath(fileURI);
|
||||
if (NS_FAILED(rv)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString* str = nsCocoaUtils::ToNSString(fileURI);
|
||||
NSArray* fileList = [NSArray arrayWithObjects:str, nil];
|
||||
[pasteboardOutputDict setObject:fileList forKey:NSFilenamesPboardType];
|
||||
}
|
||||
else if (flavorStr.EqualsLiteral(kFilePromiseMime)) {
|
||||
[pasteboardOutputDict setObject:[NSArray arrayWithObject:@""] forKey:NSFilesPromisePboardType];
|
||||
}
|
||||
|
|
|
@ -115,7 +115,8 @@ static nsresult SetUpDragClipboard(nsISupportsArray* aTransferableArray)
|
|||
else if (currentKey == NSTIFFPboardType) {
|
||||
[dragPBoard setData:currentValue forType:currentKey];
|
||||
}
|
||||
else if (currentKey == NSFilesPromisePboardType) {
|
||||
else if (currentKey == NSFilesPromisePboardType ||
|
||||
currentKey == NSFilenamesPboardType) {
|
||||
[dragPBoard setPropertyList:currentValue forType:currentKey];
|
||||
}
|
||||
}
|
||||
|
@ -382,9 +383,7 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex)
|
|||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsISupports> genericDataWrapper;
|
||||
genericDataWrapper = do_QueryInterface(file);
|
||||
aTransferable->SetTransferData(flavorStr, genericDataWrapper, dataLength);
|
||||
aTransferable->SetTransferData(flavorStr, file, dataLength);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче