mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 237944 - The name of Bookmark dragged from IE is the same as URL, r=enn sr=roc
This commit is contained in:
parent
c6e75460e0
commit
a320d71605
@ -758,16 +758,27 @@ nsClipboard :: FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, v
|
||||
const nsDependentString filepath(static_cast<PRUnichar*>(*outData));
|
||||
nsCOMPtr<nsILocalFile> file;
|
||||
nsresult rv = NS_NewLocalFile(filepath, PR_TRUE, getter_AddRefs(file));
|
||||
if (NS_FAILED(rv))
|
||||
if (NS_FAILED(rv)) {
|
||||
nsMemory::Free(*outData);
|
||||
return dataFound;
|
||||
}
|
||||
|
||||
if ( IsInternetShortcut(filepath) ) {
|
||||
nsMemory::Free(*outData);
|
||||
nsCAutoString url;
|
||||
ResolveShortcut( file, url );
|
||||
if ( !url.IsEmpty() ) {
|
||||
// convert it to unicode and pass it out
|
||||
nsMemory::Free(*outData);
|
||||
*outData = UTF8ToNewUnicode(url);
|
||||
nsDependentString urlString(UTF8ToNewUnicode(url));
|
||||
// the internal mozilla URL format, text/x-moz-url, contains
|
||||
// URL\ntitle. We can guess the title from the file's name.
|
||||
nsAutoString title;
|
||||
file->GetLeafName(title);
|
||||
// We rely on IsInternetShortcut check that file has a .url extension.
|
||||
title.SetLength(title.Length() - 4);
|
||||
if (title.IsEmpty())
|
||||
title = urlString;
|
||||
*outData = ToNewUnicode(urlString + NS_LITERAL_STRING("\n") + title);
|
||||
*outDataLen = nsCRT::strlen(static_cast<PRUnichar*>(*outData)) * sizeof(PRUnichar);
|
||||
|
||||
dataFound = PR_TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user