зеркало из https://github.com/mozilla/pjs.git
Bug 396277, Bug 396279 - fixing view update after timezone, tasks in view change; r=mickey
This commit is contained in:
Родитель
376f6f672a
Коммит
a7fdbd54de
|
@ -1091,24 +1091,17 @@
|
||||||
<parameter name="aEndDate"/>
|
<parameter name="aEndDate"/>
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
if (this.mTimezone != aStartDate.timezone) {
|
if (this.mTimezone != aStartDate.timezone) {
|
||||||
aStartDate = aStartDate.getInTimezone(this.mTimezone);
|
aStartDate = aStartDate.getInTimezone(this.mTimezone);
|
||||||
aEndDate = aEndDate.getInTimezone(this.mTimezone);
|
aEndDate = aEndDate.getInTimezone(this.mTimezone);
|
||||||
}
|
}
|
||||||
var startDate = aStartDate.startOfWeek.clone();
|
|
||||||
var endDate = aEndDate.endOfWeek.clone();
|
|
||||||
startDate.day += this.mWeekStartOffset;
|
|
||||||
endDate.day += this.mWeekStartOffset;
|
|
||||||
|
|
||||||
function compareDatetimes(one, two) {
|
this.mStartDate = aStartDate.startOfWeek;
|
||||||
return ((!one && !two) ||
|
this.mEndDate = aEndDate.endOfWeek;
|
||||||
(one && two && (one.compare(two) == 0)));
|
|
||||||
}
|
this.mStartDate.day += this.mWeekStartOffset;
|
||||||
if (!compareDatetimes(this.mStartDate, startDate) ||
|
this.mEndDate.day += this.mWeekStartOffset;
|
||||||
!compareDatetimes(this.mEndDate, endDate)) {
|
|
||||||
this.mStartDate = startDate;
|
this.refresh();
|
||||||
this.mEndDate = endDate;
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
@ -1208,13 +1201,14 @@
|
||||||
else
|
else
|
||||||
filter |= this.mCalendar.ITEM_FILTER_TYPE_EVENT;
|
filter |= this.mCalendar.ITEM_FILTER_TYPE_EVENT;
|
||||||
|
|
||||||
this.mRefreshPending = this.mCalendar.getItems(filter,
|
this.mRefreshPending = true;
|
||||||
0,
|
pendingRefresh = this.mCalendar.getItems(filter,
|
||||||
this.startDate,
|
0,
|
||||||
this.queryEndDate,
|
this.startDate,
|
||||||
this.mOperationListener);
|
this.queryEndDate,
|
||||||
if (!this.mRefreshPending) { // no support for calIOperation, fallback to bool
|
this.mOperationListener);
|
||||||
this.mRefreshPending = true;
|
if (pendingRefresh && pendingRefresh.isPending) { // support for calIOperation
|
||||||
|
this.mRefreshPending = pendingRefresh;
|
||||||
}
|
}
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
|
@ -2554,36 +2554,29 @@
|
||||||
aStartDate = aEndDate = null;
|
aStartDate = aEndDate = null;
|
||||||
|
|
||||||
if (this.mDisplayDaysOff) {
|
if (this.mDisplayDaysOff) {
|
||||||
function compareDatetimes(one, two) {
|
startDate.makeImmutable();
|
||||||
return ((!one && !two) ||
|
endDate.makeImmutable();
|
||||||
(one && two && (one.compare(two) == 0)));
|
this.mDateList = null;
|
||||||
}
|
this.mStartDate = startDate;
|
||||||
if (!compareDatetimes(this.mStartDate, startDate) ||
|
this.mEndDate = endDate;
|
||||||
!compareDatetimes(this.mEndDate, endDate)) {
|
//
|
||||||
startDate.makeImmutable();
|
// For a true multiday view (e.g, 3 days advanced by one day
|
||||||
endDate.makeImmutable();
|
// at a time), a smarter refresh could reuse boxes, comparing
|
||||||
this.mDateList = null;
|
// the current date range and add/remove, instead of just
|
||||||
this.mStartDate = startDate;
|
// replacing.
|
||||||
this.mEndDate = endDate;
|
//
|
||||||
//
|
this.refresh();
|
||||||
// For a true multiday view (e.g, 3 days advanced by one day
|
|
||||||
// at a time), a smarter refresh could reuse boxes, comparing
|
|
||||||
// the current date range and add/remove, instead of just
|
|
||||||
// replacing.
|
|
||||||
//
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
} else { // workdays only
|
} else { // workdays only
|
||||||
var dateList = new Array();
|
var dateList = new Array();
|
||||||
for (var d = startDate.clone(); d.compare(endDate) <= 0;) {
|
for (var d = startDate.clone(); d.compare(endDate) <= 0;) {
|
||||||
if (this.mDaysOffArray.indexOf(d.weekday) == -1) {
|
if (this.mDaysOffArray.indexOf(d.weekday) == -1) {
|
||||||
var workday = d.clone();
|
var workday = d.clone();
|
||||||
workday.makeImmutable();
|
workday.makeImmutable();
|
||||||
dateList.push(workday);
|
dateList.push(workday);
|
||||||
}
|
|
||||||
d.day += 1;
|
|
||||||
}
|
}
|
||||||
this.setDateList(dateList.length, dateList);
|
d.day += 1;
|
||||||
|
}
|
||||||
|
this.setDateList(dateList.length, dateList);
|
||||||
}
|
}
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
@ -2595,10 +2588,11 @@
|
||||||
this.mStartDate = null;
|
this.mStartDate = null;
|
||||||
this.mEndDate = null;
|
this.mEndDate = null;
|
||||||
|
|
||||||
var dateList = null;
|
if (aCount == 0) {
|
||||||
if (aCount > 0) {
|
this.mDateList = null;
|
||||||
|
} else {
|
||||||
aDates.sort (function(a, b) { return a.compare(b); });
|
aDates.sort (function(a, b) { return a.compare(b); });
|
||||||
dateList = aDates.map(
|
this.mDateList = aDates.map(
|
||||||
function dateMapper(d) {
|
function dateMapper(d) {
|
||||||
if (d.isDate && !d.isMutable)
|
if (d.isDate && !d.isMutable)
|
||||||
return d;
|
return d;
|
||||||
|
@ -2610,14 +2604,8 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
function compareDatetimes(one, two) {
|
|
||||||
return ((!one && !two) ||
|
this.refresh();
|
||||||
(one && two && (one.compare(two) == 0)));
|
|
||||||
}
|
|
||||||
if (!compareArrays(this.mDateList, dateList, compareDatetimes)) {
|
|
||||||
this.mDateList = dateList;
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
@ -2903,13 +2891,14 @@
|
||||||
else
|
else
|
||||||
filter |= this.mCalendar.ITEM_FILTER_TYPE_EVENT;
|
filter |= this.mCalendar.ITEM_FILTER_TYPE_EVENT;
|
||||||
|
|
||||||
this.mRefreshPending = this.mCalendar.getItems(filter,
|
this.mRefreshPending = true;
|
||||||
0,
|
pendingRefresh = this.mCalendar.getItems(filter,
|
||||||
this.startDate,
|
0,
|
||||||
this.queryEndDate,
|
this.startDate,
|
||||||
this.mOperationListener);
|
this.queryEndDate,
|
||||||
if (!this.mRefreshPending) { // no support for calIOperation, fallback to bool
|
this.mOperationListener);
|
||||||
this.mRefreshPending = true;
|
if (pendingRefresh && pendingRefresh.isPending) { // support for calIOperation
|
||||||
|
this.mRefreshPending = pendingRefresh;
|
||||||
}
|
}
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
|
@ -200,11 +200,13 @@ function toDoUnifinderRefresh()
|
||||||
|
|
||||||
ccalendar.getItems(filter, 0, null, null, refreshListener);
|
ccalendar.getItems(filter, 0, null, null, refreshListener);
|
||||||
var deck = document.getElementById("view-deck");
|
var deck = document.getElementById("view-deck");
|
||||||
|
var selectedShowCompleted = deck.selectedPanel.showCompleted;
|
||||||
for each (view in deck.childNodes) {
|
for each (view in deck.childNodes) {
|
||||||
view.showCompleted = !hideCompleted;
|
view.showCompleted = !hideCompleted;
|
||||||
}
|
}
|
||||||
var selectedDay = deck.selectedPanel.selectedDay;
|
var selectedDay = deck.selectedPanel.selectedDay;
|
||||||
if (selectedDay) {
|
// only update view if hide completed has actually changed:
|
||||||
|
if ((deck.selectedPanel.showCompleted != selectedShowCompleted) && selectedDay) {
|
||||||
deck.selectedPanel.goToDay(selectedDay);
|
deck.selectedPanel.goToDay(selectedDay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1203,6 +1203,7 @@ var gOpGroupId = 0;
|
||||||
* calendar operations (without handle).
|
* calendar operations (without handle).
|
||||||
*/
|
*/
|
||||||
function calOperationGroup(cancelFunc) {
|
function calOperationGroup(cancelFunc) {
|
||||||
|
this.wrappedJSObject = this;
|
||||||
if (!gOpGroupPrefix) {
|
if (!gOpGroupPrefix) {
|
||||||
gOpGroupPrefix = (getUUID() + "-");
|
gOpGroupPrefix = (getUUID() + "-");
|
||||||
}
|
}
|
||||||
|
@ -1244,6 +1245,10 @@ calOperationGroup.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
toString: function calOperationGroup_toString() {
|
||||||
|
return ("[calOperationGroup] id=" + this.id);
|
||||||
|
},
|
||||||
|
|
||||||
// calIOperation:
|
// calIOperation:
|
||||||
get id() {
|
get id() {
|
||||||
return this.mId;
|
return this.mId;
|
||||||
|
@ -1258,7 +1263,7 @@ calOperationGroup.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
get success() {
|
get success() {
|
||||||
return (!this.isPending && Components.results.isSuccessCode(this.status));
|
return (!this.isPending && Components.isSuccessCode(this.status));
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function calOperationGroup_cancel(status) {
|
cancel: function calOperationGroup_cancel(status) {
|
||||||
|
|
|
@ -44,10 +44,11 @@ const calIOperationListener = Components.interfaces.calIOperationListener;
|
||||||
|
|
||||||
function calCompositeCalendarObserverHelper (compCalendar) {
|
function calCompositeCalendarObserverHelper (compCalendar) {
|
||||||
this.compCalendar = compCalendar;
|
this.compCalendar = compCalendar;
|
||||||
|
this.pendingLoads = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
calCompositeCalendarObserverHelper.prototype = {
|
calCompositeCalendarObserverHelper.prototype = {
|
||||||
suppressOnLoad: false,
|
pendingLoads: null,
|
||||||
|
|
||||||
onStartBatch: function() {
|
onStartBatch: function() {
|
||||||
this.compCalendar.mObservers.notify("onStartBatch");
|
this.compCalendar.mObservers.notify("onStartBatch");
|
||||||
|
@ -58,7 +59,11 @@ calCompositeCalendarObserverHelper.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad: function(calendar) {
|
onLoad: function(calendar) {
|
||||||
if (!this.suppressOnLoad) {
|
// avoid unnecessary onLoad events:
|
||||||
|
if (this.pendingLoads[calendar.id]) {
|
||||||
|
// don't forward if caused by composite:
|
||||||
|
delete this.pendingLoads[calendar.id];
|
||||||
|
} else {
|
||||||
// any refreshed dependent calendar logically refreshes
|
// any refreshed dependent calendar logically refreshes
|
||||||
// this composite calendar, thus we send out an onLoad
|
// this composite calendar, thus we send out an onLoad
|
||||||
// for this composite calendar:
|
// for this composite calendar:
|
||||||
|
@ -310,25 +315,22 @@ calCompositeCalendar.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
this.mObserverHelper.suppressOnLoad = true;
|
for each (cal in this.mCalendars) {
|
||||||
try {
|
try {
|
||||||
for each (cal in this.mCalendars) {
|
if (cal.canRefresh) {
|
||||||
try {
|
this.mObserverHelper.pendingLoads[cal.id] = true;
|
||||||
if (cal.canRefresh) {
|
cal.refresh();
|
||||||
cal.refresh();
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
ASSERT(false, e);
|
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
ASSERT(false, e);
|
||||||
|
delete this.mObserverHelper.pendingLoads[cal.id];
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
this.mObserverHelper.suppressOnLoad = false;
|
|
||||||
// send out a single onLoad for this composite calendar,
|
|
||||||
// although e.g. the ics provider will trigger another
|
|
||||||
// onLoad asynchronously; we cannot rely on every calendar
|
|
||||||
// sending an onLoad:
|
|
||||||
this.mObservers.notify("onLoad", [this]);
|
|
||||||
}
|
}
|
||||||
|
// send out a single onLoad for this composite calendar,
|
||||||
|
// although e.g. the ics provider will trigger another
|
||||||
|
// onLoad asynchronously; we cannot rely on every calendar
|
||||||
|
// sending an onLoad:
|
||||||
|
this.mObservers.notify("onLoad", [this]);
|
||||||
},
|
},
|
||||||
|
|
||||||
// void modifyItem( in calIItemBase aNewItem, in calIItemBase aOldItem, in calIOperationListener aListener );
|
// void modifyItem( in calIItemBase aNewItem, in calIItemBase aOldItem, in calIOperationListener aListener );
|
||||||
|
|
Загрузка…
Ссылка в новой задаче