From 368724b7de7a55efd8864460e0414988c2b5bc62 Mon Sep 17 00:00:00 2001 From: David Norton Date: Thu, 8 Jun 2006 20:28:50 +0000 Subject: [PATCH] [interface] Collections should keep their open state on a drop. --- .../content/scholar/collectionTreeView.js | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/collectionTreeView.js b/chrome/chromeFiles/content/scholar/collectionTreeView.js index 2c33bfecfc..954202d0a1 100644 --- a/chrome/chromeFiles/content/scholar/collectionTreeView.js +++ b/chrome/chromeFiles/content/scholar/collectionTreeView.js @@ -31,11 +31,11 @@ Scholar.CollectionTreeView.prototype.unregister = function() */ Scholar.CollectionTreeView.prototype.notify = function(action, type, ids) { - ids = Scholar.flattenArguments(ids); var madeChanges = false; if(action == 'remove') { + ids = Scholar.flattenArguments(ids); //Since a remove involves shifting of rows, we have to do it in order //sort the ids by row @@ -59,8 +59,31 @@ Scholar.CollectionTreeView.prototype.notify = function(action, type, ids) } } + else if(action == 'move') + { + var openCollections = new Array(); + + for(var i = 0; i < this.rowCount; i++) + if(this.isContainer(i) && this.isContainerOpen(i)) + openCollections.push(this._getItemAtRow(i).ref.getID()); + + var oldCount = this.rowCount; + this._treebox.beginUpdateBatch(); + this.refresh(); + this._treebox.rowCountChanged(0,this.rowCount - oldCount); + + for(var i = 0; i < openCollections.length; i++) + { + var row = this._collectionRowMap[openCollections[i]]; + if(row != null) + this.toggleOpenState(row); + } + this._treebox.invalidate(); + this._treebox.endUpdateBatch(); + } else { + ids = Scholar.flattenArguments(ids); for (var i=0, len=ids.length; i