Bug 1153577 - Users should be able to hide the menubar and show it with the ALT key r=Neil a=IanN CLOSED TREE

This commit is contained in:
Philip Chee 2015-07-23 01:12:36 +08:00
Родитель 5a370baf27
Коммит b931531e14
13 изменённых файлов: 167 добавлений и 104 удалений

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

@ -54,26 +54,21 @@ var FullScreen =
els[i].setAttribute("inFullscreen", true); els[i].setAttribute("inFullscreen", true);
} }
else { else {
function restoreAttr(attrName) { this.restoreAttribute(els[i], "mode");
var savedAttr = "saved-" + attrName; this.restoreAttribute(els[i], "iconsize");
if (els[i].hasAttribute(savedAttr)) { this.restoreAttribute(els[i], "context"); // XXX see above
var savedValue = els[i].getAttribute(savedAttr);
els[i].setAttribute(attrName, savedValue);
els[i].removeAttribute(savedAttr);
}
}
restoreAttr("mode");
restoreAttr("iconsize");
restoreAttr("context"); // XXX see above
els[i].removeAttribute("inFullscreen"); els[i].removeAttribute("inFullscreen");
} }
} else if (els[i].getAttribute("type") == "menubar") { } else if (els[i].getAttribute("type") == "menubar") {
if (aShow) if (aShow) {
els[i].removeAttribute("autohide"); this.restoreAttribute(els[i], "autohide");
else }
else {
els[i].setAttribute("saved-autohide",
els[i].getAttribute("autohide"));
els[i].setAttribute("autohide", "true"); els[i].setAttribute("autohide", "true");
}
} else { } else {
// use moz-collapsed so it doesn't persist hidden/collapsed, // use moz-collapsed so it doesn't persist hidden/collapsed,
// so that new windows don't have missing toolbars // so that new windows don't have missing toolbars
@ -83,6 +78,16 @@ var FullScreen =
els[i].setAttribute("moz-collapsed", "true"); els[i].setAttribute("moz-collapsed", "true");
} }
} }
},
restoreAttribute: function(element, attributeName)
{
var savedAttribute = "saved-" + attributeName;
if (element.hasAttribute(savedAttribute)) {
var savedValue = element.getAttribute(savedAttribute);
element.setAttribute(attributeName, savedValue);
element.removeAttribute(savedAttribute);
}
} }
}; };

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

