Bug 1659340, hide menu options if new print UI pref is enabled r=mstriemer

If print.tab_modal.enabled is enabled, we should not display the print preview
menu item, as this will redirect us to the print preview automatically and thus
be redundant with the other print button. We also want to hide the page setup
menu item.

Differential Revision: https://phabricator.services.mozilla.com/D88224
This commit is contained in:
Emma Malysz 2020-08-28 01:23:42 +00:00
Родитель e251f1d7ee
Коммит 9b123f057e
2 изменённых файлов: 20 добавлений и 3 удалений

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

@ -11,7 +11,8 @@
<menu id="file-menu" data-l10n-id="menu-file">
<menupopup id="menu_FilePopup"
onpopupshowing="updateFileMenuUserContextUIVisibility('menu_newUserContext');
updateImportCommandEnabledState();">
updateImportCommandEnabledState();
PrintUtils.updatePrintPreviewMenuHiddenState();">
<menuitem id="menu_newNavigatorTab"
command="cmd_newNavigatorTab"
key="key_newNavigatorTab" data-l10n-id="menu-file-new-tab"/>
@ -58,11 +59,11 @@
<menuseparator/>
#if !defined(MOZ_WIDGET_GTK)
<menuitem id="menu_printSetup"
command="cmd_pageSetup" data-l10n-id="menu-file-print-setup"/>
command="cmd_pageSetup" data-l10n-id="menu-file-print-setup" hidden="true"/>
#endif
#ifndef XP_MACOSX
<menuitem id="menu_printPreview"
command="cmd_printPreview" data-l10n-id="menu-file-print-preview"/>
command="cmd_printPreview" data-l10n-id="menu-file-print-preview" hidden="true"/>
#endif
<menuitem id="menu_print"
key="printKb"

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

@ -139,6 +139,22 @@ var PrintUtils = {
return null;
},
/**
* Updates the hidden state of the "Print preview" and "Page Setup"
* menu items in the file menu depending on the print tab modal pref.
* The print preview menu item is not available on mac.
*/
updatePrintPreviewMenuHiddenState() {
let printPreviewMenuItem = document.getElementById("menu_printPreview");
if (printPreviewMenuItem) {
printPreviewMenuItem.hidden = PRINT_TAB_MODAL;
}
let pageSetupMenuItem = document.getElementById("menu_printSetup");
if (pageSetupMenuItem) {
pageSetupMenuItem.hidden = PRINT_TAB_MODAL;
}
},
/**
* Opens the tab modal version of the print UI for the current tab.
*