www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 3715f2c89ec7b9e91a802dd3f6d347ba1877a2ab
parent 368724b7de7a55efd8864460e0414988c2b5bc62
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu,  8 Jun 2006 20:41:37 +0000

- Send a 'modify' to collections in addItem() and removeItem() when collections become or stop being empty

- Send a 'delete' rather than a 'remove' to itemViews when items are actually deleted (removals from collections still get 'remove' unless it's part of a collection erase)


Diffstat:
Mchrome/chromeFiles/content/scholar/xpcom/data_access.js | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -712,7 +712,7 @@ Scholar.Item.prototype.erase = function(){ // If we're not in the middle of a larger commit, trigger the notifier now if (!Scholar.DB.transactionInProgress()){ - Scholar.Notifier.trigger('remove', 'item', this.getID()); + Scholar.Notifier.trigger('delete', 'item', this.getID()); } } @@ -1189,7 +1189,12 @@ Scholar.Collection.prototype.addItem = function(itemID){ Scholar.DB.commitTransaction(); this._childItems.set(itemID); - this._hasChildItems = true; + + // If this was previously empty, update and send a notification to the tree + if (!this._hasChildItems){ + this._hasChildItems = true; + Scholar.Notifier.trigger('modify', 'collections', this.getID()); + } Scholar.Notifier.trigger('add', 'item', itemID); } @@ -1228,6 +1233,7 @@ Scholar.Collection.prototype.removeItem = function(itemID){ // If this was the last item, set collection to empty if (!this._childItems.length){ this._hasChildItems = false; + Scholar.Notifier.trigger('modify', 'collections', this.getID()); } Scholar.Notifier.trigger('remove', 'item', itemID); @@ -1299,7 +1305,7 @@ Scholar.Collection.prototype.erase = function(deleteItems){ Scholar.Notifier.trigger('remove', 'collection', collections); if (items.length){ - Scholar.Notifier.trigger('remove', 'item', items); + Scholar.Notifier.trigger('delete', 'item', items); } }