Bug 456535 - On Windows, users should be able to hide the menubar and show it with the alt key. r=mano, ui-r=faaborg

This commit is contained in:
Dão Gottwald 2009-06-13 08:08:20 +02:00
Родитель eea852f5dd
Коммит 976c525965
3 изменённых файлов: 16 добавлений и 6 удалений

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

@ -4530,14 +4530,15 @@ function onViewToolbarsPopupShowing(aEvent)
for (i = 0; i < gNavToolbox.childNodes.length; ++i) { for (i = 0; i < gNavToolbox.childNodes.length; ++i) {
var toolbar = gNavToolbox.childNodes[i]; var toolbar = gNavToolbox.childNodes[i];
var toolbarName = toolbar.getAttribute("toolbarname"); var toolbarName = toolbar.getAttribute("toolbarname");
var type = toolbar.getAttribute("type"); if (toolbarName) {
if (toolbarName && type != "menubar") { let menuItem = document.createElement("menuitem");
var menuItem = document.createElement("menuitem"); let hidingAttribute = toolbar.getAttribute("type") == "menubar" ?
"autohide" : "collapsed";
menuItem.setAttribute("toolbarindex", i); menuItem.setAttribute("toolbarindex", i);
menuItem.setAttribute("type", "checkbox"); menuItem.setAttribute("type", "checkbox");
menuItem.setAttribute("label", toolbarName); menuItem.setAttribute("label", toolbarName);
menuItem.setAttribute("accesskey", toolbar.getAttribute("accesskey")); menuItem.setAttribute("accesskey", toolbar.getAttribute("accesskey"));
menuItem.setAttribute("checked", toolbar.getAttribute("collapsed") != "true"); menuItem.setAttribute("checked", toolbar.getAttribute(hidingAttribute) != "true");
popup.insertBefore(menuItem, firstMenuItem); popup.insertBefore(menuItem, firstMenuItem);
menuItem.addEventListener("command", onViewToolbarCommand, false); menuItem.addEventListener("command", onViewToolbarCommand, false);
@ -4550,9 +4551,12 @@ function onViewToolbarCommand(aEvent)
{ {
var index = aEvent.originalTarget.getAttribute("toolbarindex"); var index = aEvent.originalTarget.getAttribute("toolbarindex");
var toolbar = gNavToolbox.childNodes[index]; var toolbar = gNavToolbox.childNodes[index];
var hidingAttribute = toolbar.getAttribute("type") == "menubar" ?
"autohide" : "collapsed";
toolbar.collapsed = aEvent.originalTarget.getAttribute("checked") != "true"; toolbar.setAttribute(hidingAttribute,
document.persist(toolbar.id, "collapsed"); aEvent.originalTarget.getAttribute("checked") != "true");
document.persist(toolbar.id, hidingAttribute);
} }
function displaySecurityInfo() function displaySecurityInfo()

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

@ -284,6 +284,10 @@
<toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true" <toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
defaultset="menubar-items" defaultset="menubar-items"
mode="icons" iconsize="small" defaulticonsize="small" mode="icons" iconsize="small" defaulticonsize="small"
#ifdef XP_WIN
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"
#endif
context="toolbar-context-menu"> context="toolbar-context-menu">
<toolbaritem id="menubar-items" align="center"> <toolbaritem id="menubar-items" align="center">
# The entire main menubar is placed into browser-menubar.inc, so that it can be shared by # The entire main menubar is placed into browser-menubar.inc, so that it can be shared by

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

@ -32,6 +32,8 @@
<!ENTITY goOfflineCmd.label "Work Offline"> <!ENTITY goOfflineCmd.label "Work Offline">
<!ENTITY goOfflineCmd.accesskey "w"> <!ENTITY goOfflineCmd.accesskey "w">
<!ENTITY menubarCmd.label "Menu Bar">
<!ENTITY menubarCmd.accesskey "M">
<!ENTITY navbarCmd.label "Navigation Toolbar"> <!ENTITY navbarCmd.label "Navigation Toolbar">
<!ENTITY navbarCmd.accesskey "N"> <!ENTITY navbarCmd.accesskey "N">
<!ENTITY personalbarCmd.label "Bookmarks Toolbar"> <!ENTITY personalbarCmd.label "Bookmarks Toolbar">