Bug 718332 - Calendar/Task toolbar not shown in menu View > Toolbars or toolbar context menu. r=philipp
authorDecathlon <bv1578@gmail.com>
Sun, 02 Jun 2013 23:09:32 +0200
changeset 15697 6ea5e19539b8948e7d84229542d0a755e8b3ca84
parent 15696 f2e605ee5475efbbf806bb1cbeeaccf9090150ed
child 15698 385e5d45032a2a8f44476e14bc77f3d3efcaa4b1
push id942
push userbugzilla@standard8.plus.com
push dateMon, 05 Aug 2013 19:15:38 +0000
treeherdercomm-beta@0e1a1c4a9f0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs718332
Bug 718332 - Calendar/Task toolbar not shown in menu View > Toolbars or toolbar context menu. r=philipp
calendar/lightning/content/lightning-menus.xul
calendar/lightning/content/lightning-toolbar.xul
calendar/lightning/content/messenger-overlay-sidebar.js
calendar/lightning/content/messenger-overlay-sidebar.xul
--- a/calendar/lightning/content/lightning-menus.xul
+++ b/calendar/lightning/content/lightning-menus.xul
@@ -61,16 +61,18 @@
               insertafter="menu_properties"
               label="&calendar.properties.label;"
               accesskey="&calendar.properties.accesskey;"
               command="calendar_edit_calendar_command"
               observes="calendar_edit_calendar_command"/>
   </menupopup>
 
   <menupopup id="menu_View_Popup">
+    <menu id="menu_Toolbars"
+          onpopupshowing="onToolbarsPopupShowingWithMode(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"
@@ -275,16 +277,17 @@
               label-multiweek="&lightning.toolbar.week.label;"
               label-month="&lightning.toolbar.month.label;"
               accesskey-day="&lightning.toolbar.day.accesskey;"
               accesskey-week="&lightning.toolbar.week.accesskey;"
               accesskey-multiweek="&lightning.toolbar.week.accesskey;"
               accesskey-month="&lightning.toolbar.month.accesskey;"
               observes="calendar_view_next_command"/>
   </menupopup>
+
   <menupopup id="menu_GoPreviousPopup">
     <menuseparator id="ltnGoPreviousSeparator"/>
     <!-- Label is set up automatically using the view id. When writing a
          view extension, overlay this menuitem and add a label-<myviewtype>
          attribute with the correct label -->
     <menuitem id="calendar-go-menu-previous"
               label=""
               label-day="&lightning.toolbar.day.label;"
@@ -427,16 +430,19 @@
         <menuitem id="mailContext-calendar-convert-task-menuitem"
                   label="&calendar.context.convertmenu.task.label;"
                   accesskey="&calendar.context.convertmenu.task.accesskey;"
                   oncommand="calendarTaskButtonDNDObserver.onDropMessage(gFolderDisplay.selectedMessage)"/>
       </menupopup>
     </menu>
   </menupopup>
 
+  <menupopup id="toolbar-context-menu"
+             onpopupshowing="onToolbarsPopupShowingWithMode(event);"/>
+
 <!-- AppMenu integration -->
   <menupopup id="appmenu_newMenupopup">
     <menuitem id="appmenu_ltnNewEvent"
               label="&lightning.menupopup.new.event.label;"
               insertbefore="appmenu_newFolder"
               command="calendar_new_event_command"
               observes="calendar_new_event_command"/>
     <menuitem id="appmenu_ltnNewTask"
@@ -447,16 +453,20 @@
     <menuseparator id="appmenu_afterltnNewTask"
                    insertbefore="appmenu_newFolder"
                    observes="appmenu_newFolder"/>
     <menuitem id="appmenu_ltnNewCalendar" label="&lightning.menupopup.new.calendar.label;"
                command="calendar_new_calendar_command"
                observes="calendar_new_calendar_command"
                insertafter="appmenu_newAccountMenuItem"/>
   </menupopup>
+  <splitmenu id="appmenu_customize">
+    <menupopup id="appmenu_customizeMenu"
+               onpopupshowing="onToolbarsPopupShowingWithMode(event, document.getElementById('appmenu_quickFilterBar'));"/>
+  </splitmenu>
   <menupopup id="appmenu_FilePopup">
     <menu id="appmenu_Open"
           mode="calendar"
           label="&lightning.menupopup.open.label;"
           accesskey="&lightning.menupopup.open.accesskey;"
           insertbefore="appmenu_openMessageFileMenuitem">
       <menupopup id="appmenu_OpenPopup">
         <menuitem id="appmenu_OpenMessageFileMenuitem"
--- a/calendar/lightning/content/lightning-toolbar.xul
+++ b/calendar/lightning/content/lightning-toolbar.xul
@@ -13,23 +13,27 @@
   <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" > %brandDTD;
 ]>
 
 <?xml-stylesheet href="chrome://lightning/skin/lightning.css" type="text/css"?>
 <?xml-stylesheet href="chrome://lightning/skin/lightning-toolbar.css" type="text/css"?>
 
 <overlay id="ltnToolbarOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <popupset id="calendar-popupset">
