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
Родитель 0b04b8f43d
Коммит 3bb82d5fd9
5 изменённых файлов: 27 добавлений и 75 удалений

Просмотреть файл

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

Просмотреть файл

@ -309,13 +309,13 @@ PlacesController.prototype = {
this.selectAll(); this.selectAll();
break; break;
case "placesCmd_open": case "placesCmd_open":
this.openLinkInCurrentWindow(); this.openSelectedNodeIn("current");
break; break;
case "placesCmd_open:window": case "placesCmd_open:window":
this.openLinkInNewWindow(); this.openSelectedNodeIn("window");
break; break;
case "placesCmd_open:tab": case "placesCmd_open:tab":
this.openLinkInNewTab(); this.openSelectedNodeIn("tab");
break; break;
case "placesCmd_open:tabs": case "placesCmd_open:tabs":
this.openLinksInTabs(); this.openLinksInTabs();
@ -855,15 +855,20 @@ PlacesController.prototype = {
* The DOM Mouse event with modifier keys set that track the user's * The DOM Mouse event with modifier keys set that track the user's
* preferred destination window or tab. * preferred destination window or tab.
*/ */
openSelectedNodeInBrowser: function PC_openSelectedNodeInBrowser(aEvent) { openSelectedNodeWithEvent: function PC_openSelectedNodeWithEvent(aEvent) {
var node = this._view.selectedURINode; var node = this._view.selectedURINode;
if (node) { if (node)
var browser = this._getBrowserWindow(); openUILink(node.uri, aEvent);
if (browser) },
browser.openUILink(node.uri, aEvent, false, false);
else /**
this._openBrowserWith(node.uri); * 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 * 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 // Get the start index to open tabs at
// XXX todo: no-browser-window-case // XXX todo: no-browser-window-case
var browserWindow = this._getBrowserWindow(); var browserWindow = getTopWin();
var browser = browserWindow.getBrowser(); var browser = browserWindow.getBrowser();
var tabPanels = browser.browsers; var tabPanels = browser.browsers;
var tabCount = tabPanels.length; var tabCount = tabPanels.length;
@ -1140,7 +1086,7 @@ PlacesController.prototype = {
for (var i = 0; i < nodes.length; ++i) { for (var i = 0; i < nodes.length; ++i) {
if (PlacesUtils.nodeIsURI(nodes[i])) if (PlacesUtils.nodeIsURI(nodes[i]))
this._getBrowserWindow().openNewTabWith(nodes[i].uri, null, null); getTopWin().openNewTabWith(nodes[i].uri, null, null);
} }
} }
}, },

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -59,6 +59,10 @@
src="chrome://browser/locale/places/placesPopup.properties"/> src="chrome://browser/locale/places/placesPopup.properties"/>
</stringbundleset> </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" <script type="application/x-javascript"
src="chrome://browser/content/places/utils.js"/> src="chrome://browser/content/places/utils.js"/>
<script type="application/x-javascript" <script type="application/x-javascript"