Bug 239429 - display URL in status bar while using bookmark & history sidebars. patch from Michael Schonfeld <dev@schonfeld.org>, r=me, a=beltzner.

This commit is contained in:
mozilla.mano@sent.com 2008-02-20 17:41:00 -08:00
parent 5fcc0a94f2
commit f9c1f1ecc3
3 changed files with 42 additions and 4 deletions

View File

@ -49,7 +49,8 @@
<page id="bookmarksPanel"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="init();">
onload="init();"
onunload="SidebarUtils.clearURLFromStausBar();">
<script type="application/x-javascript"
src="chrome://browser/content/bookmarks/sidebarUtils.js"/>
@ -72,7 +73,9 @@
hidecolumnpicker="true"
context="placesContext"
onkeypress="if (event.keyCode == 13) this.controller.openSelectedNodeWithEvent(event);"
onclick="SidebarUtils.handleClick(this, event);">
onclick="SidebarUtils.handleClick(this, event);"
onmousemove="SidebarUtils.handleTreeMouseMove(event);"
onmouseout="SidebarUtils.clearURLFromStausBar();">
<treecols>
<treecol id="title" flex="1" primary="true" hideheader="true"/>
</treecols>

View File

@ -57,7 +57,8 @@
<page id="history-panel" orient="vertical"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="HistorySidebarInit();">
onload="HistorySidebarInit();"
onunload="SidebarUtils.clearURLFromStausBar();">
<script type="application/x-javascript"
src="chrome://browser/content/bookmarks/sidebarUtils.js"/>
@ -120,7 +121,9 @@
context="placesContext"
onkeypress="if (event.keyCode == 13) this.controller.openSelectedNodeWithEvent(event);"
hidecolumnpicker="true"
onclick="SidebarUtils.handleClick(this, event, true);">
onclick="SidebarUtils.handleClick(this, event, true);"
onmousemove="SidebarUtils.handleTreeMouseMove(event);"
onmouseout="SidebarUtils.clearURLFromStausBar();">
<treecols>
<treecol id="title" flex="1" primary="true" hideheader="true"/>
</treecols>

View File

@ -69,5 +69,37 @@ var SidebarUtils = {
tbo.view.selection.select(row.value);
aTree.controller.openSelectedNodeWithEvent(aEvent);
}
},
/**
* The following function displays the URL of a node that is being
* hovered over.
*/
handleTreeMouseMove: function SU_handleTreeMouseMove(aEvent) {
if (aEvent.target.localName != "treechildren")
return;
var tree = aEvent.target.parentNode;
var tbo = tree.treeBoxObject;
var row = { }, col = { }, obj = { };
tbo.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
// row.value is -1 when the mouse is hovering an empty area within the tree.
// To avoid showing a URL from a previously hovered node,
// for a currently hovered non-url node, we must clear the URL from the
// status bar in these cases.
if (row.value != -1) {
var cell = tree.view.nodeForTreeIndex(row.value);
if (PlacesUtils.nodeIsURI(cell))
window.top.XULBrowserWindow.setOverLink(cell.uri, null);
else
this.clearURLFromStausBar();
}
else
this.clearURLFromStausBar();
},
clearURLFromStausBar: function SU_clearURLFromStausBar() {
window.top.XULBrowserWindow.setOverLink("", null);
}
};