From 4466f1279a4a946ff2911473e2c1a8c0fbe410ba Mon Sep 17 00:00:00 2001 From: "mozilla.mano@sent.com" Date: Tue, 22 May 2007 16:56:50 -0700 Subject: [PATCH] Bug 372508 - onFolderChanged removal. r=dietrcih. --- browser/base/content/browser.js | 3 +- .../places/public/nsINavBookmarksService.idl | 18 +---- .../places/src/nsNavHistoryResult.cpp | 78 ------------------- .../places/tests/bookmarks/test_bookmarks.js | 4 - .../places/tests/chrome/test_371798.xul | 3 +- .../places/tests/chrome/test_add_livemark.xul | 1 - 6 files changed, 6 insertions(+), 101 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 911e20084e3..2eef368ffad 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -339,8 +339,7 @@ var gBookmarksObserver = { }, onItemVisited: function() { }, - onItemMoved: function() { }, - onFolderChanged: function() { } + onItemMoved: function() { } }; /** diff --git a/toolkit/components/places/public/nsINavBookmarksService.idl b/toolkit/components/places/public/nsINavBookmarksService.idl index 163e37758a7..f987c8a1a8b 100644 --- a/toolkit/components/places/public/nsINavBookmarksService.idl +++ b/toolkit/components/places/public/nsINavBookmarksService.idl @@ -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); }; /** diff --git a/toolkit/components/places/src/nsNavHistoryResult.cpp b/toolkit/components/places/src/nsNavHistoryResult.cpp index 470099654fa..796aac33e3b 100644 --- a/toolkit/components/places/src/nsNavHistoryResult.cpp +++ b/toolkit/components/places/src/nsNavHistoryResult.cpp @@ -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 diff --git a/toolkit/components/places/tests/bookmarks/test_bookmarks.js b/toolkit/components/places/tests/bookmarks/test_bookmarks.js index aeef90761da..83ccedd1241 100644 --- a/toolkit/components/places/tests/bookmarks/test_bookmarks.js +++ b/toolkit/components/places/tests/bookmarks/test_bookmarks.js @@ -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)) { diff --git a/toolkit/components/places/tests/chrome/test_371798.xul b/toolkit/components/places/tests/chrome/test_371798.xul index 1ce9b9f2eae..74b820fe946 100644 --- a/toolkit/components/places/tests/chrome/test_371798.xul +++ b/toolkit/components/places/tests/chrome/test_371798.xul @@ -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); diff --git a/toolkit/components/places/tests/chrome/test_add_livemark.xul b/toolkit/components/places/tests/chrome/test_add_livemark.xul index 7077e9fc8a5..18ef065e315 100644 --- a/toolkit/components/places/tests/chrome/test_add_livemark.xul +++ b/toolkit/components/places/tests/chrome/test_add_livemark.xul @@ -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) {