Fix bug 714431 - Extra Fix comment 30 - New Event... and New Task... are always disabled (regression). r=philipp
authorWolfgang Sourdeau <wsourdeau@inverse.ca>
Thu, 19 Jan 2012 22:50:08 +0100
changeset 10460 b43d9f97aad8bb299a5308f87e78d87fa7cb3614
parent 10459 277a05c41121a286737e5299cbf0a51125799a81
child 10461 3b98674b500b31ad6819c3c39310d8f570b0a7ab
push idunknown
push userunknown
push dateunknown
reviewersphilipp
bugs714431
Fix bug 714431 - Extra Fix comment 30 - New Event... and New Task... are always disabled (regression). r=philipp
calendar/base/content/calendar-chrome-startup.js
--- a/calendar/base/content/calendar-chrome-startup.js
+++ b/calendar/base/content/calendar-chrome-startup.js
@@ -71,21 +71,25 @@ function commonInitCalendar() {
     // Set up window pref observers
     calendarWindowPrefs.init();
 
     // Check if the system colors should be used
     if (cal.getPrefSafe("calendar.view.useSystemColors", false)) {
         document.documentElement.setAttribute("systemcolors", "true");
     }
 
-    // Ensure the new items commands state can be setup properly even when no
-    // calendar support refreshes (i.e. the "onLoad" notification)
-    if (!cal.getCalendarManager().getCalendars({}).some(function(x) x.canRefresh)) {
-        calendarUpdateNewItemsCommand();
-    }
+    /* Ensure the new items commands state can be setup properly even when no
+     * calendar support refreshes (i.e. the "onLoad" notification) or when none
+     * are active. In specific cases such as for file-based ICS calendars can
+     * happen, the initial "onLoad" will already have been triggered at this
+     * point (see bug 714431 comment 29). We thus inconditionnally invoke
+     * calendarUpdateNewItemsCommand until somebody writes code that enables the
+     * checking of the calendar readiness (getProperty("ready") ?).
+     */
+    calendarUpdateNewItemsCommand();
 }
 
 /**
  * Common unload steps for calendar chrome windows.
  */
 function commonFinishCalendar() {
     // Unload the calendar manager
     unloadCalendarManager();