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

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

@ -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>
</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); 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")
}
else
{
toolbar.setAttribute("hidden", "true" );
if ( element )
element.setAttribute("checked","false")
}
document.persist(id, "hidden");
document.persist(elementID, "checked");
if (toolbar.hasAttribute("customindex")) toolbar.setAttribute(toggleAttribute, !hidden);
persistCustomToolbar(toolbar); if (element)
element.setAttribute("checked", hidden)
document.persist(id, toggleAttribute);
document.persist(elementID, "checked");
if (toolbar.hasAttribute("customindex"))
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) {
menusep.hidden = true; if (menusep)
menusep.hidden = true;
return; return;
} }
menusep.hidden = false; if (menusep)
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>