Bug 1300845 - Fix keyboard shortcuts for creating new events/tasks; r=MakeMyDay a=philipp DONTBUILD
authorPaul Morris <paul@paulwmorris.com>
Mon, 16 Jan 2017 17:24:12 -0500
changeset 27787 5a18517aaea59ecde013dbb60a95d8131539e3d6
parent 27786 e340ac536f0673346bbfd1abe4be866be11f5d40
child 27788 b43fc1f36b9f5462116505820f196e4a84378fcb
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMakeMyDay, philipp
bugs1300845
Bug 1300845 - Fix keyboard shortcuts for creating new events/tasks; r=MakeMyDay a=philipp DONTBUILD
calendar/lightning/content/lightning-item-iframe.js
calendar/lightning/content/lightning-item-panel.js
calendar/lightning/content/lightning-item-panel.xul
--- a/calendar/lightning/content/lightning-item-iframe.js
+++ b/calendar/lightning/content/lightning-item-iframe.js
@@ -186,16 +186,18 @@ function receiveMessage(aEvent) {
     }
     switch (aEvent.data.command) {
         case "editAttendees": editAttendees(); break;
         case "attachURL": attachURL(); break;
         case "onCommandDeleteItem": onCommandDeleteItem(); break;
         case "onCommandSave": onCommandSave(aEvent.data.isClosing); break;
         case "onAccept": onAccept(); break;
         case "onCancel": onCancel(aEvent.data.iframeId); break;
+        case "openNewEvent": openNewEvent(); break;
+        case "openNewTask": openNewTask(); break;
         case "editConfigState": {
             Object.assign(gConfig, aEvent.data.argument);
             updateConfigState(aEvent.data.argument);
             if (gNewItemUI) {
                 gTopComponent.importState(aEvent.data.argument);
             }
             break;
         }
@@ -1746,39 +1748,16 @@ function openNewEvent() {
  */
 function openNewTask() {
     let item = window.calendarItem;
     let args = window.arguments[0];
     args.onNewTodo(item.calendar);
 }
 
 /**
- * Open a new Thunderbird compose window.
- */
-function openNewMessage() {
-    MailServices.compose.OpenComposeWindow(null,
-                                           null,
-                                           null,
-                                           Components.interfaces.nsIMsgCompType.New,
-                                           Components.interfaces.nsIMsgCompFormat.Default,
-                                           null,
-                                           null);
-}
-
-/**
- * Open a new addressbook window
- */
-function openNewCardDialog() {
-    window.openDialog(
-        "chrome://messenger/content/addressbook/abNewCardDialog.xul",
-        "",
-        "chrome,modal,resizable=no,centerscreen");
-}
-
-/**
  * Update the transparency status of this dialog, depending on if the event
  * is all-day or not.
  *
  * @param allDay    If true, the event is all-day
  */
 function setShowTimeAs(allDay) {
     gConfig.showTimeAs = cal.getEventDefaultTransparency(allDay);
     updateConfigState({ showTimeAs: gConfig.showTimeAs });
--- a/calendar/lightning/content/lightning-item-panel.js
+++ b/calendar/lightning/content/lightning-item-panel.js
@@ -403,16 +403,57 @@ function updateTitle(aNewTitle) {
         gTabmail.currentTabInfo.title = aNewTitle;
         gTabmail.setTabTitle(gTabmail.currentTabInfo);
     } else {
         document.title = aNewTitle;
     }
 }
 
 /**
+ * Open a new event.
+ */
+function openNewEvent() {
+    sendMessage({ command: "openNewEvent" });
+}
+
+/**
+ * Open a new task.
+ */
+function openNewTask() {
+    sendMessage({ command: "openNewTask" });
+}
+
+
+/**
+ * Open a new Thunderbird compose window.
+ */
+function openNewMessage() {
+    MailServices.compose.OpenComposeWindow(
+        null,
+        null,
+        null,
+        Components.interfaces.nsIMsgCompType.New,
+        Components.interfaces.nsIMsgCompFormat.Default,
+        null,
+        null
+    );
+}
+
+/**
+ * Open a new addressbook window
+ */
+function openNewCardDialog() {
+    window.openDialog(
+        "chrome://messenger/content/addressbook/abNewCardDialog.xul",
+        "",
+        "chrome,modal,resizable=no,centerscreen"
+    );
+}
+
+/**
  * Handler for edit attendees command.
  */
 function editAttendees() {
     sendMessage({ command: "editAttendees" });
 }
 
 /**
  * Sends a message to set the gConfig values in the iframe.
@@ -444,17 +485,18 @@ function rotatePrivacy() {
  *
  * @param {nsIDOMNode} aTarget      Has the new privacy in its "value" attribute
  * @param {XULCommandEvent} aEvent  (optional) the UI element selection event
  */
 function editPrivacy(aTarget, aEvent) {
     if (aEvent) {
         aEvent.stopPropagation();
     }
-    let newPrivacy = aTarget.getAttribute("value");
+    // "privacy" is indeed the correct attribute to use here
+    let newPrivacy = aTarget.getAttribute("privacy");
     editConfigState({ privacy: newPrivacy });
 }
 
 /**
  * Updates the UI according to the privacy setting and the selected
  * calendar. If the selected calendar does not support privacy or only
  * certain values, these are removed from the UI. This function should
  * be called any time that privacy setting is updated.
--- a/calendar/lightning/content/lightning-item-panel.xul
+++ b/calendar/lightning/content/lightning-item-panel.xul
@@ -26,92 +26,26 @@
     <vbox id="lightningItemPanel" collapsed="true">
 
       <!-- The id of the inner vbox and the iframe are set dynamically
            when a tab is created. -->
       <vbox flex="1"
             id="dummy-calendar-event-dialog-tab"
             class="calendar-event-dialog-tab">
 
-        <stringbundleset id="stringbundleset">
-          <stringbundle id="languageBundle"
-                        src="chrome://global/locale/languageNames.properties"/>
-        </stringbundleset>
-
-        <script type="application/javascript"
-                src="chrome://global/content/globalOverlay.js"/>
-
-        <!-- Command updater -->
-        <commandset id="globalEditMenuItems"
-                    commandupdater="true"
-                    events="focus"
-                    oncommandupdate="goUpdateGlobalEditMenuItems()"/>
-        <commandset id="selectEditMenuItems"
-                    commandupdater="true"
-                    events="select"
-                    oncommandupdate="goUpdateSelectEditMenuItems()"/>
-        <commandset id="undoEditMenuItems"
-                    commandupdater="true"
-                    events="undo"
-                    oncommandupdate="goUpdateUndoEditMenuItems()"/>
-        <commandset id="clipboardEditMenuItems"
-                    commandupdater="true"
-                    events="clipboard"
-                    oncommandupdate="goUpdatePasteMenuItems()"/>
-
         <!-- Commands -->
         <commandset id="itemCommands">
-
-          <!-- Item menu -->
-          <command id="cmd_item_new_event"
-                   oncommand="openNewEvent()"/>
-          <command id="cmd_item_new_task"
-                   oncommand="openNewTask()"/>
-          <command id="cmd_item_new_message"
-                   oncommand="openNewMessage()"/>
-          <command id="cmd_item_new_card"
-                   oncommand="openNewCardDialog()"/>
-          <command id="cmd_item_close"
-                   oncommand="cancelDialog()"/>
           <command id="cmd_save"
                    disable-on-readonly="true"
                    oncommand="onCommandSave()"/>
           <command id="cmd_item_delete"
                    disable-on-readonly="true"
                    oncommand="onCommandDeleteItem()"/>
-          <command id="cmd_printSetup"
-                   oncommand="PrintUtils.showPageSetup()"/>
-          <command id="cmd_print"
-                   disabled="true"
-                   oncommand="calPrint()"/>
-
-          <!-- Edit menu -->
-          <command id="cmd_undo"
-                   disabled="true"
-                   oncommand="goDoCommand('cmd_undo')"/>
-          <command id="cmd_redo"
-                   disabled="true"
-                   oncommand="goDoCommand('cmd_redo')"/>
-          <command id="cmd_cut"
-                   disabled="true"
-                   oncommand="goDoCommand('cmd_cut')"/>
-          <command id="cmd_copy"
-                   disabled="true"
-                   oncommand="goDoCommand('cmd_copy')"/>
-          <command id="cmd_paste"
-                   disabled="true"
-                   oncommand="goDoCommand('cmd_paste')"/>
-          <command id="cmd_selectAll"
-                   disabled="true"
-                   oncommand="goDoCommand('cmd_selectAll')"/>
 
           <!-- View menu -->
-          <command id="cmd_toolbar"
-                   oncommand="onCommandViewToolbar('event-toolbar',
-                                                   'view-toolbars-event-menuitem')"/>
           <command id="cmd_customize"
                    oncommand="onCommandCustomize()"/>
           <command id="cmd_toggle_link"
                    persist="checked"
                    oncommand="toggleLink()"/>
 
           <!-- status -->
           <command id="cmd_status_none"
@@ -165,72 +99,28 @@
                    disable-on-readonly="true"/>
           <command id="cmd_timezone"
                    persist="checked"
                    checked="false"
                    oncommand="toggleTimezoneLinks()"/>
         </commandset>
 
         <keyset id="calendar-event-dialog-keyset">
-          <key id="new-event-key"
-               modifiers="accel"
-               key="&event.dialog.new.event.key2;"
-               command="cmd_item_new_event"/>
-          <key id="new-task-key"
-               modifiers="accel"
-               key="&event.dialog.new.task.key2;"
-               command="cmd_item_new_task"/>
-          <key id="new-message-key"
-               modifiers="accel"
-               key="&event.dialog.new.message.key2;"
-               command="cmd_item_new_message"/>
-          <key id="close-key"
-               modifiers="accel"
-               key="&event.dialog.close.key;"
-               command="cmd_item_close"/>
           <key id="save-key"
                modifiers="accel, shift"
                key="&event.dialog.save.key;"
                command="cmd_save"/>
           <key id="saveandclose-key"
                modifiers="accel"
                key="&event.dialog.saveandclose.key;"
                command="cmd_accept"/>
           <key id="saveandclose-key2"
                modifiers="accel"
                keycode="VK_RETURN"
                command="cmd_accept"/>
-          <key id="print-key"
-               modifiers="accel"
-               key="&event.dialog.print.key;"
-               command="cmd_print"/>
-          <key id="undo-key"
-               modifiers="accel"
-               key="&event.dialog.undo.key;"
-               command="cmd_undo"/>
-          <key id="redo-key"
-               modifiers="accel"
-               key="&event.dialog.redo.key;"
-               command="cmd_redo"/>
-          <key id="cut-key"
-               modifiers="accel"
-               key="&event.dialog.cut.key;"
-               command="cmd_cut"/>
-          <key id="copy-key"
-               modifiers="accel"
-               key="&event.dialog.copy.key;"
-               command="cmd_copy"/>
-          <key id="paste-key"
-               modifiers="accel"
-               key="&event.dialog.paste.key;"
-               command="cmd_paste"/>
-          <key id="select-all-key"
-               modifiers="accel"
-               key="&event.dialog.select.all.key;"
-               command="cmd_selectAll"/>
         </keyset>
 
         <toolbox id="event-toolbox"
                  class="mail-toolbox"
                  mode="full"
                  defaultmode="full"
 #ifdef XP_MACOSX
                  iconsize="small"