From 081b5446884898148583e04e5cb2d810bd3bf9b2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 11 Oct 2006 04:20:05 +0000 Subject: [PATCH] Change collection notifier event to 'delete' instead of 'remove' to be consistent with item deletions (as opposed to merely removing items from collections, which uses 'remove') --- chrome/content/zotero/xpcom/collectionTreeView.js | 4 ++-- chrome/content/zotero/xpcom/data_access.js | 2 +- chrome/content/zotero/xpcom/notifier.js | 13 ++++++++++--- chrome/content/zotero/xpcom/search.js | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index f42bc21787..fc55a6affa 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -106,9 +106,9 @@ Zotero.CollectionTreeView.prototype.notify = function(action, type, ids) var madeChanges = false; var ids = Zotero.flattenArguments(ids); - if(action == 'remove') + if(action == 'delete') { - //Since a remove involves shifting of rows, we have to do it in order + //Since a delete involves shifting of rows, we have to do it in order //sort the ids by row var rows = new Array(); diff --git a/chrome/content/zotero/xpcom/data_access.js b/chrome/content/zotero/xpcom/data_access.js index 63ad8dbca8..74b03e5802 100644 --- a/chrome/content/zotero/xpcom/data_access.js +++ b/chrome/content/zotero/xpcom/data_access.js @@ -2360,7 +2360,7 @@ Zotero.Collection.prototype.erase = function(deleteItems){ // Clear deleted collection from internal memory Zotero.Collections.unload(collections); - Zotero.Notifier.trigger('remove', 'collection', collections); + Zotero.Notifier.trigger('delete', 'collection', collections); if (items.length){ Zotero.Notifier.trigger('delete', 'item', items); } diff --git a/chrome/content/zotero/xpcom/notifier.js b/chrome/content/zotero/xpcom/notifier.js index e1ab8d2f18..56cea0252c 100644 --- a/chrome/content/zotero/xpcom/notifier.js +++ b/chrome/content/zotero/xpcom/notifier.js @@ -52,9 +52,16 @@ Zotero.Notifier = new function(){ } /** - * event - 'add', 'remove', 'modify' - * type - 'collection', 'search', 'item' - * ids - single id or array of ids + * Trigger a notification to the appropriate observers + * + * Possible values: + * + * event: 'add', 'modify', 'delete', 'move' (c, for changing parent), + * 'remove' (i, for removing from collections) + * type - 'collection', 'search', 'item' + * ids - single id or array of ids + * + * c = collection, s = search, i = item **/ function trigger(event, type, ids){ if (_disabled){ diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index 05a8f910e2..43419e2fca 100644 --- a/chrome/content/zotero/xpcom/search.js +++ b/chrome/content/zotero/xpcom/search.js @@ -644,7 +644,7 @@ Zotero.Searches = new function(){ Zotero.DB.query(sql); Zotero.DB.commitTransaction(); - Zotero.Notifier.trigger('remove', 'search', savedSearchID); + Zotero.Notifier.trigger('delete', 'search', savedSearchID); } }