Bug 372508 - onFolderChanged removal. r=dietrcih.

This commit is contained in:
mozilla.mano@sent.com 2007-05-22 16:56:50 -07:00
parent a56819194e
commit 4466f1279a
6 changed files with 6 additions and 101 deletions

View File

@ -339,8 +339,7 @@ var gBookmarksObserver = {
},
onItemVisited: function() { },
onItemMoved: function() { },
onFolderChanged: function() { }
onItemMoved: function() { }
};
/**

View File

@ -54,7 +54,7 @@ interface nsITransaction;
* Observer for bookmark changes.
*/
[scriptable, uuid(73d28ab9-0360-4077-845e-543d1aedba1d)]
[scriptable, uuid(ef368152-354a-4a2b-92e4-910a80153c6f)]
interface nsINavBookmarkObserver : nsISupports
{
/**
@ -101,11 +101,11 @@ interface nsINavBookmarkObserver : nsISupports
in long aIndex);
/**
* Notify this observer that a bookmark's information has changed. This
* Notify this observer that an item's information has changed. This
* will be called whenever any attributes like "title" are changed.
*
* @param aBookmarkId
* The id of the bookmark that was changed.
* @param aItemId
* The id of the item that was changed.
* @param aProperty
* The property which changed.
* @param aIsAnnotationProperty
@ -152,16 +152,6 @@ interface nsINavBookmarkObserver : nsISupports
void onItemMoved(in long long aItemId,
in long long aOldParent, in long aOldIndex,
in long long aNewParent, in long aNewIndex);
/**
* Notify this observer that a bookmark folder's information has changed.
* This will be called whenever any attributes like "title" are changed.
* @param aFolder
* The id of the folder that was changed.
* @param aProperty
* The property that was changed.
*/
void onFolderChanged(in long long aFolder, in ACString aProperty);
};
/**

View File

@ -2603,14 +2603,6 @@ nsNavHistoryQueryResultNode::OnItemMoved(PRInt64 aFolder, PRInt64 aOldParent,
return Refresh();
return NS_OK;
}
NS_IMETHODIMP
nsNavHistoryQueryResultNode::OnFolderChanged(PRInt64 aFolder,
const nsACString& property)
{
if (mLiveUpdate == QUERYUPDATE_COMPLEX_WITH_BOOKMARKS)
return Refresh();
return NS_OK;
}
// nsNavHistoryFolderResultNode ************************************************
//
@ -3351,62 +3343,6 @@ nsNavHistoryFolderResultNode::OnItemMoved(PRInt64 aItemId, PRInt64 aOldParent,
}
// nsNavHistoryFolderResultNode::OnFolderChanged (nsINavBookmarkObserver)
//
// Unlike some of the other notifications that are sent to the parent of
// the item that's changing, this one is sent to the folder that's
// changing.
NS_IMETHODIMP
nsNavHistoryFolderResultNode::OnFolderChanged(PRInt64 aFolder,
const nsACString& property)
{
// Do NOT call StartIncrementalUpdate here. That call is not appropriate
// because it assumes a child has changed. Here, our folder itself is
// changing. Updating a folder is very easy and isn't affected by filtering,
// so we can always do incremental updates.
if (property.EqualsLiteral("title")) {
nsNavBookmarks* bookmarks = nsNavBookmarks::GetBookmarksService();
NS_ENSURE_TRUE(bookmarks, NS_ERROR_OUT_OF_MEMORY);
nsAutoString title;
bookmarks->GetItemTitle(mItemId, title);
mTitle = NS_ConvertUTF16toUTF8(title);
PRInt32 sortType = GetSortType();
if ((sortType == nsINavHistoryQueryOptions::SORT_BY_TITLE_ASCENDING ||
sortType == nsINavHistoryQueryOptions::SORT_BY_TITLE_DESCENDING) &&
mParent) {
PRInt32 ourIndex = mParent->FindChild(this);
SortComparator comparator = GetSortingComparator(sortType);
nsCAutoString sortingAnnotation;
GetSortingAnnotation(sortingAnnotation);
if (mParent->DoesChildNeedResorting(ourIndex, comparator, sortingAnnotation.get())) {
// needs resorting, this will cause everything to be redrawn, so we
// don't need to do that explicitly later.
mParent->RemoveChildAt(ourIndex, PR_TRUE);
mParent->InsertChildAt(this,
mParent->FindInsertionPoint(this, comparator, sortingAnnotation.get()),
PR_TRUE);
return NS_OK;
}
}
} else {
NS_NOTREACHED("Unknown folder change event");
return NS_ERROR_FAILURE;
}
// update folder if visible
nsNavHistoryResult* result = GetResult();
NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
if (result->GetView())
result->GetView()->ItemChanged(
NS_STATIC_CAST(nsNavHistoryResultNode*, this));
return NS_OK;
}
// nsNavHistorySeparatorResultNode
//
// Separator nodes do not hold any data
@ -3877,20 +3813,6 @@ nsNavHistoryResult::OnItemMoved(PRInt64 aItemId,
return NS_OK;
}
// nsNavHistoryResult::OnFolderChanged (nsINavBookmarkObserver)
NS_IMETHODIMP
nsNavHistoryResult::OnFolderChanged(PRInt64 aFolder,
const nsACString &aProperty)
{
ENUMERATE_BOOKMARK_OBSERVERS_FOR_FOLDER(aFolder,
OnFolderChanged(aFolder, aProperty));
ENUMERATE_HISTORY_OBSERVERS(OnFolderChanged(aFolder, aProperty));
return NS_OK;
}
// nsNavHistoryResult::OnVisit (nsINavHistoryObserver)
NS_IMETHODIMP

View File

@ -94,10 +94,6 @@ var observer = {
this._itemMovedNewParent = newParent;
this._itemMovedNewIndex = newIndex;
},
onFolderChanged: function(folder, property) {
this._folderChanged = folder;
this._folderChangedProperty = property;
},
QueryInterface: function(iid) {
if (iid.equals(Ci.nsINavBookmarkObserver) ||
iid.equals(Ci.nsISupports)) {

View File

@ -67,8 +67,7 @@ var observer =
bmsvc.removeObserver(this);
},
onItemVisited: function(bookmarkId, bookmark, aVisitID, time){},
onItemMoved: function(itemId, oldParent, oldIndex, newParent, newIndex){},
onFolderChanged: function(folder, property){}
onItemMoved: function(itemId, oldParent, oldIndex, newParent, newIndex){}
};
bmsvc.addObserver(observer, false);

View File

@ -60,7 +60,6 @@ var observer =
onItemChanged: function(itemId, property, isAnnotationProperty, value){},
onItemVisited: function(itemId, aVisitID, time){},
onItemMoved: function(itemId, oldParent, oldIndex, newParent, newIndex){},
onFolderChanged: function(folder, property){},
// nsIAnnotationObserver
onItemAnnotationSet: function(aItemId, aAnnotationName) {