Bug 1608610 - Pre-process calendar commands into messenger.xhtml. r=Fallen
authorPaul Morris <paul@thunderbird.net>
Tue, 14 Jan 2020 11:49:42 -0500
changeset 37231 05e3a9199721408f7675235f58fb58d017dcec0f
parent 37230 873146a4a36cad063e72cdb17fba63021953f94f
child 37232 05f8690b4ae9865217d2849bb1df00b7908a72e0
push id2552
push userclokep@gmail.com
push dateMon, 10 Feb 2020 21:24:16 +0000
treeherdercomm-beta@f95a6f4408a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFallen
bugs1608610
Bug 1608610 - Pre-process calendar commands into messenger.xhtml. r=Fallen
calendar/lightning/content/calendar-commands.inc.xhtml
calendar/lightning/content/messenger-overlay-sidebar.xhtml
calendar/lightning/jar.mn
mail/base/content/messenger.xhtml
new file mode 100644
--- /dev/null
+++ b/calendar/lightning/content/calendar-commands.inc.xhtml
@@ -0,0 +1,101 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+<commandset id="calendar_commands"
+            commandupdater="true"
+            events="calendar_commands"
+            oncommandupdate="calendarController.updateCommands()">
+  <command id="agenda_delete_event_command" oncommand="agendaListbox.deleteSelectedItem(false);"/>
+  <command id="agenda_edit_event_command" oncommand="agendaListbox.editSelectedItem(event);"/>
+  <command id="switch2calendar"
+           oncommand="document.getElementById('tabmail').openTab('calendar', { title: document.getElementById('calendar-tab-button').getAttribute('title') })"/>
+  <command id="switch2task"
+           oncommand="document.getElementById('tabmail').openTab('tasks', { title: document.getElementById('task-tab-button').getAttribute('title') })"/>
+  <command id="new_calendar_tab"
+           oncommand="document.getElementById('tabmail').openTab('calendar', { title: document.getElementById('calendar-tab-button').getAttribute('title') })"/>
+  <command id="new_task_tab"
+           oncommand="document.getElementById('tabmail').openTab('tasks', { title: document.getElementById('task-tab-button').getAttribute('title') })"/>
+  <command id="calendar_go_to_today_command"
+           observes="calendar_mode_calendar"
+           oncommand="document.getElementById('tabmail').openTab('calendar', { title: document.getElementById('calendar-tab-button').getAttribute('title') }); goToDate(cal.dtz.now())"/>
+  <command id="calendar_new_calendar_command" oncommand="goDoCommand('calendar_new_calendar_command')"/>
+  <command id="calendar_delete_calendar_command" oncommand="goDoCommand('calendar_delete_calendar_command')"/>
+  <command id="calendar_edit_calendar_command" oncommand="goDoCommand('calendar_edit_calendar_command')"/>
+
+  <command id="calendar_new_event_command" oncommand="goDoCommand('calendar_new_event_command')"/>
+  <command id="calendar_new_event_todaypane_command" oncommand="agendaListbox.createNewEvent(event)"/>
+  <command id="calendar_new_event_context_command" oncommand="goDoCommand('calendar_new_event_context_command')"/>
+  <command id="calendar_modify_event_command" oncommand="goDoCommand('calendar_modify_event_command')"/>
+  <command id="calendar_delete_event_command" oncommand="goDoCommand('calendar_delete_event_command')"/>
+
+  <command id="calendar_new_todo_command" oncommand="goDoCommand('calendar_new_todo_command')"/>
+  <command id="calendar_new_todo_context_command" oncommand="goDoCommand('calendar_new_todo_context_command')"/>
+  <command id="calendar_new_todo_todaypane_command" oncommand="goDoCommand('calendar_new_todo_todaypane_command')"/>
+  <command id="calendar_modify_todo_command" oncommand="goDoCommand('calendar_modify_todo_command')"/>
+  <command id="calendar_modify_todo_todaypane_command" oncommand="goDoCommand('calendar_modify_todo_todaypane_command')"/>
+  <command id="calendar_delete_todo_command" oncommand="goDoCommand('calendar_delete_todo_command')"/>
+
+  <command id="calendar_modify_focused_item_command" oncommand="goDoCommand('calendar_modify_focused_item_command')"/>
+  <command id="calendar_delete_focused_item_command" oncommand="goDoCommand('calendar_delete_focused_item_command')"/>
+
+  <command id="calendar_import_command" oncommand="goDoCommand('calendar_import_command')"/>
+  <command id="calendar_export_command" oncommand="goDoCommand('calendar_export_command')"/>
+  <command id="calendar_export_selection_command" oncommand="goDoCommand('calendar_export_selection_command')"/>
+
+  <command id="calendar_publish_selected_calendar_command" oncommand="goDoCommand('calendar_publish_selected_calendar_command')"/>
+  <command id="calendar_publish_calendar_command" oncommand="goDoCommand('calendar_publish_calendar_command')"/>
+  <command id="calendar_publish_selected_events_command" oncommand="goDoCommand('calendar_publish_selected_events_command')"/>
+
+  <command id="calendar_reload_remote_calendars" oncommand="goDoCommand('calendar_reload_remote_calendars')"/>
+
+  <command id="calendar_show_unifinder_command" oncommand="goDoCommand('calendar_show_unifinder_command')"/>
+  <!-- The dash instead of the underscore is intended. the 'xxx-view' part should be the id of the view in the deck -->
+  <command id="calendar_day-view_command" oncommand="goDoCommand('calendar_day-view_command')"/>
+  <command id="calendar_week-view_command" oncommand="goDoCommand('calendar_week-view_command')"/>
+  <command id="calendar_multiweek-view_command" oncommand="goDoCommand('calendar_multiweek-view_command')"/>
+  <command id="calendar_month-view_command" oncommand="goDoCommand('calendar_month-view_command')"/>
+  <command id="calendar_task_category_command"/>
+  <command id="calendar_toggle_completed_command" oncommand="toggleCompleted(event)"/>
+  <command id="calendar_percentComplete-0_command" oncommand="contextChangeTaskProgress(event, 0)"/>
+  <command id="calendar_percentComplete-25_command" oncommand="contextChangeTaskProgress(event, 25)"/>
+  <command id="calendar_percentComplete-50_command" oncommand="contextChangeTaskProgress(event, 50)"/>
+  <command id="calendar_percentComplete-75_command" oncommand="contextChangeTaskProgress(event, 75)"/>
+  <command id="calendar_percentComplete-100_command" oncommand="contextChangeTaskProgress(event, 100)"/>
+  <command id="calendar_priority-0_command" oncommand="contextChangeTaskPriority(event, 0)"/>
+  <command id="calendar_priority-9_command" oncommand="contextChangeTaskPriority(event, 9)"/>
+  <command id="calendar_priority-5_command" oncommand="contextChangeTaskPriority(event, 5)"/>
+  <command id="calendar_priority-1_command" oncommand="contextChangeTaskPriority(event, 1)"/>
+  <command id="calendar_general-priority_command" oncommand="goDoCommand('calendar_general-priority_command')"/>
+  <command id="calendar_general-progress_command" oncommand="goDoCommand('calendar_general-progress_command')"/>
+  <command id="calendar_general-postpone_command"/>
+  <command id="calendar_postpone-1hour_command" oncommand="contextPostponeTask(event, 'PT1H')"/>
+  <command id="calendar_postpone-1day_command" oncommand="contextPostponeTask(event, 'P1D')"/>
+  <command id="calendar_postpone-1week_command" oncommand="contextPostponeTask(event, 'P1W')"/>
+  <command id="calendar_toggle_orientation_command" persist="checked" oncommand="goDoCommand('calendar_toggle_orientation_command')"/>
+  <command id="calendar_toggle_workdays_only_command" persist="checked" oncommand="goDoCommand('calendar_toggle_workdays_only_command')"/>
+  <command id="calendar_toggle_tasks_in_view_command" persist="checked" oncommand="toggleTasksInView()"/>
+  <command id="calendar_toggle_show_completed_in_view_command" persist="checked" oncommand="toggleShowCompletedInView()"/>
+  <command id="calendar_toggle_calendarsidebar_command" oncommand="togglePaneSplitter('calsidebar_splitter')"/>
+  <command id="calendar_toggle_minimonthpane_command" oncommand="document.getElementById('minimonth-pane').togglePane(event)"/>
+  <command id="calendar_toggle_calendarlist_command" oncommand="document.getElementById('calendar-list-pane').togglePane(event)"/>
+  <command id="calendar_task_filter_command" oncommand="taskViewUpdate(event.explicitOriginalTarget.getAttribute('value'))"/>
+  <command id="calendar_task_filter_todaypane_command" oncommand="TodayPane.updateCalendarToDoUnifinder(event.explicitOriginalTarget.getAttribute('value'))"/>
+  <command id="calendar_toggle_filter_command" oncommand="document.getElementById('task-filter-pane').togglePane(event)"/>
+  <command id="calendar_view_next_command" oncommand="goDoCommand('calendar_view_next_command')"/>
+  <command id="calendar_view_today_command" oncommand="currentView().moveView()"/>
+  <command id="calendar_view_prev_command" oncommand="goDoCommand('calendar_view_prev_command')"/>
+
+  <!-- this is a pseudo-command that is disabled when in calendar mode -->
+  <command id="calendar_in_foreground"/>
+  <!-- this is a pseudo-command that is disabled when not in calendar mode -->
+  <command id="calendar_in_background"/>
+
+  <!-- These commands are enabled when in calendar or task mode, respectively -->
+  <command id="calendar_mode_calendar"/>
+  <command id="calendar_mode_task"/>
+
+  <command id="calendar_attendance_command"/>
+
+  <command id="calendar_toggle_todaypane_command" oncommand="TodayPane.toggleVisibility(event)"/>
+</commandset>
--- a/calendar/lightning/content/messenger-overlay-sidebar.xhtml
+++ b/calendar/lightning/content/messenger-overlay-sidebar.xhtml
@@ -5,118 +5,16 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <overlay id="ltnSidebarOverlay"
          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
          xmlns:html="http://www.w3.org/1999/xhtml">
 
   <window id="messengerWindow">
