b=318439 r=bryner sr=ben

Made insertionPoint for places-bar and places-menupopup inside the folder
if the selection is a folder.
This commit is contained in:
annie.sullivan%gmail.com 2005-12-01 00:58:03 +00:00
parent 624429ce26
commit ae7f7f2a44
2 changed files with 32 additions and 12 deletions

View File

@ -88,7 +88,7 @@
if (PlacesController.nodeIsURL(child)) {
element = document.createElementNS(XULNS, "menuitem");
element.setAttribute("label", child.title);
element.setAttribute("url", child.url)
element.setAttribute("url", child.url);
}
else if (PlacesController.nodeIsFolder(child)) {
element = document.createElementNS(XULNS, "menu");
@ -159,11 +159,21 @@
<property name="insertionPoint">
<getter><![CDATA[
if (!this.hasSelection)
var index = -1;
else
index = PlacesController.getIndexOfNode(this.selectedNode)
return new InsertionPoint(this._result.folderId, index);
// By default, the insertion point is at the top level, at the end.
var index = -1;
var folderId = this._result.folderId;
if (this.hasSelection) {
if(PlacesController.nodeIsFolder(this.selectedNode))
// If there is a folder selected, the insertion point is the
// end of the folder.
folderId = this.selectedNode.folderId;
else
// If there is another type of node selected, the insertion point
// is after that node.
index = PlacesController.getIndexOfNode(this.selectedNode)
}
return new InsertionPoint(folderId, index);
]]></getter>
</property>

View File

@ -119,12 +119,22 @@
</property>
<property name="insertionPoint">
<getter><![CDATA[
if (!this.hasSelection)
var index = -1;
else
index = PlacesController.getIndexOfNode(this.selectedNode)
return new InsertionPoint(this._result.folderId, index);
<getter><![CDATA[
// By default, the insertion point is at the top level, at the end.
var index = -1;
var folderId = this._result.folderId;
if (this.hasSelection) {
if(PlacesController.nodeIsFolder(this.selectedNode))
// If there is a folder selected, the insertion point is the
// end of the folder.
folderId = this.selectedNode.folderId;
else
// If there is another type of node selected, the insertion point
// is after that node.
index = PlacesController.getIndexOfNode(this.selectedNode)
}
return new InsertionPoint(folderId, index);
]]></getter>
</property>