зеркало из https://github.com/mozilla/pjs.git
Bug 354574 Centralize definition and getters for PRODID and VERSION; r=dbo
This commit is contained in:
Родитель
75c716f209
Коммит
fc8d5d1b9d
|
@ -154,8 +154,7 @@ calEvent.prototype = {
|
|||
classes["@mozilla.org/calendar/ics-service;1"].
|
||||
getService(Components.interfaces.calIICSService);
|
||||
var calcomp = icssvc.createIcalComponent("VCALENDAR");
|
||||
calcomp.prodid = "-//Mozilla Calendar//NONSGML Sunbird//EN";
|
||||
calcomp.version = "2.0";
|
||||
calSetProdidVersion(calcomp);
|
||||
if (this.hasProperty("METHOD")) {
|
||||
calcomp.method = this.getProperty("METHOD");
|
||||
}
|
||||
|
|
|
@ -102,8 +102,7 @@ function is_getIcalComponent() {
|
|||
icsSvc = Components.classes["@mozilla.org/calendar/ics-service;1"]
|
||||
.getService(Components.interfaces.calIICSService);
|
||||
var calComp = icsSvc.createIcalComponent("VCALENDAR");
|
||||
calComp.version = "2.0";
|
||||
calComp.prodid = "-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN";
|
||||
calSetProdidVersion(calComp);
|
||||
|
||||
for each (var prop in this.mProperties) {
|
||||
calComp.addProperty(prop);
|
||||
|
|
|
@ -182,8 +182,7 @@ calTodo.prototype = {
|
|||
classes["@mozilla.org/calendar/ics-service;1"].
|
||||
getService(Components.interfaces.calIICSService);
|
||||
var calcomp = icssvc.createIcalComponent("VCALENDAR");
|
||||
calcomp.prodid = "-//Mozilla Calendar//NONSGML Sunbird//EN";
|
||||
calcomp.version = "2.0";
|
||||
calSetProdidVersion(calcomp);
|
||||
calcomp.addSubcomponent(this.icalComponent);
|
||||
return calcomp.serializeToICS();
|
||||
},
|
||||
|
|
|
@ -1334,3 +1334,21 @@ function sameDay(date1, date2) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a centralized function for setting the prodid and version on an
|
||||
* ical components. This should be used whenever you need to set the prodid
|
||||
* and version on a calIcalComponent object.
|
||||
*
|
||||
* @param
|
||||
* aIcalComponent The ical component to set the prodid and version on.
|
||||
*/
|
||||
function calSetProdidVersion(aIcalComponent) {
|
||||
|
||||
// Throw for an invalid parameter
|
||||
if (!aIcalComponent instanceof Components.interfaces.calIIcalComponent)
|
||||
throw Components.results.NS_ERROR_INVALID_ARG;
|
||||
|
||||
// Set the prodid and version
|
||||
aIcalComponent.prodid = "-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN";
|
||||
aIcalComponent.version = "2.0";
|
||||
}
|
||||
|
|
|
@ -605,8 +605,7 @@ calDavCalendar.prototype = {
|
|||
const icssvc = Components.classes["@mozilla.org/calendar/ics-service;1"].
|
||||
getService(Components.interfaces.calIICSService);
|
||||
var modifiedItem = icssvc.createIcalComponent("VCALENDAR");
|
||||
modifiedItem.prodid = "-//Mozilla Calendar//NONSGML Sunbird//EN";
|
||||
modifiedItem.version = "2.0";
|
||||
calSetProdidVersion(modifiedItem);
|
||||
modifiedItem.addSubcomponent(aNewItem.icalComponent);
|
||||
if (aNewItem.recurrenceInfo) {
|
||||
var exceptions = aNewItem.recurrenceInfo.getExceptionIds({});
|
||||
|
|
|
@ -122,8 +122,7 @@ function copyToClipboard( calendarItemArray )
|
|||
var icssrv = Components.classes["@mozilla.org/calendar/ics-service;1"]
|
||||
.getService(Components.interfaces.calIICSService);
|
||||
var calComp = icssrv.createIcalComponent("VCALENDAR");
|
||||
calComp.version = "2.0";
|
||||
calComp.prodid = "-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN";
|
||||
calSetProdidVersion(calComp);
|
||||
|
||||
for each (item in calendarItemArray) {
|
||||
// If we copy an item and paste it again, it will have the same ID as
|
||||
|
|
Загрузка…
Ссылка в новой задаче