Always show the Bookmarks Root and the Bookmarks Toolbar folder in the drop down menu. Their position in the dropdown are still determined by their LastModifiedDate, it's only when they don't make the short list that they are put at the bottom of the drop down.

This commit is contained in:
chanial%noos.fr 2003-12-14 22:55:15 +00:00
Родитель 916889cad6
Коммит fb5b2f3ed2
1 изменённых файлов: 16 добавлений и 1 удалений

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

@ -3458,7 +3458,7 @@ nsBookmarksService::GetLastModifiedFolders(nsISimpleEnumerator **aResult)
folderArray.AppendObject(element);
}
// sorting the array containing all the folders
// sort the array containing all the folders
folderArray.Sort(CompareLastModifiedFolders, NS_STATIC_CAST(void*, mInner));
// only keep the first elements
@ -3466,6 +3466,21 @@ nsBookmarksService::GetLastModifiedFolders(nsISimpleEnumerator **aResult)
for (index = folderArray.Count()-1; index >= MAX_LAST_MODIFIED_FOLDERS; index--)
folderArray.RemoveObjectAt(index);
// always show the bookmarks root
if (folderArray.IndexOfObject(kNC_BookmarksRoot) < 0)
folderArray.ReplaceObjectAt(kNC_BookmarksRoot, MAX_LAST_MODIFIED_FOLDERS-1);
// always show the bookmarks toolbar folder
nsCOMPtr<nsIRDFResource> btfResource;
rv = GetBookmarksToolbarFolder(getter_AddRefs(btfResource));
if (NS_SUCCEEDED(rv) && folderArray.IndexOfObject(btfResource) < 0) {
if (folderArray.ObjectAt(MAX_LAST_MODIFIED_FOLDERS-1) == kNC_BookmarksRoot)
index = MAX_LAST_MODIFIED_FOLDERS - 2;
else
index = MAX_LAST_MODIFIED_FOLDERS - 1;
folderArray.ReplaceObjectAt(btfResource, index);
}
return NS_NewArrayEnumerator(aResult, folderArray);
}