@ -77,14 +77,6 @@ searchbar {
display: none; display: none;
} }
/* ::::: autohide the menubar for full screen on linux too ::::: */
#toolbar-menubar[autohide="true"]
{
-moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar-menubar-autohide");
overflow: hidden;
}
/* notification anchors should only be visible when their associated /* notification anchors should only be visible when their associated
notifications are */ notifications are */
.notification-anchor-icon { .notification-anchor-icon {
@ -111,14 +103,6 @@ popupnotification-centeritem {
-moz-binding: url("chrome://communicator/content/bindings/notification.xml#addon-progress-popup-notification"); -moz-binding: url("chrome://communicator/content/bindings/notification.xml#addon-progress-popup-notification");
} }
#toolbar-menubar[autohide="true"][inactive="true"]
{
min-height: 0px !important;
height: 0px !important;
-moz-appearance: none !important;
border-style: none !important;
}
/* ::::: Wallpaper fix for Bug 435652. Remove when Bug 204743 is fixed ::::: */ /* ::::: Wallpaper fix for Bug 435652. Remove when Bug 204743 is fixed ::::: */
.textbox-input-box { .textbox-input-box {

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

@ -122,7 +122,10 @@
</popupset> </popupset>
<toolbox id="placesToolbox"> <toolbox id="placesToolbox">
<toolbar class="chromeclass-toolbar" id="placesToolbar" align="center"> <toolbar id="placesToolbar"
class="chromeclass-toolbar"
type="menubar"
align="center">
<menubar id="placesMenu"> <menubar id="placesMenu">
<menu id="menu_File"> <menu id="menu_File">
<menupopup id="menu_FilePopup"> <menupopup id="menu_FilePopup">
@ -175,7 +178,10 @@
</menu> </menu>
<menu id="menu_View"> <menu id="menu_View">
<menupopup id="menu_ViewPopup"> <menupopup id="menu_ViewPopup"
onpopupshowing="onViewToolbarsPopupShowing(event)"
oncommand="onViewToolbarCommand(event);">
<menuseparator id="toolbarmode-sep"/>
<menu id="viewColumns" <menu id="viewColumns"
label="&view.columns.label;" accesskey="&view.columns.accesskey;"> label="&view.columns.label;" accesskey="&view.columns.accesskey;">
<menupopup onpopupshowing="ViewMenu.fillWithColumns(event, null, null, 'checkbox', null);" <menupopup onpopupshowing="ViewMenu.fillWithColumns(event, null, null, 'checkbox', null);"
@ -185,7 +191,7 @@
<menu id="viewSort" label="&view.sort.label;" <menu id="viewSort" label="&view.sort.label;"
accesskey="&view.sort.accesskey;"> accesskey="&view.sort.accesskey;">
<menupopup onpopupshowing="ViewMenu.populateSortMenu(event);" <menupopup onpopupshowing="ViewMenu.populateSortMenu(event);"
oncommand="ViewMenu.setSortColumn(event.target.column, null);"> oncommand="ViewMenu.setSortColumn(event.target.column, null); event.stopPropagation();">
<menuitem id="viewUnsorted" type="radio" name="columns" <menuitem id="viewUnsorted" type="radio" name="columns"
label="&view.unsorted.label;" accesskey="&view.unsorted.accesskey;" label="&view.unsorted.label;" accesskey="&view.unsorted.accesskey;"
oncommand="ViewMenu.setSortColumn(null, null);"/> oncommand="ViewMenu.setSortColumn(null, null);"/>
@ -248,7 +254,6 @@
tooltiptext="&forwardButton.tooltip;" tooltiptext="&forwardButton.tooltip;"
disabled="true"/> disabled="true"/>
<textbox id="searchFilter" <textbox id="searchFilter"
clickSelectsAll="true" clickSelectsAll="true"
type="search" type="search"

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

@ -148,3 +148,19 @@ statusbar[lwthemefooter="true"] {
#sync-notifications > notification { #sync-notifications > notification {
-moz-binding: url("chrome://communicator/content/sync/syncNotification.xml#notification"); -moz-binding: url("chrome://communicator/content/sync/syncNotification.xml#notification");
} }
/******* autohide toolbars *******/
toolbar[type="menubar"][autohide="true"]
{
-moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar-menubar-autohide");
overflow: hidden;
}
toolbar[type="menubar"][autohide="true"][inactive="true"]
{
min-height: 0px !important;
height: 0px !important;
-moz-appearance: none !important;
border-style: none !important;
}

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

@ -66,8 +66,11 @@
</popupset> </popupset>
<toolbox id="history-toolbox"> <toolbox id="history-toolbox">
<toolbar id="placesToolbar"
type="menubar">
<menubar id="history-menu" <menubar id="history-menu"
grippytooltiptext="&menuBar.tooltip;"> grippytooltiptext="&menuBar.tooltip;">
<menu id="menu_File"> <menu id="menu_File">
<menupopup id="menu_FilePopup"> <menupopup id="menu_FilePopup">
<menuitem id="menu_close"/> <menuitem id="menu_close"/>
@ -85,15 +88,22 @@
<menuitem id="menu_selectAll"/> <menuitem id="menu_selectAll"/>
</menupopup> </menupopup>
</menu> </menu>
<menu id="menu_View"> <menu id="menu_View">
<menupopup id="viewPopup"/> <menupopup id="viewPopup"
onpopupshowing="onViewToolbarsPopupShowing(event)"
oncommand="onViewToolbarCommand(event);">
<menuseparator id="toolbarmode-sep"/>
</menupopup>
</menu> </menu>
<menu id="tasksMenu"/> <menu id="tasksMenu"/>
<menu id="windowMenu"/> <menu id="windowMenu"/>
<menu id="menu_Help"/> <menu id="menu_Help"/>
</menubar> </menubar>
</toolbar>
<toolbar class="chromeclass-toolbar" <toolbar class="chromeclass-toolbar"
id="placesToolbar" id="placesSearchToolbar"
align="center" align="center"
grippytooltiptext="&searchBar.tooltip;"> grippytooltiptext="&searchBar.tooltip;">
<textbox id="search-box" <textbox id="search-box"

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

@ -102,8 +102,8 @@ comm.jar:
#ifdef XP_MACOSX #ifdef XP_MACOSX
content/communicator/platformCommunicatorOverlay.xul (mac/platformCommunicatorOverlay.xul) content/communicator/platformCommunicatorOverlay.xul (mac/platformCommunicatorOverlay.xul)
#else #else
#ifdef XP_WIN32 #ifdef XP_WIN
* content/communicator/platformCommunicatorOverlay.xul (win/platformCommunicatorOverlay.xul) content/communicator/platformCommunicatorOverlay.xul (win/platformCommunicatorOverlay.xul)
#else #else
content/communicator/platformCommunicatorOverlay.xul (unix/platformCommunicatorOverlay.xul) content/communicator/platformCommunicatorOverlay.xul (unix/platformCommunicatorOverlay.xul)
#endif #endif

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

@ -66,4 +66,24 @@
command="cmd_openHelp"/> command="cmd_openHelp"/>
</keyset> </keyset>
<toolbar id="toolbar-menubar"
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"/>
<toolbar id="addrbook-toolbar-menubar2"
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"/>
<toolbar id="compose-toolbar-menubar2"
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"/>
<toolbar id="mail-toolbar-menubar2"
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"/>
<toolbar id="placesToolbar"
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"/>
</overlay> </overlay>

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

@ -250,33 +250,27 @@ function goPreferences(paneID)
paneID); paneID);
} }
function goToggleToolbar( id, elementID ) function goToggleToolbar(id, elementID)
{ {
var toolbar = document.getElementById( id ); var toolbar = document.getElementById(id);
var element = document.getElementById( elementID ); if (!toolbar)
if ( toolbar ) return;
{
var attribValue = toolbar.getAttribute("hidden") ;
if ( attribValue == "true" ) var type = toolbar.getAttribute("type");
{ var toggleAttribute = type == "menubar" ? "autohide" : "hidden";
toolbar.setAttribute("hidden", "false" ); var hidden = toolbar.getAttribute(toggleAttribute) == "true";
if ( element ) var element = document.getElementById(elementID);
element.setAttribute("checked","true")
} toolbar.setAttribute(toggleAttribute, !hidden);
else if (element)
{ element.setAttribute("checked", hidden)
toolbar.setAttribute("hidden", "true" );
if ( element ) document.persist(id, toggleAttribute);
element.setAttribute("checked","false")
}
document.persist(id, "hidden");
document.persist(elementID, "checked"); document.persist(elementID, "checked");
if (toolbar.hasAttribute("customindex")) if (toolbar.hasAttribute("customindex"))
persistCustomToolbar(toolbar); persistCustomToolbar(toolbar);
}
} }
var gCustomizeSheet = false; var gCustomizeSheet = false;
@ -367,19 +361,24 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint)
var menubar = toolbox.getElementsByAttribute("type", "menubar").item(0); var menubar = toolbox.getElementsByAttribute("type", "menubar").item(0);
if (!menubar || !toolbars.length) { if (!menubar || !toolbars.length) {
if (menusep)
menusep.hidden = true; menusep.hidden = true;
return; return;
} }
if (menusep)
menusep.hidden = false; menusep.hidden = false;
toolbars.forEach(function(bar) { toolbars.forEach(function(bar) {
let type = bar.getAttribute("type");
let toggleAttribute = type == "menubar" ? "autohide" : "hidden";
let isHidden = bar.getAttribute(toggleAttribute) == "true";
let menuItem = document.createElement("menuitem"); let menuItem = document.createElement("menuitem");
menuItem.setAttribute("id", "toggle_" + bar.id); menuItem.setAttribute("id", "toggle_" + bar.id);
menuItem.setAttribute("toolbarid", bar.id); menuItem.setAttribute("toolbarid", bar.id);
menuItem.setAttribute("type", "checkbox"); menuItem.setAttribute("type", "checkbox");
menuItem.setAttribute("label", bar.getAttribute("toolbarname")); menuItem.setAttribute("label", bar.getAttribute("toolbarname"));
menuItem.setAttribute("accesskey", bar.getAttribute("accesskey")); menuItem.setAttribute("accesskey", bar.getAttribute("accesskey"));
menuItem.setAttribute("checked", !bar.hidden); menuItem.setAttribute("checked", !isHidden);
popup.insertBefore(menuItem, firstMenuItem); popup.insertBefore(menuItem, firstMenuItem);
}); });
} }

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

@ -59,12 +59,10 @@
<key id="key_toggleFolderPane" keycode="VK_F9"/> <key id="key_toggleFolderPane" keycode="VK_F9"/>
#ifdef XP_WIN
<menupopup id="helpPopup"> <menupopup id="helpPopup">
<menuitem label="&helpForIEUsers.label;" accesskey="&helpForIEUsers.accesskey;" insertafter="help" <menuitem label="&helpForIEUsers.label;" accesskey="&helpForIEUsers.accesskey;" insertafter="help"
oncommand="openHelp('ieusers', 'chrome://communicator/locale/help/suitehelp.rdf');"/> oncommand="openHelp('ieusers', 'chrome://communicator/locale/help/suitehelp.rdf');"/>
</menupopup> </menupopup>
#endif
<!-- Tasks Keys --> <!-- Tasks Keys -->
<keyset id="tasksKeys"> <keyset id="tasksKeys">
@ -73,4 +71,24 @@
command="cmd_openHelp"/> command="cmd_openHelp"/>
</keyset> </keyset>
<toolbar id="toolbar-menubar"
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"/>
<toolbar id="addrbook-toolbar-menubar2"
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"/>
<toolbar id="compose-toolbar-menubar2"
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"/>
<toolbar id="mail-toolbar-menubar2"
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"/>
<toolbar id="placesToolbar"
toolbarname="&menubarCmd.label;"
accesskey="&menubarCmd.accesskey;"/>
</overlay> </overlay>

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

@ -31,3 +31,6 @@
<!ENTITY ctrlKey.label "Ctrl"> <!ENTITY ctrlKey.label "Ctrl">
<!ENTITY altKey.label "Alt"> <!ENTITY altKey.label "Alt">
<!ENTITY shiftKey.label "Shift"> <!ENTITY shiftKey.label "Shift">
<!ENTITY menubarCmd.label "Menu Bar">
<!ENTITY menubarCmd.accesskey "e">

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

@ -37,3 +37,5 @@
<!ENTITY altKey.label "Alt"> <!ENTITY altKey.label "Alt">
<!ENTITY shiftKey.label "Shift"> <!ENTITY shiftKey.label "Shift">
<!ENTITY menubarCmd.label "Menu Bar">
<!ENTITY menubarCmd.accesskey "e">

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

@ -115,7 +115,7 @@
<!ENTITY showMessengerToolbarCmd.label "Mail Toolbar"> <!ENTITY showMessengerToolbarCmd.label "Mail Toolbar">
<!ENTITY showMessengerToolbarCmd.accesskey "M"> <!ENTITY showMessengerToolbarCmd.accesskey "M">
<!ENTITY showSearchToolbarCmd.label "Search Bar"> <!ENTITY showSearchToolbarCmd.label "Search Bar">
<!ENTITY showSearchToolbarCmd.accesskey "e"> <!ENTITY showSearchToolbarCmd.accesskey "a">
<!ENTITY showTabsToolbarCmd.label "Tabs Toolbar"> <!ENTITY showTabsToolbarCmd.label "Tabs Toolbar">
<!ENTITY showTabsToolbarCmd.accesskey "T"> <!ENTITY showTabsToolbarCmd.accesskey "T">

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

@ -115,7 +115,8 @@
<vbox id="titlebar"/> <vbox id="titlebar"/>
<toolbox id="mail-toolbox" class="toolbox-top"> <toolbox id="mail-toolbox" class="toolbox-top">
<toolbar id="mail-toolbar-menubar2"> <toolbar id="mail-toolbar-menubar2"
type="menubar">
<toolbaritem id="menubar-items"> <toolbaritem id="menubar-items">
<menubar id="mail-menubar"/> <menubar id="mail-menubar"/>
</toolbaritem> </toolbaritem>