зеркало из 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"].
|
classes["@mozilla.org/calendar/ics-service;1"].
|
||||||
getService(Components.interfaces.calIICSService);
|
getService(Components.interfaces.calIICSService);
|
||||||
var calcomp = icssvc.createIcalComponent("VCALENDAR");
|
var calcomp = icssvc.createIcalComponent("VCALENDAR");
|
||||||
calcomp.prodid = "-//Mozilla Calendar//NONSGML Sunbird//EN";
|
calSetProdidVersion(calcomp);
|
||||||
calcomp.version = "2.0";
|
|
||||||
if (this.hasProperty("METHOD")) {
|
if (this.hasProperty("METHOD")) {
|
||||||
calcomp.method = this.getProperty("METHOD");
|
calcomp.method = this.getProperty("METHOD");
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,8 +102,7 @@ function is_getIcalComponent() {
|
||||||
icsSvc = Components.classes["@mozilla.org/calendar/ics-service;1"]
|
icsSvc = Components.classes["@mozilla.org/calendar/ics-service;1"]
|
||||||
.getService(Components.interfaces.calIICSService);
|
.getService(Components.interfaces.calIICSService);
|
||||||
var calComp = icsSvc.createIcalComponent("VCALENDAR");
|
var calComp = icsSvc.createIcalComponent("VCALENDAR");
|
||||||
calComp.version = "2.0";
|
calSetProdidVersion(calComp);
|
||||||
calComp.prodid = "-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN";
|
|
||||||
|
|
||||||
for each (var prop in this.mProperties) {
|
for each (var prop in this.mProperties) {
|
||||||
calComp.addProperty(prop);
|
calComp.addProperty(prop);
|
||||||
|
|
|
@ -182,8 +182,7 @@ calTodo.prototype = {
|
||||||
classes["@mozilla.org/calendar/ics-service;1"].
|
classes["@mozilla.org/calendar/ics-service;1"].
|
||||||
getService(Components.interfaces.calIICSService);
|
getService(Components.interfaces.calIICSService);
|
||||||
var calcomp = icssvc.createIcalComponent("VCALENDAR");
|
var calcomp = icssvc.createIcalComponent("VCALENDAR");
|
||||||
calcomp.prodid = "-//Mozilla Calendar//NONSGML Sunbird//EN";
|
calSetProdidVersion(calcomp);
|
||||||
calcomp.version = "2.0";
|
|
||||||
calcomp.addSubcomponent(this.icalComponent);
|
calcomp.addSubcomponent(this.icalComponent);
|
||||||
return calcomp.serializeToICS();
|
return calcomp.serializeToICS();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1334,3 +1334,21 @@ function sameDay(date1, date2) {
|
||||||
return false;
|
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"].
|
const icssvc = Components.classes["@mozilla.org/calendar/ics-service;1"].
|
||||||
getService(Components.interfaces.calIICSService);
|
getService(Components.interfaces.calIICSService);
|
||||||
var modifiedItem = icssvc.createIcalComponent("VCALENDAR");
|
var modifiedItem = icssvc.createIcalComponent("VCALENDAR");
|
||||||
modifiedItem.prodid = "-//Mozilla Calendar//NONSGML Sunbird//EN";
|
calSetProdidVersion(modifiedItem);
|
||||||
modifiedItem.version = "2.0";
|
|
||||||
modifiedItem.addSubcomponent(aNewItem.icalComponent);
|
modifiedItem.addSubcomponent(aNewItem.icalComponent);
|
||||||
if (aNewItem.recurrenceInfo) {
|
if (aNewItem.recurrenceInfo) {
|
||||||
var exceptions = aNewItem.recurrenceInfo.getExceptionIds({});
|
var exceptions = aNewItem.recurrenceInfo.getExceptionIds({});
|
||||||
|
|
|
@ -122,8 +122,7 @@ function copyToClipboard( calendarItemArray )
|
||||||
var icssrv = Components.classes["@mozilla.org/calendar/ics-service;1"]
|
var icssrv = Components.classes["@mozilla.org/calendar/ics-service;1"]
|
||||||
.getService(Components.interfaces.calIICSService);
|
.getService(Components.interfaces.calIICSService);
|
||||||
var calComp = icssrv.createIcalComponent("VCALENDAR");
|
var calComp = icssrv.createIcalComponent("VCALENDAR");
|
||||||
calComp.version = "2.0";
|
calSetProdidVersion(calComp);
|
||||||
calComp.prodid = "-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN";
|
|
||||||
|
|
||||||
for each (item in calendarItemArray) {
|
for each (item in calendarItemArray) {
|
||||||
// If we copy an item and paste it again, it will have the same ID as
|
// If we copy an item and paste it again, it will have the same ID as
|
||||||
|
|
Загрузка…
Ссылка в новой задаче