зеркало из https://github.com/mozilla/pjs.git
Bug 321560 Wrong day selected (due to tz-offset) in new views when using minimonth or datepicker. r=mvl
This commit is contained in:
Родитель
5224503dce
Коммит
965b61fa03
|
@ -171,6 +171,15 @@
|
|||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="timezone">
|
||||
<getter><![CDATA[
|
||||
return document.getAnonymousElementByAttribute(this, "anonid", "view-element").timezone;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "view-element").timezone = val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="selectionObserver">
|
||||
<getter><![CDATA[
|
||||
return document.getAnonymousElementByAttribute(this, "anonid", "view-element").mSelectionObserver;
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
if (this.mWorkdaysOnly) {
|
||||
this.removeNonWorkdays();
|
||||
}
|
||||
viewElement.selectedDay = aDate;
|
||||
viewElement.selectedDay = aDate.getInTimezone(viewElement.timezone);
|
||||
this.setNavLabels(aDate);
|
||||
]]></body>
|
||||
</method>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -622,13 +622,22 @@
|
|||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="timezone">
|
||||
<getter><![CDATA[
|
||||
return this.mTimezone;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mTimezone = val;
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
|
||||
<method name="showDate">
|
||||
<parameter name="aDate"/>
|
||||
<body><![CDATA[
|
||||
this.setDateRange(aDate.startOfMonth, aDate.endOfMonth);
|
||||
|
||||
this.selectedDay = aDate;
|
||||
this.selectedDay = aDate.getInTimezone(this.mTimezone);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
@ -636,13 +645,14 @@
|
|||
<parameter name="aStartDate"/>
|
||||
<parameter name="aEndDate"/>
|
||||
<body><![CDATA[
|
||||
if (this.mTimezone != aStartDate.timezone) {
|
||||
aStartDate = aStartDate.getInTimezone(this.mTimezone);
|
||||
aEndDate = aEndDate.getInTimezone(this.mTimezone);
|
||||
}
|
||||
|
||||
this.mStartDate = aStartDate.startOfWeek;
|
||||
this.mEndDate = aEndDate.endOfWeek;
|
||||
|
||||
if (this.mTimezone != aStartDate.timezone) {
|
||||
this.mTimezone = aStartDate.timezone;
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
]]></body>
|
||||
</method>
|
||||
|
|
|
@ -1529,6 +1529,7 @@
|
|||
<field name="mStartMin">8*60</field>
|
||||
<field name="mEndMin">20*60</field>
|
||||
<field name="mTasksInView">true</field>
|
||||
<field name="mTimezone">"UTC"</field>
|
||||
|
||||
<field name="mSelectionObserver"><![CDATA[
|
||||
({ calView: this,
|
||||
|
@ -1757,11 +1758,21 @@
|
|||
]]></setter>
|
||||
</property>
|
||||
|
||||
<property name="timezone">
|
||||
<getter><![CDATA[
|
||||
return this.mTimezone;
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this.mTimezone = val;
|
||||
return val;
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
|
||||
<method name="showDate">
|
||||
<parameter name="aDate"/>
|
||||
<body><![CDATA[
|
||||
var targetDate = aDate.clone();
|
||||
var targetDate = aDate.getInTimezone(this.mTimezone);
|
||||
targetDate.isDate = true;
|
||||
|
||||
if (this.mStartDate && this.mEndDate) {
|
||||
|
@ -1784,7 +1795,7 @@
|
|||
this.setDateRange(aDate.startOfWeek, aDate.endOfWeek);
|
||||
}
|
||||
|
||||
this.selectedDay = aDate;
|
||||
this.selectedDay = targetDate;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -149,6 +149,7 @@ function showCalendarView(type)
|
|||
|
||||
if (view.displayCalendar != getCompositeCalendar()) {
|
||||
view.displayCalendar = getCompositeCalendar();
|
||||
view.timezone = calendarDefaultTimezone();
|
||||
view.controller = ltnCalendarViewController;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче