Fix bugs 113745, 113742 and 114811: all regarding "moz-icon:". Fix up XP_MAC code to use Mac OS's Icon Services, and expose platform icons in file:/// display and search panel (and search preferences panel). Mixture of r/srs: sdagley, ben, and smfr

This commit is contained in:
rjc%netscape.com 2007-09-06 22:01:14 +00:00
Родитель dc478c6203
Коммит 6219c60c09
1 изменённых файлов: 23 добавлений и 14 удалений

Просмотреть файл

@ -3771,24 +3771,33 @@ InternetSearchDataSource::SaveEngineInfoIntoGraph(nsIFile *file, nsIFile *icon,
if (!searchRes) return(NS_ERROR_UNEXPECTED); if (!searchRes) return(NS_ERROR_UNEXPECTED);
if (!categoryRes) return(NS_ERROR_UNEXPECTED); if (!categoryRes) return(NS_ERROR_UNEXPECTED);
nsAutoString iconURL;
if (icon) if (icon)
{ {
nsXPIDLCString iconPath; nsXPIDLCString iconFileURL;
icon->GetPath(getter_Copies(iconPath)); if (NS_FAILED(rv = icon->GetURL(getter_Copies(iconFileURL))))
nsFileSpec iconSpec((const char *)iconPath); return(rv);
nsFileURL iconFileURL(iconSpec); iconURL.AssignWithConversion(iconFileURL);
nsAutoString iconURL; }
iconURL.AssignWithConversion(iconFileURL.GetURLString()); #ifdef XP_MAC
else if (file)
{
nsXPIDLCString fileURL;
if (NS_FAILED(rv = file->GetURL(getter_Copies(fileURL))))
return(rv);
iconURL.Assign(NS_LITERAL_STRING("moz-icon:"));
iconURL.AppendWithConversion(fileURL);
}
#endif
// save icon url (if we have one) // save icon url (if we have one)
if (iconURL.Length() > 0) if (iconURL.Length() > 0)
{
nsCOMPtr<nsIRDFLiteral> iconLiteral;
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(iconURL.get(),
getter_AddRefs(iconLiteral))))
{ {
nsCOMPtr<nsIRDFLiteral> iconLiteral; updateAtom(mInner, searchRes, kNC_Icon, iconLiteral, nsnull);
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(iconURL.get(),
getter_AddRefs(iconLiteral))))
{
updateAtom(mInner, searchRes, kNC_Icon, iconLiteral, nsnull);
}
} }
} }