late checkin for Bug 473661 because of a error-console-output
authorBerend Cornelius [:berend] <berend.cornelius@sun.com>
Wed, 28 Jan 2009 11:40:40 +0100
changeset 1780 5359aa4cf8517dad141ac7c59bfc795ecb4d64b8
parent 1779 2e75cd634b873b54cd22db8fc45554e89e036f4f
child 1781 3078b20bc7ceefd57aca4bdff0096e5a793fdeac
push idunknown
push userunknown
push dateunknown
bugs473661
late checkin for Bug 473661 because of a error-console-output
calendar/base/content/calendar-chrome-startup.js
calendar/lightning/content/messenger-overlay-sidebar.js
calendar/lightning/content/messenger-overlay-toolbar.xul
--- a/calendar/base/content/calendar-chrome-startup.js
+++ b/calendar/base/content/calendar-chrome-startup.js
@@ -61,40 +61,30 @@ function commonInitCalendar() {
     // Start alarm service
     Components.classes["@mozilla.org/calendar/alarm-service;1"]
               .getService(Components.interfaces.calIAlarmService)
               .startup();
     document.getElementById("calsidebar_splitter").addEventListener("command", onCalendarViewResize, false);
     window.addEventListener("resize", onCalendarViewResize, true);
 
     // Set up listener for mailContext.
-    let mailContextPopup = document.getElementById("mailContext");
-    if (mailContextPopup)
-      mailContextPopup.addEventListener("popupshowing",
-                                        gCalSetupMailContext.popup, false);
 }
 
 /**
  * Common unload steps for calendar chrome windows.
  */
 function commonFinishCalendar() {
     // Unload the calendar manager
     unloadCalendarManager();
 
     // Remove the command controller
     removeCalendarCommandController();
 
     document.getElementById("calsidebar_splitter").removeEventListener("command", onCalendarViewResize, false);
     window.removeEventListener("resize", onCalendarViewResize, true);
-
-    // Remove listener for mailContext.
-    let mailContextPopup = document.getElementById("mailContext");
-    if (mailContextPopup)
-      mailContextPopup.removeEventListener("popupshowing",
-                                           gCalSetupMailContext.popup, false);
 }
 
 /**
  * Handler function to create |viewtype + "viewresized"| events that are
  * dispatched through the calendarviewBroadcaster.
  *
  * XXX this has nothing to do with startup, needs to go somewhere else.
  */
--- a/calendar/lightning/content/messenger-overlay-sidebar.js
+++ b/calendar/lightning/content/messenger-overlay-sidebar.js
@@ -128,16 +128,22 @@ function ltnOnLoad(event) {
 
     // Set up invitations manager
     scheduleInvitationsUpdate(FIRST_DELAY_STARTUP);
     getCalendarManager().addObserver(gInvitationsCalendarManagerObserver);
 
     var filter = document.getElementById("task-tree-filtergroup");
     filter.value = filter.value || "all";
     document.getElementById("modeBroadcaster").setAttribute("mode", gCurrentMode);
+
+    let mailContextPopup = document.getElementById("mailContext");
+    if (mailContextPopup)
+      mailContextPopup.addEventListener("popupshowing",
+                                        gCalSetupMailContext.popup, false);
+
 }
 
 /* Called at midnight to tell us to redraw date-specific widgets.  Do NOT call
  * this for normal refresh, since it also calls scheduleMidnightRefresh.
  */
 function refreshUIBits() {
     try {
         getMinimonth().refreshDisplay();
@@ -225,16 +231,22 @@ function LtnObserveDisplayDeckChange(eve
             ltnSwitch2Mail();
         }
     }
 }
 
 function ltnFinish() {
     getCalendarManager().removeObserver(gInvitationsCalendarManagerObserver);
 
+    // Remove listener for mailContext.
+    let mailContextPopup = document.getElementById("mailContext");
+    if (mailContextPopup)
+      mailContextPopup.removeEventListener("popupshowing",
+                                           gCalSetupMailContext.popup, false);
+
     // Common finish steps
     commonFinishCalendar();
 }
 
 // After 1.5 was released, the search box was moved into an optional toolbar
 // item, with a different ID.  This function keeps us compatible with both.
 function findMailSearchBox() {
     var tb15Box = document.getElementById("searchBox");
--- a/calendar/lightning/content/messenger-overlay-toolbar.xul
+++ b/calendar/lightning/content/messenger-overlay-toolbar.xul
@@ -47,18 +47,16 @@
   %lightningDTD;
   <!ENTITY % calendarDTD SYSTEM "chrome://calendar/locale/calendar.dtd" >
   %calendarDTD;
 ]>
 
 <?xml-stylesheet href="chrome://lightning/skin/lightning.css" type="text/css"?>
 
 <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <script type="application/javascript"
-          src="chrome://lightning/content/messenger-overlay-toolbar.js"/>
 
   <popup 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"