www

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

commit b9da94a650ca700d8bc409135ab9ad56b5e124ca
parent 96305492f78a010a0daa72cb19d8589737e881f4
Author: Simon Kornblith <simon@simonster.com>
Date:   Wed, 27 Jun 2012 22:39:47 -0400

Merge branch '3.0'

Diffstat:
Mchrome/content/zotero/xpcom/itemTreeView.js | 44++++++++++++++++++++++++++++++++++----------
1 file changed, 34 insertions(+), 10 deletions(-)

diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js @@ -467,6 +467,12 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData) var row = this._itemRowMap[id]; + // Deleted items get a modify that we have to ignore when + // not viewing the trash + if (item.deleted) { + continue; + } + // Item already exists in this view if( row != null) { @@ -505,12 +511,6 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData) else if (((itemGroup.isLibrary() || itemGroup.isGroup()) && itemGroup.ref.libraryID == item.libraryID) || (itemGroup.isCollection() && item.inCollection(itemGroup.ref.id))) { - // Deleted items get a modify that we have to ignore when - // not viewing the trash - if (item.deleted) { - continue; - } - // Otherwise the item has to be added if(item.isRegularItem() || !item.getSource()) { @@ -531,9 +531,22 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData) // If quicksearch, re-run it, since the results may have changed else { - quicksearch.doCommand(); - madeChanges = true; - sort = true; + // If not viewing trash and all items were deleted, ignore modify + var allDeleted = true; + if (!itemGroup.isTrash()) { + var items = Zotero.Items.get(ids); + for each(var item in items) { + if (!item.deleted) { + allDeleted = false; + break; + } + } + } + if (!allDeleted) { + quicksearch.doCommand(); + madeChanges = true; + sort = true; + } } } else if(action == 'add') @@ -617,7 +630,6 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData) } } - if (singleSelect) { if (sort) { this.sort(typeof sort == 'number' ? sort : false); @@ -680,6 +692,18 @@ Zotero.ItemTreeView.prototype.notify = function(action, type, ids, extraData) } } else { + // If this was a child item and the next item at this + // position is a top-level item, move selection one row + // up to select a sibling or parent + if (ids.length == 1 && previousRow > 0) { + var previousItem = Zotero.Items.get(ids[0]); + if (previousItem && previousItem.getSource()) { + if (this._dataItems[previousRow] && this.getLevel(previousRow) == 0) { + previousRow--; + } + } + } + if (this._dataItems[previousRow]) { this.selection.select(previousRow); }