зеркало из https://github.com/mozilla/pjs.git
Bug 389251 ��� Cannot dismiss alarm on single overridden instance of recurring item; r=philipp
This commit is contained in:
Родитель
57ca0c3e34
Коммит
31e3ffdad5
|
@ -168,7 +168,7 @@ interface calIItemBase : nsISupports
|
|||
*/
|
||||
const unsigned long ALARM_RELATED_END = 1;
|
||||
|
||||
// The last time this alarm was fired and acknowledged by the user
|
||||
// The last time this alarm was fired and acknowledged by the user; coerced to UTC.
|
||||
attribute calIDateTime alarmLastAck;
|
||||
|
||||
//
|
||||
|
|
|
@ -504,12 +504,6 @@ calAlarmService.prototype = {
|
|||
},
|
||||
|
||||
removeAlarm: function cas_removeAlarm(aItem) {
|
||||
// If the item has no alarm start date, then it was never added so don't
|
||||
// remove it.
|
||||
if (!this.getAlarmDate(aItem)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// make sure already fired alarms are purged out of the alarm window:
|
||||
this.notifyObservers("onRemoveAlarmsByItem", [aItem]);
|
||||
for each (var timer in this.removeTimers(aItem)) {
|
||||
|
|
|
@ -133,7 +133,7 @@ calEvent.prototype = {
|
|||
{ cal: "DTEND", ics: "endTime" }],
|
||||
|
||||
set icalString(value) {
|
||||
this.icalComponent = icalFromString(value);
|
||||
this.icalComponent = getIcsService().parseICS(value, null);
|
||||
},
|
||||
|
||||
get icalString() {
|
||||
|
|
|
@ -173,9 +173,9 @@ calItemBase.prototype = {
|
|||
|
||||
if (this.alarmOffset) {
|
||||
this.alarmOffset.makeImmutable();
|
||||
if (this.alarmLastAck) {
|
||||
this.alarmLastAck.makeImmutable();
|
||||
}
|
||||
}
|
||||
if (this.alarmLastAck) {
|
||||
this.alarmLastAck.makeImmutable();
|
||||
}
|
||||
|
||||
this.ensureNotDirty();
|
||||
|
@ -269,14 +269,14 @@ calItemBase.prototype = {
|
|||
// Clone any alarm info that exists, set it to null if it doesn't
|
||||
if (this.alarmOffset) {
|
||||
m.alarmOffset = this.alarmOffset.clone();
|
||||
if (this.alarmLastAck) {
|
||||
m.alarmLastAck = this.alarmLastAck.clone();
|
||||
} else {
|
||||
m.alarmLastAck = null;
|
||||
}
|
||||
} else {
|
||||
m.alarmOffset = null;
|
||||
}
|
||||
if (this.alarmLastAck) {
|
||||
m.alarmLastAck = this.alarmLastAck.clone();
|
||||
} else {
|
||||
m.alarmLastAck = null;
|
||||
}
|
||||
m.alarmRelated = this.alarmRelated;
|
||||
|
||||
return m;
|
||||
|
@ -295,6 +295,19 @@ calItemBase.prototype = {
|
|||
return (this.mAlarmOffset = aValue);
|
||||
},
|
||||
|
||||
mAlarmLastAck: null,
|
||||
get alarmLastAck cib_get_alarmLastAck() {
|
||||
return this.mAlarmLastAck;
|
||||
},
|
||||
|
||||
set alarmLastAck cib_set_alarmLastAck(aValue) {
|
||||
this.modify();
|
||||
if (aValue && !aValue.timezone.isUTC) {
|
||||
aValue = aValue.getInTimezone(UTC());
|
||||
}
|
||||
return (this.mAlarmLastAck = aValue);
|
||||
},
|
||||
|
||||
get lastModifiedTime() {
|
||||
this.ensureNotDirty();
|
||||
return this.getProperty("LAST-MODIFIED");
|
||||
|
@ -625,18 +638,17 @@ calItemBase.prototype = {
|
|||
else
|
||||
this.alarmRelated = Components.interfaces.calIItemBase.ALARM_RELATED_START;
|
||||
|
||||
var lastAck = alarmComp.getFirstProperty("X-MOZ-LASTACK");
|
||||
if (lastAck) {
|
||||
var lastAckTime = Components.classes["@mozilla.org/calendar/datetime;1"]
|
||||
.createInstance(Components.interfaces.calIDateTime);
|
||||
lastAckTime.icalString = lastAck.valueAsIcalString;
|
||||
this.alarmLastAck = lastAckTime;
|
||||
}
|
||||
|
||||
var email = alarmComp.getFirstProperty("X-EMAILADDRESS");
|
||||
if (email)
|
||||
this.setProperty("alarmEmailAddress", email.value);
|
||||
}
|
||||
|
||||
var lastAck = icalcomp.getFirstProperty("X-MOZ-LASTACK");
|
||||
if (lastAck) {
|
||||
var lastAckTime = createDateTime();
|
||||
lastAckTime.icalString = lastAck.value;
|
||||
this.alarmLastAck = lastAckTime;
|
||||
}
|
||||
},
|
||||
|
||||
importUnpromotedProperties: function (icalcomp, promoted) {
|
||||
|
@ -715,12 +727,6 @@ calItemBase.prototype = {
|
|||
|
||||
alarmComp.addProperty(triggerProp);
|
||||
|
||||
if (this.alarmLastAck) {
|
||||
var lastAck = icssvc.createIcalProperty("X-MOZ-LASTACK");
|
||||
lastAck.valueAsIcalString = this.alarmLastAck.icalString;
|
||||
alarmComp.addProperty(lastAck);
|
||||
}
|
||||
|
||||
// We don't use this, but the ics-spec requires it
|
||||
var descProp = icssvc.createIcalProperty("DESCRIPTION");
|
||||
descProp.value = "Mozilla Alarm: "+ this.title;
|
||||
|
@ -740,6 +746,13 @@ calItemBase.prototype = {
|
|||
|
||||
icalcomp.addSubcomponent(alarmComp);
|
||||
}
|
||||
|
||||
if (this.alarmLastAck) {
|
||||
var lastAck = getIcsService().createIcalProperty("X-MOZ-LASTACK");
|
||||
// - should we further ensure that those are UTC or rely on calAlarmService doing so?
|
||||
lastAck.value = this.alarmLastAck.icalString;
|
||||
icalcomp.addProperty(lastAck);
|
||||
}
|
||||
},
|
||||
|
||||
getOccurrencesBetween: function(aStartDate, aEndDate, aCount) {
|
||||
|
@ -777,17 +790,3 @@ function makeMemberAttr(ctor, varname, dflt, attr, asProperty)
|
|||
ctor.prototype.__defineGetter__(attr, getter);
|
||||
ctor.prototype.__defineSetter__(attr, setter);
|
||||
}
|
||||
|
||||
//
|
||||
// helper functions
|
||||
//
|
||||
|
||||
function icalFromString(str)
|
||||
{
|
||||
return getIcsService().parseICS(str, null);
|
||||
}
|
||||
|
||||
function icalProp(kind)
|
||||
{
|
||||
return getIcsService().createIcalProperty(kind);
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ calTodo.prototype = {
|
|||
{ cal: "COMPLETED", ics: "completedTime" }],
|
||||
|
||||
set icalString(value) {
|
||||
this.icalComponent = icalFromString(value);
|
||||
this.icalComponent = getIcsService().parseICS(value, null);
|
||||
},
|
||||
|
||||
get icalString() {
|
||||
|
|
|
@ -1535,10 +1535,10 @@ calStorageCalendar.prototype = {
|
|||
|
||||
item.alarmOffset = duration;
|
||||
item.alarmRelated = row.alarm_related;
|
||||
if (row.alarm_last_ack) {
|
||||
// alarm acks are always in utc
|
||||
item.alarmLastAck = newDateTime(row.alarm_last_ack, "UTC");
|
||||
}
|
||||
}
|
||||
if (row.alarm_last_ack) {
|
||||
// alarm acks are always in utc
|
||||
item.alarmLastAck = newDateTime(row.alarm_last_ack, "UTC");
|
||||
}
|
||||
|
||||
if (row.recurrence_id)
|
||||
|
@ -1998,9 +1998,9 @@ calStorageCalendar.prototype = {
|
|||
if (item.alarmOffset) {
|
||||
ip.alarm_offset = item.alarmOffset.inSeconds;
|
||||
ip.alarm_related = item.alarmRelated;
|
||||
if (item.alarmLastAck) {
|
||||
ip.alarm_last_ack = item.alarmLastAck.nativeTime;
|
||||
}
|
||||
}
|
||||
if (item.alarmLastAck) {
|
||||
ip.alarm_last_ack = item.alarmLastAck.nativeTime;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче