Bug 1608610 - Pre-process calendar view menu items. r=Fallen
authorPaul Morris <paul@thunderbird.net>
Tue, 14 Jan 2020 16:30:50 -0500
changeset 38122 9a50d5b205f2dfc9b7cbce2b9acfc5e29bbbdb79
parent 38121 822561223c277b32a72187bcc16247c57f8c3cc0
child 38123 08a88ac148a4e0a04f824682ec5e821685e39170
push id398
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:10:28 +0000
reviewersFallen
bugs1608610
Bug 1608610 - Pre-process calendar view menu items. r=Fallen
calendar/lightning/content/calendar-context-menus-and-tooltips.inc.xhtml
calendar/lightning/content/calendar-view-menu.inc.xhtml
calendar/lightning/content/messenger-overlay-sidebar.js
calendar/lightning/content/messenger-overlay-sidebar.xhtml
calendar/lightning/jar.mn
mail/base/content/mainNavigationToolbox.inc.xhtml
--- a/calendar/lightning/content/calendar-context-menus-and-tooltips.inc.xhtml
+++ b/calendar/lightning/content/calendar-context-menus-and-tooltips.inc.xhtml
@@ -794,15 +794,15 @@
     <menuitem id="taskview-link-context-menu-copy"
               label="&calendar.copylink.label;"
               accesskey="&calendar.copylink.accesskey;"
               oncommand="taskViewCopyLink(document.popupNode)"/>
   </menupopup>
 
   <!-- CALENDAR EVENT DIALOG (IN TAB) TOOLBAR CONTEXT MENU -->
   <menupopup id="event-dialog-toolbar-context-menu"
-             onpopupshowing="onToolbarsPopupShowingForTabType(event);">
+             onpopupshowing="calendarOnToolbarsPopupShowing(event);">
     <menuseparator id="customizeEventToolbarMenuSeparator"/>
     <menuitem id="CustomizeDialogToolbar"
               label="&event.menu.view.toolbars.customize.label;"
               command="cmd_customize"/>
   </menupopup>
 </popupset>
new file mode 100644
--- /dev/null
+++ b/calendar/lightning/content/calendar-view-menu.inc.xhtml
@@ -0,0 +1,195 @@
+# 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/.
+
+<menuseparator id="ltnViewMenuSeparator"/>
+<menu id="ltnTodayPaneMenu"
+      label="&calendar.context.button.label;"
+      accesskey="&calendar.context.button.accesskey;">
+  <menupopup id="ltnTodayPaneMenuPopup">
+    <menuitem id="ltnShowTodayPane-2"
+              label="&todaypane.showTodayPane.label;"
+              accesskey="&todaypane.showTodayPane.accesskey;"
+              type="checkbox"
+              key="todaypanekey"
+              command="calendar_toggle_todaypane_command"/>
+    <menuseparator id="ltnSeparatorBeforeDisplayMiniday"/>
+    <menuitem id="ltnTodayPaneDisplayMiniday"
+              name="minidisplay"
+              value="miniday"
+              type="radio"
+              oncommand="TodayPane.displayMiniSection('miniday')"
+              label="&todaypane.showMiniday.label;"
+              accesskey="&todaypane.showMiniday.accesskey;"/>
+    <menuitem id="ltnTodayPaneDisplayMinimonth"
+              name="minidisplay"
+              value="minimonth"
+              type="radio"
+              oncommand="TodayPane.displayMiniSection('minimonth')"
+              label="&todaypane.showMinimonth.label;"
+              accesskey="&todaypane.showMinimonth.accesskey;"/>
+    <menuitem id="ltnTodayPaneDisplayNone"
+              name="minidisplay"
+              value="none"
+              type="radio"
+              oncommand="TodayPane.displayMiniSection('none')"
+              label="&todaypane.showNone.label;"
+              accesskey="&todaypane.showNone.accesskey;"/>
+  </menupopup>
+</menu>
+<menu id="ltnCalendarMenu"
+      observes="calendar_in_foreground"
+      label="&lightning.menu.view.calendar.label;"
+      accesskey="&lightning.menu.view.calendar.accesskey;">
+  <menupopup id="ltnCalendarMenuPopup">
+    <menuitem id="ltnChangeViewDay"
+              label="&lightning.toolbar.day.label;"
+              accesskey="&lightning.toolbar.day.accesskey;"
+              type="radio"
+              name="calendarMenuViews"
+              key="calendar-day-view-key"
+              command="calendar_day-view_command"/>
+    <menuitem id="ltnChangeViewWeek"
+              label="&lightning.toolbar.week.label;"
+              accesskey="&lightning.toolbar.week.accesskey;"
+              type="radio"
+              name="calendarMenuViews"
+              key="calendar-week-view-key"
+              command="calendar_week-view_command"/>
+    <menuitem id="ltnChangeViewMultiweek"
+              label="&lightning.toolbar.multiweek.label;"
+              accesskey="&lightning.toolbar.multiweek.accesskey;"
+              type="radio"
+              name="calendarMenuViews"
+              key="calendar-multiweek-view-key"
+              command="calendar_multiweek-view_command"/>
+    <menuitem id="ltnChangeViewMonth"
+              label="&lightning.toolbar.month.label;"
+              accesskey="&lightning.toolbar.month.accesskey;"
+              type="radio"
+              name="calendarMenuViews"
+              key="calendar-month-view-key"
+              command="calendar_month-view_command"/>
+    <menuseparator id="ltnBeforeCalendarViewSection"/>
+    <menu id="ltnCalendarPaneMenu"
+          label="&lightning.toolbar.calendarmenu.label;"
+          accesskey="&lightning.toolbar.calendarmenu.accesskey;">
+      <menupopup id="ltnCalendarPanePopup"
+                 onpopupshowing="InitViewCalendarPaneMenu()">
+        <menuitem id="ltnViewCalendarPane"
+                  type="checkbox"
+                  label="&lightning.toolbar.calendarpane.label;"
+                  accesskey="&lightning.toolbar.calendarpane.accesskey;"
+                  command="calendar_toggle_calendarsidebar_command"/>
+        <menuseparator id="ltnCalendarPaneMenuSeparator"/>
+        <menuitem id="ltnTasksViewMinimonth"
+                  type="checkbox"
+                  label="&calendar.tasks.view.minimonth.label;"
+                  accesskey="&calendar.tasks.view.minimonth.accesskey;"
+                  command="calendar_toggle_minimonthpane_command"/>
+        <menuitem id="ltnTasksViewCalendarlist"
+                  type="checkbox"
+                  label="&calendar.tasks.view.calendarlist.label;"
+                  accesskey="&calendar.tasks.view.calendarlist.accesskey;"
+                  command="calendar_toggle_calendarlist_command"/>
+      </menupopup>
+    </menu>
+    <menuseparator id="ltnBeforeCurrentViewMenu"/>
+    <menu id="ltnCalendarCurrentViewMenu"
+          observes="calendar_mode_calendar"
+          label="&showCurrentView.label;"
+          accesskey="&showCurrentView.accesskey;">
+      <menupopup id="ltnCalendarCurrentViewMenuPopup">
+        <menuitem type="checkbox"
+                  id="ltnWorkdaysOnlyMenuitem"
+                  label="&calendar.onlyworkday.checkbox.label;"
+                  accesskey="&calendar.onlyworkday.checkbox.accesskey;"
+                  command="calendar_toggle_workdays_only_command"/>
+        <menuitem type="checkbox"
+                  id="ltnTasksInViewMenuitem"
+                  label="&calendar.displaytodos.checkbox.label;"
+                  accesskey="&calendar.displaytodos.checkbox.accesskey;"
+                  command="calendar_toggle_tasks_in_view_command"/>
+        <menuitem type="checkbox"
+                  id="ltnShowCompletedInViewMenuItem"
+                  label="&calendar.completedtasks.checkbox.label;"
+                  accesskey="&calendar.completedtasks.checkbox.accesskey;"
+                  command="calendar_toggle_show_completed_in_view_command"/>
+        <menuitem type="checkbox"
+                  id="ltnViewRotated"
+                  label="&calendar.orientation.label;"
+                  accesskey="&calendar.orientation.accesskey;"
+                  command="calendar_toggle_orientation_command"/>
+      </menupopup>
+    </menu>
+  </menupopup>
+</menu>
+<menu id="ltnTasksMenu"
+      observes="calendar_mode_task"
+      label="&lightning.menu.view.tasks.label;"
+      accesskey="&lightning.menu.view.tasks.accesskey;">
+  <menupopup id="ltnTasksMenuPopup">
+    <menuitem id="ltnTasksViewFilterTasks"
+              type="checkbox"
+              label="&calendar.tasks.view.filtertasks.label;"
+              accesskey="&calendar.tasks.view.filtertasks.accesskey;"
+              command="calendar_toggle_filter_command"/>
+    <menuseparator id="ltnTasksViewSeparator"/>
+    <menuitem id="ltnTasksViewFilterCurrent"
+              name="filtergroup"
+              value="throughcurrent"
+              type="radio"
+              command="calendar_task_filter_command"
+              label="&calendar.task.filter.current.label;"
+              accesskey="&calendar.task.filter.current.accesskey;"/>
+    <menuitem id="ltnTasksViewFilterToday"
+              name="filtergroup"
+              value="throughtoday"
+              type="radio"
+              command="calendar_task_filter_command"
+              label="&calendar.task.filter.today.label;"
+              accesskey="&calendar.task.filter.today.accesskey;"/>
+    <menuitem id="ltnTasksViewFilterNext7days"
+              name="filtergroup"
+              value="throughsevendays"
+              type="radio"
+              command="calendar_task_filter_command"
+              label="&calendar.task.filter.next7days.label;"
+              accesskey="&calendar.task.filter.next7days.accesskey;"/>
+    <menuitem id="ltnTasksViewFilterNotstartedtasks"
+              name="filtergroup"
+              value="notstarted"
+              type="radio"
+              command="calendar_task_filter_command"
+              label="&calendar.task.filter.notstarted.label;"
+              accesskey="&calendar.task.filter.notstarted.accesskey;"/>
+    <menuitem id="ltnTasksViewFilterOverdue"
+              name="filtergroup"
+              value="overdue"
+              type="radio"
+              command="calendar_task_filter_command"
+              label="&calendar.task.filter.overdue.label;"
+              accesskey="&calendar.task.filter.overdue.accesskey;"/>
+    <menuitem id="ltnTasksViewFilterCompleted"
+              name="filtergroup"
+              type="radio"
+              value="completed"
+              command="calendar_task_filter_command"
+              label="&calendar.task.filter.completed.label;"
+              accesskey="&calendar.task.filter.completed.accesskey;"/>
+    <menuitem id="ltnTasksViewFilterOpen"
+              name="filtergroup"
+              type="radio"
+              value="open"
+              command="calendar_task_filter_command"
+              label="&calendar.task.filter.open.label;"
+              accesskey="&calendar.task.filter.open.accesskey;"/>
+    <menuitem id="ltnTasksViewFilterAll"
+              name="filtergroup"
+              value="all"
+              type="radio"
+              command="calendar_task_filter_command"
+              label="&calendar.task.filter.all.label;"
+              accesskey="&calendar.task.filter.all.accesskey;"/>
+  </menupopup>
+</menu>
--- a/calendar/lightning/content/messenger-overlay-sidebar.js
+++ b/calendar/lightning/content/messenger-overlay-sidebar.js
@@ -1,15 +1,15 @@
 /* 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/. */
 
 /* exported refreshUIBits, switchCalendarView, rescheduleInvitationsUpdate,
  *          openInvitationsDialog, onToolbarsPopupShowingWithMode,
- *          InitViewCalendarPaneMenu, onToolbarsPopupShowingForTabType,
+ *          InitViewCalendarPaneMenu, calendarOnToolbarsPopupShowing,
  *          customizeMailToolbarForTabType, gCurrentMode
  */
 
 /* import-globals-from ../../base/content/calendar-command-controller.js */
 /* import-globals-from ../../base/content/calendar-invitations-manager.js */
 /* import-globals-from ../../base/content/today-pane.js */
 /* import-globals-from lightning-item-panel.js */
 
