Bug 974816 - Right click in the calendar list bring up wrong calendar property dialog after toggle offline. r=philipp
authorChen Wei <weichen302@gmail.com>
Tue, 18 Mar 2014 07:55:54 -0400
changeset 19732 74fed8c5ce2d196c2ff41f612e7393ac48f65053
parent 19731 297a405a9c853df52aa62464bcfde68d9b70c478
child 19733 c7ddf29222cd86d0efd4db3ba637c01f56bbab8a
push id1151
push usermbanner@mozilla.com
push dateMon, 09 Jun 2014 22:14:36 +0000
treeherdercomm-beta@ce127428ad7d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs974816
Bug 974816 - Right click in the calendar list bring up wrong calendar property dialog after toggle offline. r=philipp
calendar/base/content/widgets/calendar-list-tree.xml
--- a/calendar/base/content/widgets/calendar-list-tree.xml
+++ b/calendar/base/content/widgets/calendar-list-tree.xml
@@ -488,16 +488,25 @@
               updateStyleSheetForViews(aCalendar);
           }
 
           // Watch the calendar for changes, i.e color.
           aCalendar.addObserver(this.calObserver);
 
           // Adding a calendar causes the sortorder to be changed.
           this.sortOrderChanged();
+
+          // Re-assign defaultCalendar, sometimes it is not the right one after
+          // remove & add calendar.
+          if (composite.defaultCalendar && this.tree.currentIndex > -1) {
+              let currentCal = this.getCalendar(this.tree.currentIndex);
+              if (composite.defaultCalendar.id != currentCal.id) {
+                  composite.defaultCalendar = currentCal;
+              }
+          }
         ]]></body>
       </method>
 
       <method name="removeCalendar">
         <!--
           - Remove a calendar from the calendar list
           -
           - @param aCalendar     The calendar to remove.