-    <menupopup id="calendar-toolbar-context">
+    <menupopup id="calendar-toolbar-context"
+               onpopupshowing="onViewToolbarsPopupShowing(event, ['calendar-toolbox', 'navigation-toolbox']);">
+      <menuseparator id="customizeCalendarToolbarMenuSeparator"/>
       <menuitem id="CustomizeCalendarToolbar"
                 label="&calendar.menu.customize.label;"
                 accesskey="&calendar.menu.customize.accesskey;"
                 oncommand="CustomizeMailToolbar('calendar-toolbox', 'CustomizeCalendarToolbar')"/>
     </menupopup>
-    <menupopup id="task-toolbar-context">
+    <menupopup id="task-toolbar-context"
+               onpopupshowing="onViewToolbarsPopupShowing(event, ['task-toolbox', 'navigation-toolbox']);">
+      <menuseparator id="customizeTaskToolbarMenuSeparator"/>
       <menuitem id="CustomizeTaskToolbar"
                 label="&calendar.menu.customize.label;"
                 accesskey="&calendar.menu.customize.accesskey;"
                 oncommand="CustomizeMailToolbar('task-toolbox', 'CustomizeTaskToolbar')"/>
     </menupopup>
   </popupset>
 
   <!-- The popup id here must match the popup id in the SeaMonkey
--- a/calendar/lightning/content/messenger-overlay-sidebar.js
+++ b/calendar/lightning/content/messenger-overlay-sidebar.js
@@ -440,8 +440,19 @@ function calInitMessageMenu() {
     calInitMessageMenu.origFunc();
 
     document.getElementById("markMenu").disabled = (gCurrentMode != 'mail');
 }
 calInitMessageMenu.origFunc = InitMessageMenu;
 InitMessageMenu = calInitMessageMenu;
 
 window.addEventListener("load", ltnOnLoad, false);
+
+/**
+ * Make the toolbars' context menu dependent on the current mode.
+ */
+function onToolbarsPopupShowingWithMode(aEvent, aInsertPoint) {
+    let toolbox = [gCurrentMode + "-toolbox"];
+    if (gCurrentMode != "mail") {
+        toolbox.push("navigation-toolbox");
+    }
+    onViewToolbarsPopupShowing(aEvent, toolbox, aInsertPoint);
+}
--- a/calendar/lightning/content/messenger-overlay-sidebar.xul
+++ b/calendar/lightning/content/messenger-overlay-sidebar.xul
@@ -52,16 +52,21 @@
                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(now())"/>
     </commandset>
 
+    <commandset id="mailCommands">
+      <command id="cmd_CustomizeMailToolbar"
+               oncommand="CustomizeMailToolbar(document.getElementById('modeBroadcaster').getAttribute('mode') + '-toolbox', 'CustomizeMailToolbar')"/>
+    </commandset>
+
     <keyset id="calendar-keys">
       <key id="openLightningKey"
            key="&lightning.keys.event.showCalendar.key;"
            modifiers="accel, shift"
            observes="new_calendar_tab"/>
       <key id="openTasksKey"
            key="&lightning.keys.event.showTasks.key;"
            modifiers="accel, shift"
@@ -91,23 +96,26 @@
                    command="new_task_tab"/>
   </toolbar>
 
   <tabpanels id="tabpanelcontainer">
     <vbox id="calendarTabPanel">
       <!-- Unfortunately we use the same panel for task and calendar tabs, so
            we need to differ which toolbar is being shown. The actual toolbar
            content will be added via a further overlay -->
-      <deck id="calendar-toolbar-deck">
-        <toolbox id="calendar-toolbox"/>
-        <toolbox id="task-toolbox"/>
+      <toolbox id="calendar-toolbox">
         <observes element="modeBroadcaster"
                   attribute="mode"
-                  onbroadcast="this.parentNode.selectedPanel = document.getElementById(document.getElementById('modeBroadcaster').getAttribute('mode') + '-toolbox');"/>
-      </deck>
+                  onbroadcast="this.parentNode.setAttribute('collapsed', '' + document.getElementById('modeBroadcaster').getAttribute('mode') != 'calendar')"/>
+      </toolbox>
+      <toolbox id="task-toolbox">
+        <observes element="modeBroadcaster"
+                  attribute="mode"
+                  onbroadcast="this.parentNode.setAttribute('collapsed', '' + document.getElementById('modeBroadcaster').getAttribute('mode') != 'task')"/>
+      </toolbox>
       <hbox id="calendarContent" flex="1">
         <vbox id="ltnSidebar"
               width="200"
               persist="collapsed width">
           <modevbox id="minimonth-pane" mode="calendar,task" broadcaster="modeBroadcaster" refcontrol="calendar_toggle_minimonthpane_command">
             <vbox align="center">
               <hbox id="calMinimonthBox" pack="center">
                 <minimonth id="calMinimonth" onchange="minimonthPick(this.value);" freebusy="true"/>