commit 368724b7de7a55efd8864460e0414988c2b5bc62
parent 7c9b1f785c0583f5c883d1db2d4d87c3e8540e6c
Author: David Norton <david@nortoncrew.com>
Date: Thu, 8 Jun 2006 20:28:50 +0000
[interface] Collections should keep their open state on a drop.
Diffstat:
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git 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<len; i++)
{
@@ -78,7 +101,6 @@ Scholar.CollectionTreeView.prototype.notify = function(action, type, ids)
madeChanges = true;
}
-
}
}
@@ -268,12 +290,8 @@ Scholar.CollectionTreeView.prototype.drop = function(row, orient)
var targetCollectionID;
if(this._getItemAtRow(row).isCollection())
targetCollectionID = this._getItemAtRow(row).ref.getID();
-
var droppedCollection = Scholar.Collections.get(ids[0]);
droppedCollection.changeParent(targetCollectionID);
- this.refresh();
- this._treebox.rowCountChanged(0,this.rowCount-oldCount);
- this._treebox.invalidate();
}
else if(dataType == 'scholar/item' && this.canDrop(row, orient))
{