-    <commandset id="calendar_commands"
-                commandupdater="true"
-                events="calendar_commands"
-                oncommandupdate="calendarController.updateCommands()">
-      <command id="agenda_delete_event_command" oncommand="agendaListbox.deleteSelectedItem(false);"/>
-      <command id="agenda_edit_event_command" oncommand="agendaListbox.editSelectedItem(event);"/>
-      <command id="switch2calendar"
-               oncommand="document.getElementById('tabmail').openTab('calendar', { title: document.getElementById('calendar-tab-button').getAttribute('title') })"/>
-      <command id="switch2task"
-               oncommand="document.getElementById('tabmail').openTab('tasks', { title: document.getElementById('task-tab-button').getAttribute('title') })"/>
-      <command id="new_calendar_tab"
-               oncommand="document.getElementById('tabmail').openTab('calendar', { title: document.getElementById('calendar-tab-button').getAttribute('title') })"/>
-      <command id="new_task_tab"
-               oncommand="document.getElementById('tabmail').openTab('tasks', { title: document.getElementById('task-tab-button').getAttribute('title') })"/>
-      <command id="calendar_go_to_today_command"
-               observes="calendar_mode_calendar"
-               oncommand="document.getElementById('tabmail').openTab('calendar', { title: document.getElementById('calendar-tab-button').getAttribute('title') }); goToDate(cal.dtz.now())"/>
-      <command id="calendar_new_calendar_command" oncommand="goDoCommand('calendar_new_calendar_command')"/>
-      <command id="calendar_delete_calendar_command" oncommand="goDoCommand('calendar_delete_calendar_command')"/>
-      <command id="calendar_edit_calendar_command" oncommand="goDoCommand('calendar_edit_calendar_command')"/>
-
-      <command id="calendar_new_event_command" oncommand="goDoCommand('calendar_new_event_command')"/>
-      <command id="calendar_new_event_todaypane_command" oncommand="agendaListbox.createNewEvent(event)"/>
-      <command id="calendar_new_event_context_command" oncommand="goDoCommand('calendar_new_event_context_command')"/>
-      <command id="calendar_modify_event_command" oncommand="goDoCommand('calendar_modify_event_command')"/>
-      <command id="calendar_delete_event_command" oncommand="goDoCommand('calendar_delete_event_command')"/>
-
-      <command id="calendar_new_todo_command" oncommand="goDoCommand('calendar_new_todo_command')"/>
-      <command id="calendar_new_todo_context_command" oncommand="goDoCommand('calendar_new_todo_context_command')"/>
-      <command id="calendar_new_todo_todaypane_command" oncommand="goDoCommand('calendar_new_todo_todaypane_command')"/>
-      <command id="calendar_modify_todo_command" oncommand="goDoCommand('calendar_modify_todo_command')"/>
-      <command id="calendar_modify_todo_todaypane_command" oncommand="goDoCommand('calendar_modify_todo_todaypane_command')"/>
-      <command id="calendar_delete_todo_command" oncommand="goDoCommand('calendar_delete_todo_command')"/>
-
-      <command id="calendar_modify_focused_item_command" oncommand="goDoCommand('calendar_modify_focused_item_command')"/>
-      <command id="calendar_delete_focused_item_command" oncommand="goDoCommand('calendar_delete_focused_item_command')"/>
-
-      <command id="calendar_import_command" oncommand="goDoCommand('calendar_import_command')"/>
-      <command id="calendar_export_command" oncommand="goDoCommand('calendar_export_command')"/>
-      <command id="calendar_export_selection_command" oncommand="goDoCommand('calendar_export_selection_command')"/>
-
-      <command id="calendar_publish_selected_calendar_command" oncommand="goDoCommand('calendar_publish_selected_calendar_command')"/>
-      <command id="calendar_publish_calendar_command" oncommand="goDoCommand('calendar_publish_calendar_command')"/>
-      <command id="calendar_publish_selected_events_command" oncommand="goDoCommand('calendar_publish_selected_events_command')"/>
-
-      <command id="calendar_reload_remote_calendars" oncommand="goDoCommand('calendar_reload_remote_calendars')"/>
-
-      <command id="calendar_show_unifinder_command" oncommand="goDoCommand('calendar_show_unifinder_command')"/>
-      <!-- The dash instead of the underscore is intended. the 'xxx-view' part should be the id of the view in the deck -->
-      <command id="calendar_day-view_command" oncommand="goDoCommand('calendar_day-view_command')"/>
-      <command id="calendar_week-view_command" oncommand="goDoCommand('calendar_week-view_command')"/>
-      <command id="calendar_multiweek-view_command" oncommand="goDoCommand('calendar_multiweek-view_command')"/>
-      <command id="calendar_month-view_command" oncommand="goDoCommand('calendar_month-view_command')"/>
-      <command id="calendar_task_category_command"/>
-      <command id="calendar_toggle_completed_command" oncommand="toggleCompleted(event)"/>
-      <command id="calendar_percentComplete-0_command" oncommand="contextChangeTaskProgress(event, 0)"/>
-      <command id="calendar_percentComplete-25_command" oncommand="contextChangeTaskProgress(event, 25)"/>
-      <command id="calendar_percentComplete-50_command" oncommand="contextChangeTaskProgress(event, 50)"/>
-      <command id="calendar_percentComplete-75_command" oncommand="contextChangeTaskProgress(event, 75)"/>
-      <command id="calendar_percentComplete-100_command" oncommand="contextChangeTaskProgress(event, 100)"/>
-      <command id="calendar_priority-0_command" oncommand="contextChangeTaskPriority(event, 0)"/>
-      <command id="calendar_priority-9_command" oncommand="contextChangeTaskPriority(event, 9)"/>
-      <command id="calendar_priority-5_command" oncommand="contextChangeTaskPriority(event, 5)"/>
-      <command id="calendar_priority-1_command" oncommand="contextChangeTaskPriority(event, 1)"/>
-      <command id="calendar_general-priority_command" oncommand="goDoCommand('calendar_general-priority_command')"/>
-      <command id="calendar_general-progress_command" oncommand="goDoCommand('calendar_general-progress_command')"/>
-      <command id="calendar_general-postpone_command"/>
-      <command id="calendar_postpone-1hour_command" oncommand="contextPostponeTask(event, 'PT1H')"/>
-      <command id="calendar_postpone-1day_command" oncommand="contextPostponeTask(event, 'P1D')"/>
-      <command id="calendar_postpone-1week_command" oncommand="contextPostponeTask(event, 'P1W')"/>
-      <command id="calendar_toggle_orientation_command" persist="checked" oncommand="goDoCommand('calendar_toggle_orientation_command')"/>
-      <command id="calendar_toggle_workdays_only_command" persist="checked" oncommand="goDoCommand('calendar_toggle_workdays_only_command')"/>
-      <command id="calendar_toggle_tasks_in_view_command" persist="checked" oncommand="toggleTasksInView()"/>
-      <command id="calendar_toggle_show_completed_in_view_command" persist="checked" oncommand="toggleShowCompletedInView()"/>
-      <command id="calendar_toggle_calendarsidebar_command" oncommand="togglePaneSplitter('calsidebar_splitter')"/>
-      <command id="calendar_toggle_minimonthpane_command" oncommand="document.getElementById('minimonth-pane').togglePane(event)"/>
-      <command id="calendar_toggle_calendarlist_command" oncommand="document.getElementById('calendar-list-pane').togglePane(event)"/>
-      <command id="calendar_task_filter_command" oncommand="taskViewUpdate(event.explicitOriginalTarget.getAttribute('value'))"/>
-      <command id="calendar_task_filter_todaypane_command" oncommand="TodayPane.updateCalendarToDoUnifinder(event.explicitOriginalTarget.getAttribute('value'))"/>
-      <command id="calendar_toggle_filter_command" oncommand="document.getElementById('task-filter-pane').togglePane(event)"/>
-      <command id="calendar_view_next_command" oncommand="goDoCommand('calendar_view_next_command')"/>
-      <command id="calendar_view_today_command" oncommand="currentView().moveView()"/>
-      <command id="calendar_view_prev_command" oncommand="goDoCommand('calendar_view_prev_command')"/>
-
-      <!-- this is a pseudo-command that is disabled when in calendar mode -->
-      <command id="calendar_in_foreground"/>
-      <!-- this is a pseudo-command that is disabled when not in calendar mode -->
-      <command id="calendar_in_background"/>
-
-      <!-- These commands are enabled when in calendar or task mode, respectively -->
-      <command id="calendar_mode_calendar"/>
-      <command id="calendar_mode_task"/>
-
-      <command id="calendar_attendance_command"/>
-
-      <command id="calendar_toggle_todaypane_command" oncommand="TodayPane.toggleVisibility(event)"/>
-    </commandset>
-
-    <commandset id="mailCommands">
-      <command id="cmd_CustomizeMailToolbar"
-               oncommand="customizeMailToolbarForTabType()"/>
-    </commandset>
 
     <keyset id="calendar-keys">
       <key id="openLightningKey"
            key="&lightning.keys.event.showCalendar.key;"
            modifiers="accel, shift"
            command="new_calendar_tab"/>
       <key id="openTasksKey"
            key="&lightning.keys.event.showTasks.key;"
