mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1090609 - don't disable open in tabs when there's only one item there, r=mak
This commit is contained in:
parent
c261255d96
commit
1be87a6e14
@ -636,7 +636,7 @@ PlacesController.prototype = {
|
||||
if (!openContainerInTabsItem.hidden) {
|
||||
var containerToUse = this._view.selectedNode || this._view.result.root;
|
||||
if (PlacesUtils.nodeIsContainer(containerToUse)) {
|
||||
if (!PlacesUtils.hasChildURIs(containerToUse, true)) {
|
||||
if (!PlacesUtils.hasChildURIs(containerToUse)) {
|
||||
openContainerInTabsItem.disabled = true;
|
||||
// Ensure that we don't display the menu if nothing is enabled:
|
||||
usableItemCount--;
|
||||
|
@ -40,7 +40,7 @@ var SidebarUtils = {
|
||||
var openInTabs = isContainer &&
|
||||
(aEvent.button == 1 ||
|
||||
(aEvent.button == 0 && modifKey)) &&
|
||||
PlacesUtils.hasChildURIs(tbo.view.nodeForTreeIndex(cell.row), true);
|
||||
PlacesUtils.hasChildURIs(tbo.view.nodeForTreeIndex(cell.row));
|
||||
|
||||
if (aEvent.button == 0 && isContainer && !openInTabs) {
|
||||
tbo.view.toggleOpenState(cell.row);
|
||||
|
@ -956,7 +956,7 @@ this.PlacesUtils = {
|
||||
* The container node to search through.
|
||||
* @returns true if the node contains uri nodes, false otherwise.
|
||||
*/
|
||||
hasChildURIs: function PU_hasChildURIs(aNode, aMultiple=false) {
|
||||
hasChildURIs: function PU_hasChildURIs(aNode) {
|
||||
if (!this.nodeIsContainer(aNode))
|
||||
return false;
|
||||
|
||||
@ -972,14 +972,11 @@ this.PlacesUtils = {
|
||||
root.containerOpen = true;
|
||||
}
|
||||
|
||||
let foundFirst = !aMultiple;
|
||||
let found = false;
|
||||
for (let i = 0; i < root.childCount && !found; i++) {
|
||||
let child = root.getChild(i);
|
||||
if (this.nodeIsURI(child)) {
|
||||
found = foundFirst;
|
||||
foundFirst = true;
|
||||
}
|
||||
if (this.nodeIsURI(child))
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (!wasOpen) {
|
||||
|
@ -165,7 +165,6 @@ function check_uri_nodes(aQuery, aOptions, aExpectedURINodes) {
|
||||
root.containerOpen = true;
|
||||
var node = root.getChild(0);
|
||||
do_check_eq(PU.hasChildURIs(node), aExpectedURINodes > 0);
|
||||
do_check_eq(PU.hasChildURIs(node, true), aExpectedURINodes > 1);
|
||||
do_check_eq(PU.getURLsForContainerNode(node).length, aExpectedURINodes);
|
||||
root.containerOpen = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user