# HG changeset patch # User Ian Neal # Date 1588547061 -3600 # Parent 3c2a4fea28fa5af4ca2857b2e5a09c2ba986c642 Bug 1635458 - Add print context menu items and print button to address book toolbar. r=frg a=frg Add print button to toolbar and port the relevant parts of the following bugs to SeaMonkey: * Bug 364133 - Print command added to address book's context menu * Bug 485371 - New gnomestripe icons for address book diff --git a/mailnews/addrbook/content/abResultsPane.js b/mailnews/addrbook/content/abResultsPane.js --- a/mailnews/addrbook/content/abResultsPane.js +++ b/mailnews/addrbook/content/abResultsPane.js @@ -361,16 +361,18 @@ function InvalidateResultsPane() var ResultsPaneController = { supportsCommand: function(command) { switch (command) { case "cmd_selectAll": case "cmd_delete": case "button_delete": + case "cmd_printpreview": + case "cmd_print": case "cmd_printcardpreview": case "cmd_printcard": case "cmd_properties": case "cmd_newlist": case "cmd_newCard": return true; default: return false; @@ -411,16 +413,24 @@ var ResultsPaneController = if (numSelected < 2) goSetMenuValue(command, "valueCard"); else goSetMenuValue(command, "valueCards"); break; } } return (enabled && (numSelected > 0)); + case "cmd_printpreview": + case "cmd_print": + // cmd_printpreview and cmd_print are currently only used in SeaMonkey. + var enabled = (GetNumSelectedCards() > 0); + document.querySelectorAll("[command=cmd_print]").forEach(e => { + e.disabled = !enabled; + }); + return enabled; case "cmd_printcardpreview": case "cmd_printcard": return (GetNumSelectedCards() > 0); case "cmd_properties": // Temporary fix for SeaMonkey (see bug 1318852). // goSetLabelAccesskeyTooltiptext() is only defined in mail/. // This will be removed in due course and therefore the // block wasn't indented. @@ -475,16 +485,24 @@ var ResultsPaneController = case "cmd_selectAll": if (gAbView) gAbView.selectAll(); break; case "cmd_delete": case "button_delete": AbDelete(); break; + case "cmd_printpreview": + // cmd_printpreview is currently only used in SeaMonkey. + AbPrintPreviewCard(); + break; + case "cmd_print": + // cmd_print is currently only used in SeaMonkey. + AbPrintCard(); + break; case "cmd_properties": AbEditSelectedCard(); break; case "cmd_newlist": AbNewList(); break; case "cmd_newCard": AbNewCard(); diff --git a/suite/locales/en-US/chrome/mailnews/addressbook/abMainWindow.dtd b/suite/locales/en-US/chrome/mailnews/addressbook/abMainWindow.dtd --- a/suite/locales/en-US/chrome/mailnews/addressbook/abMainWindow.dtd +++ b/suite/locales/en-US/chrome/mailnews/addressbook/abMainWindow.dtd @@ -75,26 +75,29 @@ + + + diff --git a/suite/mailnews/components/addrbook/content/abCommon.js b/suite/mailnews/components/addrbook/content/abCommon.js --- a/suite/mailnews/components/addrbook/content/abCommon.js +++ b/suite/mailnews/components/addrbook/content/abCommon.js @@ -37,16 +37,18 @@ var DirPaneController = { switch (command) { case "cmd_selectAll": case "cmd_delete": case "button_delete": case "cmd_properties": case "cmd_printcard": case "cmd_printcardpreview": + case "cmd_print": + case "cmd_printpreview": case "cmd_newlist": case "cmd_newCard": return true; default: return false; } }, @@ -99,16 +101,22 @@ var DirPaneController = } // Else return true to enable deletion (default). return true; } case "cmd_printcard": case "cmd_printcardpreview": return (GetSelectedCardIndex() != -1); + case "cmd_print": + case "cmd_printpreview": + document.querySelectorAll("[command=cmd_print]").forEach(e => { + e.disabled = false; + }); + return true; case "cmd_properties": return (getSelectedDirectoryURI() != null); case "cmd_newlist": case "cmd_newCard": return true; default: return false; } @@ -117,16 +125,22 @@ var DirPaneController = doCommand: function(command) { switch (command) { case "cmd_printcard": case "cmd_printcardpreview": case "cmd_selectAll": SendCommandToResultsPane(command); break; + case "cmd_print": + AbPrintAddressBook(); + break; + case "cmd_printpreview": + AbPrintPreviewAddressBook(); + break; case "cmd_delete": case "button_delete": if (gDirTree) AbDeleteSelectedDirectory(); break; case "cmd_properties": AbEditSelectedDirectory(); break; diff --git a/suite/mailnews/components/addrbook/content/addressbook.js b/suite/mailnews/components/addrbook/content/addressbook.js --- a/suite/mailnews/components/addrbook/content/addressbook.js +++ b/suite/mailnews/components/addrbook/content/addressbook.js @@ -147,16 +147,17 @@ function SetNameColumn(cmd) } function CommandUpdate_AddressBook() { goUpdateCommand('cmd_delete'); goUpdateCommand('button_delete'); goUpdateCommand('cmd_printcardpreview'); goUpdateCommand('cmd_printcard'); + goUpdateCommand('cmd_print'); goUpdateCommand('cmd_properties'); goUpdateCommand('cmd_newlist'); } function ResultsPaneSelectionChanged() { UpdateCardView(); } diff --git a/suite/mailnews/components/addrbook/content/addressbook.xul b/suite/mailnews/components/addrbook/content/addressbook.xul --- a/suite/mailnews/components/addrbook/content/addressbook.xul +++ b/suite/mailnews/components/addrbook/content/addressbook.xul @@ -70,16 +70,18 @@ + + @@ -171,16 +173,20 @@ label="&newContactButton.label;" accesskey="&newContactButton.accesskey;" command="cmd_newCard"/> + + @@ -256,31 +266,35 @@ accesskey="&newMessageCmd.accesskey;" key="key_newMessage" command="cmd_newMessage"/> - #ifndef XP_MACOSX +#endif + + + + +#ifndef XP_MACOSX #endif - @@ -497,16 +511,20 @@ removable="true" oncommand="AbIMSelected();"/> +