зеркало из https://github.com/mozilla/pjs.git
Bug 428403: Creating a new folder via the bookmark contextual dialog always places it under bookmarks menu, patch by Marco Bonardo <mak77@supereva.it>, r=mano, ui-r=beltzner, a=mconnor
This commit is contained in:
Родитель
c13cdd69dc
Коммит
93812c3d0b
|
@ -181,6 +181,8 @@
|
|||
this._overFolder.closeMenuTimer = this._overFolder
|
||||
.setTimer(this._overFolder.hoverTime);
|
||||
}
|
||||
|
||||
this._rootView._draggedNode = null;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
@ -896,8 +898,9 @@
|
|||
<property name="insertionPoint">
|
||||
<getter><![CDATA[
|
||||
// By default, the insertion point is at the top level, at the end.
|
||||
var index = -1;
|
||||
var index = PlacesUtils.bookmarks.DEFAULT_INDEX;
|
||||
var folderId = 0;
|
||||
var orientation = Ci.nsITreeView.DROP_BEFORE;
|
||||
var isTag = false;
|
||||
|
||||
if (PlacesUtils.nodeIsFolder(this._resultNode)) {
|
||||
|
@ -907,20 +910,21 @@
|
|||
|
||||
var selectedNode = this.selectedNode;
|
||||
if (selectedNode) {
|
||||
if (PlacesUtils.nodeIsFolder(selectedNode)) {
|
||||
// If there is a folder selected, the insertion point is the
|
||||
// end of the folder.
|
||||
var popupNode = document.popupNode;
|
||||
if (popupNode == popupNode.parentNode._emptyMenuItem) {
|
||||
// If (empty) menuitem is selected the insertion point
|
||||
// is inside the folder, at the end.
|
||||
folderId = PlacesUtils.getConcreteItemId(selectedNode);
|
||||
orientation = Ci.nsITreeView.DROP_ON;
|
||||
}
|
||||
else {
|
||||
// If there is another type of node selected, the insertion point
|
||||
// is after that node.
|
||||
// In all other cases the insertion point is before that node.
|
||||
folderId = PlacesUtils.getConcreteItemId(selectedNode.parent);
|
||||
index = PlacesUtils.getIndexOfNode(selectedNode);
|
||||
isTag = PlacesUtils.nodeIsTagQuery(selectedNode.parent);
|
||||
}
|
||||
}
|
||||
return new InsertionPoint(folderId, index, 1, isTag);
|
||||
return new InsertionPoint(folderId, index, orientation, isTag);
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
|
|
|
@ -384,26 +384,28 @@
|
|||
<property name="insertionPoint">
|
||||
<getter><![CDATA[
|
||||
// By default, the insertion point is at the top level, at the end.
|
||||
var index = -1;
|
||||
var index = PlacesUtils.bookmarks.DEFAULT_INDEX;
|
||||
var folderId = PlacesUtils.getConcreteItemId(this._result.root);
|
||||
var orientation = Ci.nsITreeView.DROP_BEFORE;
|
||||
var isTag = false;
|
||||
|
||||
var selectedNode = this.selectedNode;
|
||||
if (selectedNode) {
|
||||
if (PlacesUtils.nodeIsFolder(selectedNode)) {
|
||||
// If there is a folder selected, the insertion point is the
|
||||
// end of the folder.
|
||||
var popupNode = document.popupNode;
|
||||
if (popupNode == popupNode.parentNode._emptyMenuItem) {
|
||||
// If (empty) menuitem is selected the insertion point
|
||||
// is inside the folder, at the end.
|
||||
folderId = PlacesUtils.getConcreteItemId(selectedNode);
|
||||
orientation = Ci.nsITreeView.DROP_ON;
|
||||
}
|
||||
else {
|
||||
// If there is another type of node selected, the insertion point
|
||||
// is after that node.
|
||||
// In all other cases the insertion point is before that node.
|
||||
folderId = PlacesUtils.getConcreteItemId(selectedNode.parent);
|
||||
index = PlacesUtils.getIndexOfNode(selectedNode);
|
||||
isTag = PlacesUtils.nodeIsTagQuery(selectedNode.parent);
|
||||
}
|
||||
}
|
||||
return new InsertionPoint(folderId, index, 1, isTag);
|
||||
return new InsertionPoint(folderId, index, orientation, isTag);
|
||||
]]></getter>
|
||||
</property>
|
||||
|
||||
|
@ -916,6 +918,8 @@
|
|||
if (this._overFolder.node)
|
||||
this._overFolder.closeTimer = this._setTimer(this._overFolder.hoverTime);
|
||||
PlacesControllerDragHelper.currentDropTarget = null;
|
||||
|
||||
this._self._draggedNode = null;
|
||||
},
|
||||
|
||||
getSupportedFlavours: function TBV_DO_getSupportedFlavours() {
|
||||
|
|
|
@ -440,7 +440,7 @@
|
|||
return this._cachedInsertionPoint = null;
|
||||
}
|
||||
|
||||
var orientation = Ci.nsITreeView.DROP_AFTER;
|
||||
var orientation = Ci.nsITreeView.DROP_BEFORE;
|
||||
// If there is no selection, insert at the end of the container.
|
||||
if (!this.hasSelection) {
|
||||
var index = this.view.rowCount - 1;
|
||||
|
@ -451,9 +451,9 @@
|
|||
|
||||
// This is a two-part process. The first part is determining the drop
|
||||
// orientation.
|
||||
// * The default orientation is to drop _after_ the selected item.
|
||||
// * If the selected item is an open container, the default
|
||||
// orientation is to drop _into_ that container.
|
||||
// * The default orientation is to drop _before_ the selected item.
|
||||
// * If the selected item is a container, the default orientation
|
||||
// is to drop _into_ that container.
|
||||
//
|
||||
// Warning: It may be tempting to use tree indexes in this code, but
|
||||
// you must not, since the tree is nested and as your tree
|
||||
|
@ -468,18 +468,18 @@
|
|||
var min = { }, max = { };
|
||||
selection.getRangeAt(rc - 1, min, max);
|
||||
|
||||
// If the sole selection is an open container, insert into it rather
|
||||
// than adjacent to it. Note that this only applies to _single_
|
||||
// selections - if the last element within a multi-selection is an
|
||||
// open folder, insert _adjacent_ to the selection.
|
||||
// If the sole selection is a container, and we are not in
|
||||
// a flatlist, insert into it.
|
||||
// Note that this only applies to _single_ selections,
|
||||
// if the last element within a multi-selection is a
|
||||
// container, insert _adjacent_ to the selection.
|
||||
//
|
||||
// If the sole selection is the bookmarks toolbar folder, we insert
|
||||
// into it even if it is not opened
|
||||
var itemId =
|
||||
PlacesUtils.getConcreteItemId(resultView.nodeForTreeIndex(max.value));
|
||||
if (selection.count == 1 && resultView.isContainer(max.value) &&
|
||||
(resultView.isContainerOpen(max.value) ||
|
||||
itemId == PlacesUtils.bookmarksMenuFolderId))
|
||||
!this.flatList)
|
||||
orientation = Ci.nsITreeView.DROP_ON;
|
||||
|
||||
this._cachedInsertionPoint =
|
||||
|
|
Загрузка…
Ссылка в новой задаче