Bug 381281 - Cannot reorder bookmarks. r=sspitzer.

This commit is contained in:
mozilla.mano@sent.com 2007-05-20 15:27:04 -07:00
parent 0123739ccf
commit ce228c8079
2 changed files with 19 additions and 18 deletions

View File

@ -610,7 +610,7 @@
this._self._selection = event.target.node; this._self._selection = event.target.node;
if (event.ctrlKey) if (event.ctrlKey)
dragAction.action = Ci.nsIDragService.DRAGDROP_ACTION_COPY; dragAction.action = Ci.nsIDragService.DRAGDROP_ACTION_COPY;
xferData.data = this._controller.getTransferData(dragAction.action); xferData.data = this._self._controller.getTransferData(dragAction.action);
}, },
canDrop: function TBV_DO_canDrop(event, session) { canDrop: function TBV_DO_canDrop(event, session) {

View File

@ -58,9 +58,13 @@
]]></constructor> ]]></constructor>
<destructor><![CDATA[ <destructor><![CDATA[
this._result.viewer = null; // Break the treeviewer->result->treeviewer cycle.
// Note: unsetting the result's viewer also unsets
// the viewer's reference to our treeBoxObject.
var result = this.getResult();
if (result)
result.viewer = null;
this.view = null; this.view = null;
this._result = null;
]]></destructor> ]]></destructor>
<property name="controller" <property name="controller"
@ -640,8 +644,6 @@
if (this.getAttribute("sortActive") == "true") if (this.getAttribute("sortActive") == "true")
throw Cr.NS_OK; throw Cr.NS_OK;
// Items that are "static" - i.e. above the user-configurable area
// of the view - can not be moved.
var nodes = this.getSelectionNodes(); var nodes = this.getSelectionNodes();
for (var i = 0; i < nodes.length; ++i) { for (var i = 0; i < nodes.length; ++i) {
var node = nodes[i]; var node = nodes[i];
@ -650,8 +652,10 @@
// cannot be moved, only copied, so we must change the action used // cannot be moved, only copied, so we must change the action used
// by the drag session. // by the drag session.
var parent = node.parent; var parent = node.parent;
if (PlacesUtils.nodeIsReadOnly(parent)) if (PlacesUtils.nodeIsReadOnly(parent)) {
dragAction.action = Ci.nsIDragService.DRAGDROP_ACTION_COPY; dragAction.action = Ci.nsIDragService.DRAGDROP_ACTION_COPY;
break;
}
} }
// XXXben - the drag wrapper should do this automatically. // XXXben - the drag wrapper should do this automatically.
@ -728,7 +732,7 @@
for (var i = 0; i < cc; ++i) { for (var i = 0; i < cc; ++i) {
var node = aContainer.getChild(i); var node = aContainer.getChild(i);
if (PlacesUtils.nodeIsFolder(node)) { if (PlacesUtils.nodeIsFolder(node)) {
if (folder.itemId == aItemId) { if (node.itemId == aItemId) {
foundNode = node; foundNode = node;
break; break;
} }
@ -795,9 +799,6 @@
var result = this._self.getResult(); var result = this._self.getResult();
var resultview = this._self.getResultView(); var resultview = this._self.getResultView();
var node = index != -1 ? resultview.nodeForTreeIndex(index) : result.root; var node = index != -1 ? resultview.nodeForTreeIndex(index) : result.root;
// Cannot drop before fixed items in the list.
if (node.parent == result.root && orientation != NHRVO.DROP_ON)
return false;
if (orientation == NHRVO.DROP_ON) { if (orientation == NHRVO.DROP_ON) {
// The user cannot drop an item into itself or a read-only container // The user cannot drop an item into itself or a read-only container