зеркало из https://github.com/mozilla/gecko-dev.git
315940 - implement index restrict in the places tree to prevent drop of items at certain indices NPOB
This commit is contained in:
Родитель
f175783805
Коммит
23cc61f267
|
@ -820,7 +820,6 @@ var PlacesControllerDragHelper = {
|
|||
* An object implementing the AVI
|
||||
* @param orientation
|
||||
* The orientation of the drop
|
||||
* XXXben implement index param!
|
||||
* @returns true if the data being dragged is of a type supported by the view
|
||||
* it is being dragged over, false otherwise.
|
||||
*/
|
||||
|
|
|
@ -90,6 +90,7 @@
|
|||
element = document.createElementNS(XULNS, "menu");
|
||||
element.setAttribute("type", "menu");
|
||||
element.setAttribute("container", "true");
|
||||
element.setAttribute("label", child.title);
|
||||
var popup = document.createElementNS(XULNS, "menupopup");
|
||||
popup.setAttribute("type", "places");
|
||||
element.appendChild(popup);
|
||||
|
|
|
@ -111,6 +111,8 @@ var PlacesPage = {
|
|||
this._content.supportedDropTypes = [TYPE_X_MOZ_PLACE_CONTAINER,
|
||||
TYPE_X_MOZ_PLACE, TYPE_X_MOZ_URL];
|
||||
this._content.supportedDropOnTypes = this._content.supportedDropTypes;
|
||||
this._places.firstDropIndex = 2;
|
||||
this._content.firstDropIndex = 0;
|
||||
|
||||
// Hook the browser UI
|
||||
PlacesUIHook.init(this._content);
|
||||
|
|
|
@ -296,6 +296,9 @@
|
|||
<!-- AVI Method -->
|
||||
<property name="browserWindow" onget="return this._browserWindow"/>
|
||||
|
||||
<!-- AVI Method -->
|
||||
<field name="firstDropIndex">null</field>
|
||||
|
||||
<!-- AVI Method -->
|
||||
<field name="supportedDropTypes">null</field>
|
||||
|
||||
|
@ -337,12 +340,21 @@
|
|||
_self: this,
|
||||
|
||||
canDrop: function VO_canDrop(index, orientation) {
|
||||
var root = this._self.getResult();
|
||||
var node = root.nodeForTreeIndex(index);
|
||||
// Cannot drop before fixed items in the list.
|
||||
if (node.parent == root &&
|
||||
PlacesController.getIndexOfNode(node) < this._self.firstDropIndex &&
|
||||
orientation != Ci.nsINavHistoryResultViewObserver.DROP_ON)
|
||||
return false;
|
||||
return PlacesControllerDragHelper.canDrop(this._self, orientation);
|
||||
},
|
||||
|
||||
onDrop: function VO_onDrop(index, orientation) {
|
||||
LOG("VO: onDrop: " + index + ", orientation: " + orientation);
|
||||
|
||||
if (!this.canDrop(index, orientation))
|
||||
return;
|
||||
|
||||
// We are responsible for translating the |index| and |orientation|
|
||||
// parameters into a container id and index within the container,
|
||||
// since this information is specific to the tree view.
|
||||
|
|
Загрузка…
Ссылка в новой задаче