зеркало из https://github.com/mozilla/gecko-dev.git
Support importing of NetPositive bookmarks under the BeOS.
This commit is contained in:
Родитель
00ad4167a9
Коммит
6ce744dcaf
|
@ -1928,10 +1928,16 @@ nsBookmarksService::ReadBookmarks()
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
PRBool foundIERoot = PR_FALSE;
|
PRBool foundIERoot = PR_FALSE;
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
nsCOMPtr<nsIRDFResource> ieFolder;
|
nsCOMPtr<nsIRDFResource> ieFolder;
|
||||||
char *ieFavoritesURL = nsnull;
|
char *ieFavoritesURL = nsnull;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef XP_BEOS
|
||||||
|
nsCOMPtr<nsIRDFResource> netPositiveFolder;
|
||||||
|
char *netPositiveURL = nsnull;
|
||||||
|
#endif
|
||||||
|
|
||||||
{ // <-- scope the stream to get the open/close automatically.
|
{ // <-- scope the stream to get the open/close automatically.
|
||||||
nsInputFileStream strm(bookmarksFile);
|
nsInputFileStream strm(bookmarksFile);
|
||||||
|
|
||||||
|
@ -1959,13 +1965,32 @@ nsBookmarksService::ReadBookmarks()
|
||||||
parser.SetIEFavoritesRoot(ieFavoritesURL);
|
parser.SetIEFavoritesRoot(ieFavoritesURL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XP_BEOS
|
||||||
|
nsSpecialSystemDirectory netPositiveFile(nsSpecialSystemDirectory::BeOS_SettingsDirectory);
|
||||||
|
nsFileURL netPositiveURLSpec(netPositiveFile);
|
||||||
|
|
||||||
|
// XXX Currently hard-coded; does the BeOS have anything like a
|
||||||
|
// system registry which we could use to get this instead?
|
||||||
|
netPositiveURLSpec += "NetPositive/Bookmarks/";
|
||||||
|
|
||||||
|
const char *constNetPositiveURL = netPositiveURLSpec.GetAsString();
|
||||||
|
if (constNetPositiveURL)
|
||||||
|
{
|
||||||
|
netPositiveURL = strdup(constNetPositiveURL);
|
||||||
|
}
|
||||||
|
parser.SetIEFavoritesRoot(netPositiveURL);
|
||||||
|
#endif
|
||||||
|
|
||||||
parser.Parse(kNC_BookmarksRoot, kNC_Bookmark);
|
parser.Parse(kNC_BookmarksRoot, kNC_Bookmark);
|
||||||
|
|
||||||
parser.ParserFoundIEFavoritesRoot(&foundIERoot);
|
parser.ParserFoundIEFavoritesRoot(&foundIERoot);
|
||||||
} // <-- scope the stream to get the open/close automatically.
|
} // <-- scope the stream to get the open/close automatically.
|
||||||
|
|
||||||
// look for and import any IE Favorites
|
// look for and import any IE Favorites
|
||||||
nsAutoString ieTitle("Imported IE Favorites"); // XXX localization?
|
nsAutoString ieTitle("Imported IE Favorites"); // XXX localization?
|
||||||
|
#ifdef XP_BEOS
|
||||||
|
nsAutoString netPositiveTitle("Imported NetPositive Bookmarks"); // XXX localization?
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef XP_MAC
|
#ifdef XP_MAC
|
||||||
nsSpecialSystemDirectory ieFavoritesFile(nsSpecialSystemDirectory::Mac_PreferencesDirectory);
|
nsSpecialSystemDirectory ieFavoritesFile(nsSpecialSystemDirectory::Mac_PreferencesDirectory);
|
||||||
|
@ -2043,6 +2068,42 @@ nsBookmarksService::ReadBookmarks()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XP_BEOS
|
||||||
|
rv = gRDF->GetResource(netPositiveURL, getter_AddRefs(netPositiveFolder));
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIRDFLiteral> netPositiveTitleLiteral;
|
||||||
|
rv = gRDF->GetLiteral(netPositiveTitle.GetUnicode(), getter_AddRefs(netPositiveTitleLiteral));
|
||||||
|
if (NS_SUCCEEDED(rv) && netPositiveTitleLiteral)
|
||||||
|
{
|
||||||
|
rv = mInner->Assert(netPositiveFolder, kNC_Name, netPositiveTitleLiteral, PR_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the Favorites root isn't somewhere in bookmarks.html, add it
|
||||||
|
if (!foundIERoot)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIRDFContainer> container;
|
||||||
|
rv = nsComponentManager::CreateInstance(kRDFContainerCID,
|
||||||
|
nsnull,
|
||||||
|
nsIRDFContainer::GetIID(),
|
||||||
|
getter_AddRefs(container));
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
rv = container->Init(mInner, kNC_BookmarksRoot);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
rv = container->AppendElement(netPositiveFolder);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (netPositiveURL)
|
||||||
|
{
|
||||||
|
free(netPositiveURL);
|
||||||
|
netPositiveURL = nsnull;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче