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);
}
else {
function restoreAttr(attrName) {
var savedAttr = "saved-" + attrName;
if (els[i].hasAttribute(savedAttr)) {
var savedValue = els[i].getAttribute(savedAttr);
els[i].setAttribute(attrName, savedValue);
els[i].removeAttribute(savedAttr);
}
}
restoreAttr("mode");
restoreAttr("iconsize");
restoreAttr("context"); // XXX see above
this.restoreAttribute(els[i], "mode");
this.restoreAttribute(els[i], "iconsize");
this.restoreAttribute(els[i], "context"); // XXX see above
els[i].removeAttribute("inFullscreen");
}
} else if (els[i].getAttribute("type") == "menubar") {
if (aShow)
els[i].removeAttribute("autohide");
else
if (aShow) {
this.restoreAttribute(els[i], "autohide");
}
else {
els[i].setAttribute("saved-autohide",
els[i].getAttribute("autohide"));
els[i].setAttribute("autohide", "true");
}
} else {
// use moz-collapsed so it doesn't persist hidden/collapsed,
// so that new windows don't have missing toolbars
@ -83,6 +78,16 @@ var FullScreen =
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;
}
/* ::::: 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
notifications are */
.notification-anchor-icon {
@ -111,14 +103,6 @@ popupnotification-centeritem {
-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 ::::: */
.textbox-input-box {

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

@ -122,7 +122,10 @@
</popupset>
<toolbox id="placesToolbox">
<toolbar class="chromeclass-toolbar" id="placesToolbar" align="center">
<toolbar id="placesToolbar"
class="chromeclass-toolbar"
type="menubar"
align="center">
<menubar id="placesMenu">
<menu id="menu_File">
<menupopup id="menu_FilePopup">
@ -175,7 +178,10 @@
</menu>
<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"
label="&view.columns.label;" accesskey="&view.columns.accesskey;">
<menupopup onpopupshowing="ViewMenu.fillWithColumns(event, null, null, 'checkbox', null);"
@ -185,7 +191,7 @@
<menu id="viewSort" label="&view.sort.label;"
accesskey="&view.sort.accesskey;">
<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"
label="&view.unsorted.label;" accesskey="&view.unsorted.accesskey;"
oncommand="ViewMenu.setSortColumn(null, null);"/>
@ -248,7 +254,6 @@
tooltiptext="&forwardButton.tooltip;"
disabled="true"/>
<textbox id="searchFilter"
clickSelectsAll="true"
type="search"

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

@ -148,3 +148,19 @@ statusbar[lwthemefooter="true"] {
#sync-notifications > 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,43 +66,53 @@
</popupset>
<toolbox id="history-toolbox">
<menubar id="history-menu"
grippytooltiptext="&menuBar.tooltip;">
<menu id="menu_File">
<menupopup id="menu_FilePopup">
<menuitem id="menu_close"/>
</menupopup>
</menu>
<toolbar id="placesToolbar"
type="menubar">
<menubar id="history-menu"
grippytooltiptext="&menuBar.tooltip;">
<menu id="menu_Edit">
<menupopup>
<menuitem id="menu_cut"/>
<menuitem id="menu_copy"/>
<menuitem id="menu_delete"/>
<menuitem id="menu_deleteByHostname" command="placesCmd_delete:hostname"/>
<menuitem id="menu_deleteByDomain" command="placesCmd_delete:domain"/>
<menuseparator/>
<menuitem id="menu_selectAll"/>
</menupopup>
</menu>
<menu id="menu_View">
<menupopup id="viewPopup"/>
</menu>
<menu id="tasksMenu"/>
<menu id="windowMenu"/>
<menu id="menu_Help"/>
</menubar>
<toolbar class="chromeclass-toolbar"
id="placesToolbar"
align="center"
grippytooltiptext="&searchBar.tooltip;">
<textbox id="search-box"
clickSelectsAll="true"
type="search"
aria-controls="historyTree"
placeholder="&search.placeholder;"
oncommand="searchHistory(this.value);"/>
</toolbar>
<menu id="menu_File">
<menupopup id="menu_FilePopup">
<menuitem id="menu_close"/>
</menupopup>
</menu>
<menu id="menu_Edit">
<menupopup>
<menuitem id="menu_cut"/>
<menuitem id="menu_copy"/>
<menuitem id="menu_delete"/>
<menuitem id="menu_deleteByHostname" command="placesCmd_delete:hostname"/>
<menuitem id="menu_deleteByDomain" command="placesCmd_delete:domain"/>
<menuseparator/>
<menuitem id="menu_selectAll"/>
</menupopup>
</menu>
<menu id="menu_View">
<menupopup id="viewPopup"
onpopupshowing="onViewToolbarsPopupShowing(event)"
oncommand="onViewToolbarCommand(event);">
<menuseparator id="toolbarmode-sep"/>
</menupopup>
</menu>
<menu id="tasksMenu"/>
<menu id="windowMenu"/>
<menu id="menu_Help"/>
</menubar>
</toolbar>
<toolbar class="chromeclass-toolbar"
id="placesSearchToolbar"
align="center"
grippytooltiptext="&searchBar.tooltip;">
<textbox id="search-box"
clickSelectsAll="true"
type="search"
aria-controls="historyTree"
placeholder="&search.placeholder;"
oncommand="searchHistory(this.value);"/>
</toolbar>
</toolbox>
<tree id="historyTree"

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

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

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

@ -66,4 +66,24 @@
command="cmd_openHelp"/>
</keyset>
</overlay>
<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>

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

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

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

@ -59,12 +59,10 @@
<key id="key_toggleFolderPane" keycode="VK_F9"/>
#ifdef XP_WIN
<menupopup id="helpPopup">
<menuitem label="&helpForIEUsers.label;" accesskey="&helpForIEUsers.accesskey;" insertafter="help"
oncommand="openHelp('ieusers', 'chrome://communicator/locale/help/suitehelp.rdf');"/>
</menupopup>
#endif
<!-- Tasks Keys -->
<keyset id="tasksKeys">
@ -73,4 +71,24 @@
command="cmd_openHelp"/>
</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>

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

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

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

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

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

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

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

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