Fixes bug where messages when bookmark folder children were shifted caused separators not to be removed correctly. bug=329892 r=brettw@gmail.com

This commit is contained in:
annie.sullivan%gmail.com 2006-03-10 19:22:32 +00:00
Родитель 01f774de17
Коммит 1e43db4652
2 изменённых файлов: 7 добавлений и 20 удалений

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

@ -63,6 +63,8 @@ interface nsINavBookmarkObserver : nsISupports
/**
* Notify this observer that the bookmark was added.
* Called after the actual add took place.
* If other bookmarks in the folder shift due to the item being added,
* no additional onItemMoved notifications are sent.
*
* @param bookmark The bookmark item that was added.
* @param folder The folder that the item was added to.
@ -73,6 +75,8 @@ interface nsINavBookmarkObserver : nsISupports
/**
* Notify this observer that the bookmark was removed.
* Called after the actual remove took place.
* If other bookmarks in the folder shift due to the item being removed,
* no additional onItemMoved notifications are sent.
*
* @param bookmark The bookmark item will be removed.
* @param folder The folder that the item was removed from.
@ -84,6 +88,9 @@ interface nsINavBookmarkObserver : nsISupports
* Notify this observer that an item has changed position in a folder.
* Note that items can exist in more than one folder, but may only occur once
* within a given folder.
* If other bookmarks in the folder shift due to the item being moved,
* no additional onItemMoved notifications are sent.
*
* @param bookmark The bookmark item that changed position.
* @param folder The folder where the item changed position.
* @param oldIndex The old index of the item in the folder.

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

@ -751,26 +751,6 @@ nsNavBookmarks::AdjustIndices(PRInt64 aFolder,
nsBookmarksUpdateBatcher batch;
for (PRUint32 j = 0; j < mObservers.Length(); ++j) {
const nsCOMPtr<nsINavBookmarkObserver> &obs = mObservers[j];
if (!obs) {
continue;
}
for (PRInt32 k = 0; k < items->Count(); ++k) {
RenumberItem *item = NS_STATIC_CAST(RenumberItem*, (*items)[k]);
PRInt32 newPosition = item->position;
PRInt32 oldPosition = newPosition - aDelta;
if (item->itemURI) {
nsIURI *uri = item->itemURI;
obs->OnItemMoved(uri, aFolder, oldPosition, newPosition);
} else if (item->folderChild) {
obs->OnFolderMoved(item->folderChild, aFolder, oldPosition,
aFolder, newPosition);
}
}
}
return NS_OK;
}