From 965b61fa03379ab3d4a946356fea26233f9d1597 Mon Sep 17 00:00:00 2001 From: "jminta%gmail.com" Date: Sun, 12 Feb 2006 20:42:58 +0000 Subject: [PATCH] Bug 321560 Wrong day selected (due to tz-offset) in new views when using minimonth or datepicker. r=mvl --- .../base/content/calendar-decorated-base.xml | 9 ++++++++ .../calendar-decorated-multiweek-view.xml | 2 +- .../content/calendar-decorated-week-view.xml | 2 +- calendar/base/content/calendar-month-view.xml | 22 ++++++++++++++----- .../base/content/calendar-multiday-view.xml | 19 ++++++++++++---- calendar/base/public/calICalendarView.idl | 6 +++++ calendar/base/public/calIDecoratedView.idl | 6 +++++ .../content/messenger-overlay-sidebar.js | 1 + calendar/resources/content/calendarWindow.js | 1 + 9 files changed, 56 insertions(+), 12 deletions(-) diff --git a/calendar/base/content/calendar-decorated-base.xml b/calendar/base/content/calendar-decorated-base.xml index a36d93e563f..e3fa4c46661 100644 --- a/calendar/base/content/calendar-decorated-base.xml +++ b/calendar/base/content/calendar-decorated-base.xml @@ -171,6 +171,15 @@ ]]> + + + + + diff --git a/calendar/base/content/calendar-decorated-week-view.xml b/calendar/base/content/calendar-decorated-week-view.xml index 16a9abad117..e4d954b7e42 100644 --- a/calendar/base/content/calendar-decorated-week-view.xml +++ b/calendar/base/content/calendar-decorated-week-view.xml @@ -163,7 +163,7 @@ document.getAnonymousElementByAttribute(this, "anonid", "view-element").setDateRange(d1, d2); - viewElement.selectedDay = aDate; + viewElement.selectedDay = aDate.getInTimezone(viewElement.timezone); if (this.mWorkdaysOnly) { this.removeNonWorkdays(); } diff --git a/calendar/base/content/calendar-month-view.xml b/calendar/base/content/calendar-month-view.xml index c59f72237a7..55ade234795 100644 --- a/calendar/base/content/calendar-month-view.xml +++ b/calendar/base/content/calendar-month-view.xml @@ -622,13 +622,22 @@ ]]> + + + + + @@ -636,13 +645,14 @@ diff --git a/calendar/base/content/calendar-multiday-view.xml b/calendar/base/content/calendar-multiday-view.xml index 773c013d837..2f8cce3fb10 100644 --- a/calendar/base/content/calendar-multiday-view.xml +++ b/calendar/base/content/calendar-multiday-view.xml @@ -1529,6 +1529,7 @@ 8*60 20*60 true + "UTC" + + + + + @@ -1795,11 +1806,11 @@ //dump ("setDateRange\n"); this.mDateList = null; - this.mStartDate = aStartDate.clone(); + this.mStartDate = aStartDate.getInTimezone(this.mTimezone); this.mStartDate.isDate = true; this.mStartDate.makeImmutable(); - this.mEndDate = aEndDate.clone(); + this.mEndDate = aEndDate.getInTimezone(this.mTimezone); this.mEndDate.isDate = true; this.mEndDate.makeImmutable(); diff --git a/calendar/base/public/calICalendarView.idl b/calendar/base/public/calICalendarView.idl index 2d93c97fa1b..b317fe8ddd1 100644 --- a/calendar/base/public/calICalendarView.idl +++ b/calendar/base/public/calICalendarView.idl @@ -129,4 +129,10 @@ interface calICalendarView : nsISupports * Get or set the selected day. */ attribute calIDateTime selectedDay; + + /** + * Get or set the timezone that the view's elements should be displayed in. + * Setting this does not refresh the view. + */ + attribute AUTF8String timezone; }; diff --git a/calendar/base/public/calIDecoratedView.idl b/calendar/base/public/calIDecoratedView.idl index 0d1b43cb3c6..02d4c52eeab 100644 --- a/calendar/base/public/calIDecoratedView.idl +++ b/calendar/base/public/calIDecoratedView.idl @@ -117,6 +117,12 @@ interface calIDecoratedView : nsISupports */ readonly attribute calIDateTime endDay; + /** + * Get or set the timezone that the view's elements should be displayed in. + * Setting this does not refresh the view. + */ + attribute AUTF8String timezone; + /** * Ensures that the given date is visible, and that the view is centered * around this date. aDate becomes the selectedDay of the view. Calling diff --git a/calendar/lightning/content/messenger-overlay-sidebar.js b/calendar/lightning/content/messenger-overlay-sidebar.js index e0555ff082d..1eade9036c8 100644 --- a/calendar/lightning/content/messenger-overlay-sidebar.js +++ b/calendar/lightning/content/messenger-overlay-sidebar.js @@ -149,6 +149,7 @@ function showCalendarView(type) if (view.displayCalendar != getCompositeCalendar()) { view.displayCalendar = getCompositeCalendar(); + view.timezone = calendarDefaultTimezone(); view.controller = ltnCalendarViewController; } diff --git a/calendar/resources/content/calendarWindow.js b/calendar/resources/content/calendarWindow.js index 8c4043146b1..598994708a2 100644 --- a/calendar/resources/content/calendarWindow.js +++ b/calendar/resources/content/calendarWindow.js @@ -350,6 +350,7 @@ CalendarWindow.prototype.switchToView = function calWin_switchToView( newView ) if (viewElement.displayCalendar != getDisplayComposite()) { viewElement.controller = gViewController; viewElement.displayCalendar = getDisplayComposite(); + viewElement.timezone = calendarDefaultTimezone(); this.EventSelection.addObserver(viewElement.selectionObserver); }