From ff578dd0c6d3787f54b70d100884b1ecd0753464 Mon Sep 17 00:00:00 2001 From: "benjamin%smedbergs.us" Date: Tue, 18 Jul 2006 17:33:04 +0000 Subject: [PATCH] 324958 - folder undo delete back to previous folder id. Implement folder removal transaction in bookmarks service itself, using private methods to restore folders back to previous ids. Adjust fe to use new api. r=brettw (C++), annie.sullivan (JS) Original committer: beng%bengoodger.com Original revision: 1.24 Original date: 2006/03/25 00:46:08 --- .../places/public/nsINavBookmarksService.idl | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/toolkit/components/places/public/nsINavBookmarksService.idl b/toolkit/components/places/public/nsINavBookmarksService.idl index 2f77e794ea6..a1d82479669 100644 --- a/toolkit/components/places/public/nsINavBookmarksService.idl +++ b/toolkit/components/places/public/nsINavBookmarksService.idl @@ -45,6 +45,7 @@ %} interface nsIURI; +interface nsITransaction; [ptr] native PRInt64Array(nsTArray); @@ -199,7 +200,7 @@ interface nsINavBookmarkObserver : nsISupports * folders. A URI in history can be contained in one or more such folders. */ -[scriptable, uuid(6979da92-25d4-4553-8450-bfec2b3772db)] +[scriptable, uuid(df93900d-7ef1-4c5f-8e44-a930aeaf1462)] interface nsINavBookmarksService : nsISupports { /** @@ -276,6 +277,23 @@ interface nsINavBookmarksService : nsISupports */ void removeFolder(in PRInt64 folder); + /** + * Gets an undo-able transaction for removing a folder from the bookmarks + * tree. + * @param folder The id of the folder to remove. + * @returns An object implementing nsITransaction that can be used to undo + * or redo the action. + * + * This method exists because complex delete->undo operations rely on + * recreated folders to have the same ID they had before they were deleted, + * so that any other items deleted in different transactions can be + * re-inserted correctly. This provides a safe encapsulation of this + * functionality without exposing the ability to recreate folders with + * specific IDs (potentially dangerous if abused by other code!) in the + * public API. + */ + nsITransaction getRemoveFolderTransaction(in PRInt64 folder); + /** * Convenience function for container services. Removes * all children of the given folder.