Bug 361836 Calendar csv import/export does not include alarms r=lilmatt,mvl

This commit is contained in:
jminta%gmail.com 2006-12-21 04:39:05 +00:00
Родитель 878e848ad7
Коммит 2b852d37be
1 изменённых файлов: 18 добавлений и 27 удалений

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

@ -293,30 +293,8 @@ function csv_importFromStream(aStream, aCount) {
event.endDate = eDate;
if (alarmDate) {
var dif = sDate.subtractDate(alarmDate);
dump(dif+"\n");
/*
// XXX Port this once new alarm stuff lands
var len, units;
var minutes = Math.round( ( sDate - alarmDate ) / kDate_MillisecondsInMinute );
var hours = Math.round(minutes / 60 );
if (minutes != hours*60) {
len = minutes;
units = "minutes";
} else {
var days = Math.round(hours / 24);
if (hours != days * 24) {
len = hours;
units = "hours";
} else {
len = days;
units = "days";
}
}
calendarEvent.alarmLength = len;
calendarEvent.alarmUnits = units;
calendarEvent.setParameter( "ICAL_RELATED_PARAMETER", "ICAL_RELATED_START" );
*/
event.alarmOffset = sDate.subtractDate(alarmDate);
event.alarmRelated = Components.interfaces.calIItemBase.ALARM_RELATED_START;
}
if ("descriptionIndex" in args)
@ -442,9 +420,22 @@ function csv_exportToStream(aStream, aCount, aItems) {
line.push(dateString(item.endDate));
line.push(timeString(item.endDate));
line.push(item.startDate.isDate ? localeEn.valueTrue : localeEn.valueFalse);
line.push(""); //XXX add alarm support
line.push(""); //XXX add alarm support
line.push(""); //XXX add alarm support
if (item.alarmOffset) {
line.push(localeEn.valueTrue);
var fireTime;
if (item.alarmRelated == Components.interfaces.calIItemBase.ALARM_RELATED_START) {
fireTime = item.startDate.clone();
} else {
fireTime = item.endDate.clone();
}
fireTime.addDuration(item.alarmOffset);
line.push(dateString(fireTime));
line.push(timeString(fireTime));
} else {
line.push(localeEn.valueFalse);
line.push("");
line.push("");
}
line.push(item.getProperty("CATEGORIES"));
line.push(item.getProperty("DESCRIPTION"));
line.push(item.getProperty("LOCATION"));