Bug 374973 - multiweek/month view jumps to another week when (de)selecting 'tasks in view' from context menu. r=philipp

This commit is contained in:
Decathlon 2013-04-15 20:09:43 +02:00
Родитель b38f5a0bfd
Коммит c95b502129
3 изменённых файлов: 36 добавлений и 19 удалений

Просмотреть файл

@ -609,8 +609,16 @@
<method name="showDate">
<parameter name="aDate"/>
<body><![CDATA[
this.setDateRange(aDate.startOfMonth, aDate.endOfMonth);
this.selectedDay = aDate;
// If aDate is null it means that only a refresh is needed
// without changing the start and end of the view.
if (aDate) {
this.setDateRange(aDate.startOfMonth, aDate.endOfMonth);
this.selectedDay = aDate;
} else {
this.refresh();
// Refresh the selected day if it doesn't appear in the view.
this.selectedDay = this.selectedDay;
}
]]></body>
</method>

Просмотреть файл

@ -637,7 +637,7 @@ function toggleWorkdaysOnly() {
}
// Refresh the current view
currentView().goToDay(currentView().selectedDay);
currentView().goToDay();
}
/**
@ -654,7 +654,7 @@ function toggleTasksInView() {
}
// Refresh the current view
currentView().goToDay(currentView().selectedDay);
currentView().goToDay();
}
/**
@ -671,7 +671,7 @@ function toggleShowCompletedInView() {
}
// Refresh the current view
currentView().goToDay(currentView().selectedDay);
currentView().goToDay();
}
/**

Просмотреть файл

@ -27,6 +27,7 @@
<method name="goToDay">
<parameter name="aDate"/>
<body><![CDATA[
aDate = aDate || currentView().selectedDay;
aDate = aDate.getInTimezone(this.timezone);
this.setDateRange(aDate, aDate);
this.selectedDay = aDate;
@ -86,6 +87,7 @@
<body><![CDATA[
this.displayDaysOff = !this.mWorkdaysOnly;
aDate = aDate || currentView().selectedDay;
aDate = aDate.getInTimezone(this.timezone);
var d1 = getWeekInfoService().getStartOfWeek(aDate);
var d2 = d1.clone();
@ -169,19 +171,24 @@
this.showFullMonth = false;
this.displayDaysOff = !this.mWorkdaysOnly;
aDate = aDate.getInTimezone(this.timezone);
// Get the first date that should be shown. This is the
// start of the week of the day that we're centering around
// adjusted for the day the week starts on and the number
// of previous weeks we're supposed to display.
let d1 = getWeekInfoService().getStartOfWeek(aDate);
d1.day -= (7 * cal.getPrefSafe("calendar.previousweeks.inview", 0));
// The last day we're supposed to show
let d2 = d1.clone();
d2.day += ((7 * this.mWeeksInView) - 1);
this.setDateRange(d1,d2);
this.selectedDay = aDate;
// If aDate is null it means that only a refresh is needed
// without changing the start and end of the view.
if (aDate) {
aDate = aDate.getInTimezone(this.timezone);
// Get the first date that should be shown. This is the
// start of the week of the day that we're centering around
// adjusted for the day the week starts on and the number
// of previous weeks we're supposed to display.
let d1 = getWeekInfoService().getStartOfWeek(aDate);
d1.day -= (7 * cal.getPrefSafe("calendar.previousweeks.inview", 0));
// The last day we're supposed to show
let d2 = d1.clone();
d2.day += ((7 * this.mWeeksInView) - 1);
this.setDateRange(d1, d2);
this.selectedDay = aDate;
} else {
this.refresh();
}
]]></body>
</method>
<method name="moveView">
@ -221,7 +228,9 @@
<body><![CDATA[
this.displayDaysOff = !this.mWorkdaysOnly;
aDate = aDate.getInTimezone(this.timezone);
if (aDate) {
aDate = aDate.getInTimezone(this.timezone);
}
this.showDate(aDate);
]]></body>
</method>