Bug 329949 - browser.tabs.loadBookmarksInBackground is ignored in places views (histrory sidebar, bookmarks toolbar etc.). r=sspitzer.

This commit is contained in:
mozilla.mano%sent.com 2006-12-26 20:26:38 +00:00
parent 0b04b8f43d
commit 3bb82d5fd9
5 changed files with 27 additions and 75 deletions

View File

@ -373,7 +373,7 @@ var BookmarksEventHandler = {
else
PlacesUtils.getViewForNode(event.target)
.controller
.openSelectedNodeInBrowser(event);
.openSelectedNodeWithEvent(event);
},
/**

View File

@ -309,13 +309,13 @@ PlacesController.prototype = {
this.selectAll();
break;
case "placesCmd_open":
this.openLinkInCurrentWindow();
this.openSelectedNodeIn("current");
break;
case "placesCmd_open:window":
this.openLinkInNewWindow();
this.openSelectedNodeIn("window");
break;
case "placesCmd_open:tab":
this.openLinkInNewTab();
this.openSelectedNodeIn("tab");
break;
case "placesCmd_open:tabs":
this.openLinksInTabs();
@ -855,15 +855,20 @@ PlacesController.prototype = {
* The DOM Mouse event with modifier keys set that track the user's
* preferred destination window or tab.
*/
openSelectedNodeInBrowser: function PC_openSelectedNodeInBrowser(aEvent) {
openSelectedNodeWithEvent: function PC_openSelectedNodeWithEvent(aEvent) {
var node = this._view.selectedURINode;
if (node) {
var browser = this._getBrowserWindow();
if (browser)
browser.openUILink(node.uri, aEvent, false, false);
else
this._openBrowserWith(node.uri);
}
if (node)
openUILink(node.uri, aEvent);
},
/**
* Loads the selected node's URL in the appropriate tab or window.
* @see openUILinkIn
*/
openSelectedNodeIn: function PC_openSelectedNodeIn(aWhere) {
var node = this._view.selectedURINode;
if (node)
openUILinkIn(node.uri, aWhere);
},
/**
@ -919,65 +924,6 @@ PlacesController.prototype = {
}
},
/**
* Gets the current active browser window.
*/
_getBrowserWindow: function PC__getBrowserWindow() {
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
return wm.getMostRecentWindow("navigator:browser");
},
/**
* Opens a new browser window, showing the specified url.
*/
_openBrowserWith: function PC__openBrowserWith(url) {
openDialog("chrome://browser/content/browser.xul", "_blank",
"chrome,all,dialog=no", url, null, null);
},
/**
* Loads the selected URL in a new tab.
*/
openLinkInNewTab: function PC_openLinkInNewTab() {
var node = this._view.selectedURINode;
if (node) {
var browser = this._getBrowserWindow();
if (browser)
browser.openNewTabWith(node.uri, null, null);
else
this._openBrowserWith(node.uri);
}
},
/**
* Loads the selected URL in a new window.
*/
openLinkInNewWindow: function PC_openLinkInNewWindow() {
var node = this._view.selectedURINode;
if (node) {
var browser = this._getBrowserWindow();
if (browser)
browser.openNewWindowWith(node.uri, null, null, false);
else
this._openBrowserWith(node.uri);
}
},
/**
* Loads the selected URL in the current window, replacing the Places page.
*/
openLinkInCurrentWindow: function PC_openLinkInCurrentWindow() {
var node = this._view.selectedURINode;
if (node) {
var browser = this._getBrowserWindow();
if (browser)
browser.loadURI(node.uri, null, null, false);
else
this._openBrowserWith(node.uri);
}
},
/**
* Gives the user a chance to cancel loading lots of tabs at once
*/
@ -1041,7 +987,7 @@ PlacesController.prototype = {
// Get the start index to open tabs at
// XXX todo: no-browser-window-case
var browserWindow = this._getBrowserWindow();
var browserWindow = getTopWin();
var browser = browserWindow.getBrowser();
var tabPanels = browser.browsers;
var tabCount = tabPanels.length;
@ -1140,7 +1086,7 @@ PlacesController.prototype = {
for (var i = 0; i < nodes.length; ++i) {
if (PlacesUtils.nodeIsURI(nodes[i]))
this._getBrowserWindow().openNewTabWith(nodes[i].uri, null, null);
getTopWin().openNewTabWith(nodes[i].uri, null, null);
}
}
},

View File

@ -231,7 +231,7 @@ var PlacesOrganizer = {
}
if (currentView.hasSingleSelection && event.button == 1) {
if (PlacesUtils.nodeIsURI(currentView.selectedNode))
controller.openSelectedNodeInBrowser(event);
controller.openSelectedNodeWithEvent(event);
else if (PlacesUtils.nodeIsContainer(currentView.selectedNode)) {
// The command execution function will take care of seeing the
// selection is a folder/container and loading its contents in

View File

@ -60,6 +60,8 @@
<script type="application/x-javascript"
src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript"
src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/x-javascript"
src="chrome://browser/content/places/utils.js"/>
<script type="application/x-javascript"
@ -335,7 +337,7 @@
#include advancedSearch.inc
<tree id="placeContent" class="placesTree" context="placesContext"
flex="1" type="places"
ondblclick="this.controller.openSelectedNodeInBrowser(event);"
ondblclick="this.controller.openSelectedNodeWithEvent(event);"
onclick="PlacesOrganizer.onTreeClick(event);">
<treecols id="placeContentColumns">
<treecol label="&col.title.label;" id="title" flex="5" primary="true"

View File

@ -59,6 +59,10 @@
src="chrome://browser/locale/places/placesPopup.properties"/>
</stringbundleset>
<script type="application/x-javascript"
src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript"
src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/x-javascript"
src="chrome://browser/content/places/utils.js"/>
<script type="application/x-javascript"