@@ -773,17 +773,17 @@ function getToolboxIdForCurrentTabType()
 
 /**
  * Modify the contents of the "Toolbars" context menu for the current
  * tab type.  Menu items are inserted before (appear above) aInsertPoint.
  *
  * @param {MouseEvent} aEvent              The popupshowing event
  * @param {nsIDOMXULElement} aInsertPoint  (optional) menuitem node
  */
-function onToolbarsPopupShowingForTabType(aEvent, aInsertPoint) {
+function calendarOnToolbarsPopupShowing(aEvent, aInsertPoint) {
   if (onViewToolbarsPopupShowing.length < 3) {
     // SeaMonkey
     onViewToolbarsPopupShowing(aEvent);
     return;
   }
 
   let toolboxes = [];
   let toolboxId = getToolboxIdForCurrentTabType();
--- a/calendar/lightning/content/messenger-overlay-sidebar.xhtml
+++ b/calendar/lightning/content/messenger-overlay-sidebar.xhtml
@@ -5,216 +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">
 
   <!-- CALENDAR MENUS -->
-  <menupopup id="menu_View_Popup">
-    <menu id="menu_Toolbars"
-          onpopupshowing="onToolbarsPopupShowingForTabType(event);"/>
-    <menuseparator id="ltnViewMenuSeparator"
-                   insertbefore="viewSortMenuSeparator"/>
-    <menu id="ltnTodayPaneMenu"
-          insertbefore="viewSortMenuSeparator"
-          label="&calendar.context.button.label;"
-          accesskey="&calendar.context.button.accesskey;">
-      <menupopup id="ltnTodayPaneMenuPopup">
-        <menuitem id="ltnShowTodayPane-2"
-                  label="&todaypane.showTodayPane.label;"
-                  accesskey="&todaypane.showTodayPane.accesskey;"
-                  type="checkbox"
-                  key="todaypanekey"
-                  command="calendar_toggle_todaypane_command"/>
-        <menuseparator id="ltnSeparatorBeforeDisplayMiniday"/>
-        <menuitem id="ltnTodayPaneDisplayMiniday"
-                  name="minidisplay"
-                  value="miniday"
-                  type="radio"
-                  oncommand="TodayPane.displayMiniSection('miniday')"
-                  label="&todaypane.showMiniday.label;"
-                  accesskey="&todaypane.showMiniday.accesskey;"/>
-        <menuitem id="ltnTodayPaneDisplayMinimonth"
-                  name="minidisplay"
-                  value="minimonth"
-                  type="radio"
-                  oncommand="TodayPane.displayMiniSection('minimonth')"
-                  label="&todaypane.showMinimonth.label;"
-                  accesskey="&todaypane.showMinimonth.accesskey;"/>
-        <menuitem id="ltnTodayPaneDisplayNone"
-                  name="minidisplay"
-                  value="none"
-                  type="radio"
-                  oncommand="TodayPane.displayMiniSection('none')"
-                  label="&todaypane.showNone.label;"
-                  accesskey="&todaypane.showNone.accesskey;"/>
-      </menupopup>
-    </menu>
-    <menu id="ltnCalendarMenu"
-          observes="calendar_in_foreground"
-          insertbefore="viewSortMenuSeparator"
-          label="&lightning.menu.view.calendar.label;"
-          accesskey="&lightning.menu.view.calendar.accesskey;">
-      <menupopup id="ltnCalendarMenuPopup">
-        <menuitem id="ltnChangeViewDay"
-                  label="&lightning.toolbar.day.label;"
-                  accesskey="&lightning.toolbar.day.accesskey;"
-                  type="radio"
-                  name="calendarMenuViews"
-                  key="calendar-day-view-key"
-                  command="calendar_day-view_command"/>
-        <menuitem id="ltnChangeViewWeek"
-                  label="&lightning.toolbar.week.label;"
-                  accesskey="&lightning.toolbar.week.accesskey;"
-                  type="radio"
-                  name="calendarMenuViews"
-                  key="calendar-week-view-key"
-                  command="calendar_week-view_command"/>
-        <menuitem id="ltnChangeViewMultiweek"
-                  label="&lightning.toolbar.multiweek.label;"
-                  accesskey="&lightning.toolbar.multiweek.accesskey;"
-                  type="radio"
-                  name="calendarMenuViews"
-                  key="calendar-multiweek-view-key"
-                  command="calendar_multiweek-view_command"/>
-        <menuitem id="ltnChangeViewMonth"
-                  label="&lightning.toolbar.month.label;"
-                  accesskey="&lightning.toolbar.month.accesskey;"
-                  type="radio"
-                  name="calendarMenuViews"
-                  key="calendar-month-view-key"
-                  command="calendar_month-view_command"/>
-        <menuseparator id="ltnBeforeCalendarViewSection"/>
-        <menu id="ltnCalendarPaneMenu"
-              label="&lightning.toolbar.calendarmenu.label;"
-              accesskey="&lightning.toolbar.calendarmenu.accesskey;">
-          <menupopup id="ltnCalendarPanePopup"
-                     onpopupshowing="InitViewCalendarPaneMenu()">
-            <menuitem id="ltnViewCalendarPane"
-                      type="checkbox"
-                      label="&lightning.toolbar.calendarpane.label;"
-                      accesskey="&lightning.toolbar.calendarpane.accesskey;"
-                      command="calendar_toggle_calendarsidebar_command"/>
-            <menuseparator id="ltnCalendarPaneMenuSeparator"/>
-            <menuitem id="ltnTasksViewMinimonth"
-                      type="checkbox"
-                      label="&calendar.tasks.view.minimonth.label;"
-                      accesskey="&calendar.tasks.view.minimonth.accesskey;"
-                      command="calendar_toggle_minimonthpane_command"/>
-            <menuitem id="ltnTasksViewCalendarlist"
-                      type="checkbox"
-                      label="&calendar.tasks.view.calendarlist.label;"
-                      accesskey="&calendar.tasks.view.calendarlist.accesskey;"
-                      command="calendar_toggle_calendarlist_command"/>
-          </menupopup>
-        </menu>
-        <menuseparator id="ltnBeforeCurrentViewMenu"/>
-        <menu id="ltnCalendarCurrentViewMenu"
-              observes="calendar_mode_calendar"
-              label="&showCurrentView.label;"
-              accesskey="&showCurrentView.accesskey;">
-          <menupopup id="ltnCalendarCurrentViewMenuPopup">
-            <menuitem type="checkbox"
-                      id="ltnWorkdaysOnlyMenuitem"
-                      label="&calendar.onlyworkday.checkbox.label;"
-                      accesskey="&calendar.onlyworkday.checkbox.accesskey;"
-                      command="calendar_toggle_workdays_only_command"/>
-            <menuitem type="checkbox"
-                      id="ltnTasksInViewMenuitem"
-                      label="&calendar.displaytodos.checkbox.label;"
-                      accesskey="&calendar.displaytodos.checkbox.accesskey;"
-                      command="calendar_toggle_tasks_in_view_command"/>
-            <menuitem type="checkbox"
-                      id="ltnShowCompletedInViewMenuItem"
-                      label="&calendar.completedtasks.checkbox.label;"
-                      accesskey="&calendar.completedtasks.checkbox.accesskey;"
-                      command="calendar_toggle_show_completed_in_view_command"/>
-            <menuitem type="checkbox"
-                      id="ltnViewRotated"
-                      label="&calendar.orientation.label;"
-                      accesskey="&calendar.orientation.accesskey;"
-                      command="calendar_toggle_orientation_command"/>
-          </menupopup>
-        </menu>
-      </menupopup>
-    </menu>
-    <menu id="ltnTasksMenu"
-          observes="calendar_mode_task"
-          insertbefore="viewSortMenuSeparator"
-          label="&lightning.menu.view.tasks.label;"
-          accesskey="&lightning.menu.view.tasks.accesskey;">
-      <menupopup id="ltnTasksMenuPopup">
-        <menuitem id="ltnTasksViewFilterTasks"
-                  type="checkbox"
-                  label="&calendar.tasks.view.filtertasks.label;"
-                  accesskey="&calendar.tasks.view.filtertasks.accesskey;"
-                  command="calendar_toggle_filter_command"/>
-        <menuseparator id="ltnTasksViewSeparator"/>
-        <menuitem id="ltnTasksViewFilterCurrent"
-                  name="filtergroup"
-                  value="throughcurrent"
-                  type="radio"
-                  command="calendar_task_filter_command"
-                  label="&calendar.task.filter.current.label;"
-                  accesskey="&calendar.task.filter.current.accesskey;"/>
-        <menuitem id="ltnTasksViewFilterToday"
-                  name="filtergroup"
-                  value="throughtoday"
-                  type="radio"
-                  command="calendar_task_filter_command"
-                  label="&calendar.task.filter.today.label;"
-                  accesskey="&calendar.task.filter.today.accesskey;"/>
-        <menuitem id="ltnTasksViewFilterNext7days"
-                  name="filtergroup"
-                  value="throughsevendays"
-                  type="radio"
-                  command="calendar_task_filter_command"
-                  label="&calendar.task.filter.next7days.label;"
-                  accesskey="&calendar.task.filter.next7days.accesskey;"/>
-        <menuitem id="ltnTasksViewFilterNotstartedtasks"
-                  name="filtergroup"
-                  value="notstarted"
-                  type="radio"
-                  command="calendar_task_filter_command"
-                  label="&calendar.task.filter.notstarted.label;"
-                  accesskey="&calendar.task.filter.notstarted.accesskey;"/>
-        <menuitem id="ltnTasksViewFilterOverdue"
-                  name="filtergroup"
-                  value="overdue"
-                  type="radio"
-                  command="calendar_task_filter_command"
-                  label="&calendar.task.filter.overdue.label;"
-                  accesskey="&calendar.task.filter.overdue.accesskey;"/>
-        <menuitem id="ltnTasksViewFilterCompleted"
-                  name="filtergroup"
-                  type="radio"
-                  value="completed"
-                  command="calendar_task_filter_command"
-                  label="&calendar.task.filter.completed.label;"
-                  accesskey="&calendar.task.filter.completed.accesskey;"/>
-        <menuitem id="ltnTasksViewFilterOpen"
-                  name="filtergroup"
-                  type="radio"
-                  value="open"
-                  command="calendar_task_filter_command"
-                  label="&calendar.task.filter.open.label;"
-                  accesskey="&calendar.task.filter.open.accesskey;"/>
-        <menuitem id="ltnTasksViewFilterAll"
-                  name="filtergroup"
-                  value="all"
-                  type="radio"
-                  command="calendar_task_filter_command"
-                  label="&calendar.task.filter.all.label;"
-                  accesskey="&calendar.task.filter.all.accesskey;"/>
-      </menupopup>
-    </menu>
-  </menupopup>
-
 
   <menupopup id="mailContext">
     <menu id="mailContext-calendar-convert-menu"
           insertafter="mailContext-moveToFolderAgain"
           label="&calendar.context.convertmenu.label;"
           accesskey="&calendar.context.convertmenu.accesskey.mail;">
       <menupopup id="mailContext-calendar-convert-menupopup">
         <menuitem id="mailContext-calendar-convert-event-menuitem"
@@ -242,17 +42,17 @@
                   label="&calendar.context.convertmenu.task.label;"
                   accesskey="&calendar.context.convertmenu.task.accesskey;"
                   oncommand="calendarExtract.extractFromEmail(false)" />
       </menupopup>
     </menu>
   </menupopup>
 
   <menupopup id="toolbar-context-menu"
-             onpopupshowing="onToolbarsPopupShowingForTabType(event);"/>
+             onpopupshowing="calendarOnToolbarsPopupShowing(event);"/>
 
   <!-- App Menu Integration -->
   <!-- Calendar menu items added to appmenu menus -->
 
   <!-- Main Appmenu View -->
   <vbox id="appMenu-mainViewItems">
     <toolbarbutton id="appmenu_Event_Task"
                    class="subviewbutton subviewbutton-nav"
--- a/calendar/lightning/jar.mn
+++ b/calendar/lightning/jar.mn
@@ -16,16 +16,17 @@ lightning.jar:
     content/calendar-buttons-mail-toolbar.inc.xhtml        (content/calendar-buttons-mail-toolbar.inc.xhtml)
     content/calendar-commands.inc.xhtml                    (content/calendar-commands.inc.xhtml)
     content/calendar-context-menus-and-tooltips.inc.xhtml  (content/calendar-context-menus-and-tooltips.inc.xhtml)
     content/calendar-keys.inc.xhtml                        (content/calendar-keys.inc.xhtml)
     content/calendar-menu-events-tasks.inc.xhtml           (content/calendar-menu-events-tasks.inc.xhtml)
     content/calendar-status-bar.inc.xhtml                  (content/calendar-status-bar.inc.xhtml)
     content/calendar-tab-panels.inc.xhtml                  (content/calendar-tab-panels.inc.xhtml)
     content/calendar-today-pane.inc.xhtml                  (content/calendar-today-pane.inc.xhtml)
+    content/calendar-view-menu.inc.xhtml                   (content/calendar-view-menu.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/mainNavigationToolbox.inc.xhtml
+++ b/mail/base/content/mainNavigationToolbox.inc.xhtml
@@ -369,17 +369,17 @@
     <!-- View -->
     <menu id="menu_View"
           label="&viewMenu.label;"
           accesskey="&viewMenu.accesskey;">
       <menupopup id="menu_View_Popup" onpopupshowing="view_init();">
         <menu id="menu_Toolbars"
               label="&viewToolbarsMenu.label;"
               accesskey="&viewToolbarsMenu.accesskey;"
-              onpopupshowing="onViewToolbarsPopupShowing(event, 'mail-toolbox');">
+              onpopupshowing="calendarOnToolbarsPopupShowing(event);">
           <menupopup id="view_toolbars_popup">
             <menuitem id="view_toolbars_popup_quickFilterBar"
                       type="checkbox"
                       label="&quickFilterBar.toggleBarVisibility.menu.label;"
                       accesskey="&quickFilterBar.toggleBarVisibility.menu.accesskey;"
                       command="cmd_toggleQuickFilterBar"/>
             <menuitem id="menu_showTaskbar"
                       type="checkbox"
@@ -442,16 +442,19 @@
             <menuseparator id="menu_compactViewSeparator"/>
             <menuitem id="menu_compactFolderView"
                       label="&compactVersion.label;"
                       accesskey="&compactVersion.accesskey;"
                       type="checkbox"
                       oncommand="gFolderTreeView.toggleCompact(this.getAttribute('checked') == 'true');"/>
           </menupopup>
         </menu>
+
+#include ../../../calendar/lightning/content/calendar-view-menu.inc.xhtml
+
         <menuseparator id="viewSortMenuSeparator"/>
         <menu id="viewSortMenu" accesskey="&sortMenu.accesskey;" label="&sortMenu.label;">
           <menupopup id="menu_viewSortPopup" onpopupshowing="InitViewSortByMenu()">
             <menuitem id="sortByDateMenuitem" type="radio" name="sortby" label="&sortByDateCmd.label;" accesskey="&sortByDateCmd.accesskey;" oncommand="MsgSortThreadPane('byDate')"/>
             <menuitem id="sortByReceivedMenuitem" type="radio" name="sortby" label="&sortByReceivedCmd.label;" accesskey="&sortByReceivedCmd.accesskey;" oncommand="MsgSortThreadPane('byReceived')"/>
             <menuitem id="sortByFlagMenuitem" type="radio" name="sortby" label="&sortByStarCmd.label;" accesskey="&sortByStarCmd.accesskey;" oncommand="MsgSortThreadPane('byFlagged')"/>
             <menuitem id="sortByOrderReceivedMenuitem" type="radio" name="sortby" label="&sortByOrderReceivedCmd.label;"  accesskey="&sortByOrderReceivedCmd.accesskey;" oncommand="MsgSortThreadPane('byId')"/>
             <menuitem id="sortByPriorityMenuitem" type="radio" name="sortby" label="&sortByPriorityCmd.label;" accesskey="&sortByPriorityCmd.accesskey;" oncommand="MsgSortThreadPane('byPriority')"/>