Bug 1504543 - Port Bug 1320475 [Fix broken controllers for cmd_printcard and cmd_printcardpreview] to SeaMonkey. r=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Sun, 11 Nov 2018 18:06:41 +0100
changeset 33696 4020b651ce70ee7076ae1be6e035f6c9c7ecb840
parent 33695 5e5555a83f3b182074b7ee704848f97eadef2448
child 33697 d55eedb42e086de9afcbdbe64d60435ce6ba4f6b
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersIanN
bugs1504543, 1320475
Bug 1504543 - Port Bug 1320475 [Fix broken controllers for cmd_printcard and cmd_printcardpreview] to SeaMonkey. r=IanN
suite/mailnews/addrbook/abCommon.js
suite/mailnews/addrbook/addressbook.js
suite/mailnews/addrbook/addressbook.xul
--- a/suite/mailnews/addrbook/abCommon.js
+++ b/suite/mailnews/addrbook/abCommon.js
@@ -32,16 +32,18 @@ var DirPaneController =
 {
   supportsCommand: function(command)
   {
     switch (command) {
       case "cmd_selectAll":
       case "cmd_delete":
       case "button_delete":
       case "cmd_properties":
+      case "cmd_printcard":
+      case "cmd_printcardpreview":
       case "cmd_newlist":
         return true;
       default:
         return false;
     }
   },
 
   isCommandEnabled: function(command)
@@ -89,28 +91,33 @@ var DirPaneController =
           }
           if (disable)
             return false;
         }
 
         // Else return true to enable deletion (default).
         return true;
       }
+      case "cmd_printcard":
+      case "cmd_printcardpreview":
+        return (GetSelectedCardIndex() != -1);
       case "cmd_properties":
         return (getSelectedDirectoryURI() != null);
       case "cmd_newlist":
         return true;
       default:
         return false;
     }
   },
 
   doCommand: function(command)
   {
     switch (command) {
+      case "cmd_printcard":
+      case "cmd_printcardpreview":
       case "cmd_selectAll":
         SendCommandToResultsPane(command);
         break;
       case "cmd_delete":
       case "button_delete":
         if (gDirTree)
           AbDeleteSelectedDirectory();
         break;
--- a/suite/mailnews/addrbook/addressbook.js
+++ b/suite/mailnews/addrbook/addressbook.js
@@ -146,16 +146,18 @@ function SetNameColumn(cmd)
 
   Services.prefs.setIntPref(kPrefMailAddrBookLastNameFirst, prefValue);
 }
 
 function CommandUpdate_AddressBook()
 {
   goUpdateCommand('cmd_delete');
   goUpdateCommand('button_delete');
+  goUpdateCommand('cmd_printcardpreview');
+  goUpdateCommand('cmd_printcard');
   goUpdateCommand('cmd_properties');
   goUpdateCommand('cmd_newlist');
 }
 
 function ResultsPaneSelectionChanged()
 {
   UpdateCardView();
 }
--- a/suite/mailnews/addrbook/addressbook.xul
+++ b/suite/mailnews/addrbook/addressbook.xul
@@ -71,18 +71,18 @@
     <command id="cmd_newNavigator"/>
     <command id="cmd_newPrivateWindow"/>
     <command id="cmd_newEditor"/>
     <command id="cmd_newcard" oncommand="AbNewCard();"/>
     <command id="cmd_newlist" oncommand="AbNewList();"/>
     <command id="cmd_newMessage" oncommand="AbNewMessage();"/>
     <command id="cmd_newim" oncommand="AbIMSelected()"/>
     <command id="cmd_printSetup" oncommand="PrintUtils.showPageSetup()"/>
-    <command id="cmd_printCard" oncommand="AbPrintCard()"/>
-    <command id="cmd_printPreviewCard" oncommand="AbPrintPreviewCard()"/>
+    <command id="cmd_printcard" oncommand="AbPrintCard()"/>
+    <command id="cmd_printcardpreview" oncommand="AbPrintPreviewCard()"/>
     <command id="cmd_printAddressBook" oncommand="AbPrintAddressBook()"/>
     <command id="cmd_printPreviewAddressBook" oncommand="AbPrintPreviewAddressBook()"/>
     <command id="cmd_close" oncommand="AbClose()"/>
     <command id="cmd_properties" oncommand="goDoCommand('cmd_properties');"/>
     <command id="cmd_undo"/>
     <command id="cmd_redo"/>
     <command id="cmd_copy"/>
     <command id="cmd_paste"/>
@@ -112,17 +112,17 @@
   <key id="key_newNavigator"/>
   <key id="key_newPrivateWindow"/>
   <key id="key_newBlankPage"/>
   <key id="key_newMessage"
        key="&newMessageCmd.key;"
        command="cmd_newMessage"
        modifiers="accel"/>
   <key id="key_printCard" key="&printContactViewCmd.key;"
-       command="cmd_printCard" modifiers="accel"/>
+       command="cmd_printcard" modifiers="accel"/>
   <key id="key_close"/>
   <!-- Edit Menu -->
   <key id="key_delete"/>
   <key id="key_delete2"/> <!-- secondary delete key -->
   <key id="key_undo"/>
   <key id="key_redo"/>
   <key id="key_cut"/>
   <key id="key_copy"/>
@@ -246,25 +246,25 @@
               </menupopup>
             </menu>
             <menuitem id="menu_close"/>
             <menuseparator/>
             <menuitem id="menu_printSetup"/>
             <menuitem id="printPreviewMenuItem"
                       label="&printPreviewContactViewCmd.label;"
                       accesskey="&printPreviewContactViewCmd.accesskey;"
-                      command="cmd_printPreviewCard"/>
+                      command="cmd_printcardpreview"/>
             <menuitem id="printPreviewAddressBook"
                       label="&printPreviewAddressBook.label;"
                       accesskey="&printPreviewAddressBook.accesskey;"
                       command="cmd_printPreviewAddressBook"/>
             <menuitem id="printMenuItem" label="&printContactViewCmd.label;"
                       accesskey="&printContactViewCmd.accesskey;"
                       key="key_printCard"
-                      command="cmd_printCard"/>
+                      command="cmd_printcard"/>
             <menuitem id="printAddressBook"
                       label="&printAddressBook.label;"
                       accesskey="&printAddressBook.accesskey;"
                       command="cmd_printAddressBook"/>
           </menupopup>
         </menu>
 
         <menu id="menu_Edit">