--- a/calendar/lightning/jar.mn
+++ b/calendar/lightning/jar.mn
@@ -8,16 +8,17 @@ lightning.jar:
 % override chrome://messagebody/skin/calendar-event-dialog-attendees.png chrome://calendar-common/skin/calendar-event-dialog-attendees.png
 % overlay chrome://messenger/content/messenger.xhtml chrome://lightning/content/messenger-overlay-sidebar.xhtml
 % overlay chrome://communicator/content/pref/preferences.xhtml chrome://lightning/content/suite-overlay-preferences.xhtml application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
 % overlay about:addons chrome://lightning/content/suite-overlay-addons.xhtml application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
 % overlay chrome://mozapps/content/extensions/extensions.xhtml chrome://lightning/content/suite-overlay-addons.xhtml application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
 % overlay chrome://lightning/content/messenger-overlay-sidebar.xhtml chrome://lightning/content/suite-overlay-sidebar.xhtml application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
 % override chrome://lightning-common/skin/accountCentral.css chrome://lightning-common/skin/suite-accountCentral.css application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
 % content lightning %content/
+    content/calendar-commands.inc.xhtml                    (content/calendar-commands.inc.xhtml)
     content/html-item-editing/lightning-item-iframe.html   (content/html-item-editing/lightning-item-iframe.html)
     content/html-item-editing/react-code.js                (content/html-item-editing/react-code.js)
     content/imip-bar.js                                    (content/imip-bar.js)
     content/imip-bar-overlay.inc.xhtml                     (content/imip-bar-overlay.inc.xhtml)
     content/lightning-calendar-creation.js                 (content/lightning-calendar-creation.js)
     content/lightning-calendar-properties.js               (content/lightning-calendar-properties.js)
     content/lightning-invitation.xhtml                     (content/lightning-invitation.xhtml)
 *   content/lightning-item-panel.inc.xhtml                 (content/lightning-item-panel.inc.xhtml)
--- a/mail/base/content/messenger.xhtml
+++ b/mail/base/content/messenger.xhtml
@@ -333,18 +333,22 @@
         commandupdater="true"
         events="focus"
         oncommandupdate="FocusRingUpdate_Mail()"/>
   <commandset id="tasksCommands">
     <command id="cmd_newMessage" oncommand="goOpenNewMessage();"/>
     <command id="cmd_newCard" oncommand="openNewCardDialog()"/>
   </commandset>
   <command id="cmd_close" oncommand="CloseTabOrWindow();"/>
+  <command id="cmd_CustomizeMailToolbar"
+           oncommand="customizeMailToolbarForTabType()"/>
 </commandset>
 
+#include ../../../calendar/lightning/content/calendar-commands.inc.xhtml
+
 <keyset id="mailKeys">
   <!-- Tab/F6 Keys -->
   <key keycode="VK_TAB" oncommand="SwitchPaneFocus(event);" modifiers="control,shift"/>
   <key keycode="VK_TAB" oncommand="SwitchPaneFocus(event);" modifiers="control"/>
   <key keycode="VK_F6" oncommand="SwitchPaneFocus(event);" modifiers="control,shift"/>
   <key keycode="VK_F6" oncommand="SwitchPaneFocus(event);" modifiers="control"/>
   <key keycode="VK_F6" oncommand="SwitchPaneFocus(event);" modifiers="shift"/>
   <key keycode="VK_F6" oncommand="SwitchPaneFocus(event);"/>