bug 322831 - preserves extra parameters in properties using a js object. patch by jminta, r1=lilmatt, r2=dmose

This commit is contained in:
mattwillis%gmail.com 2006-08-31 13:07:47 +00:00
Родитель a2612ad88b
Коммит 510a19b3fa
4 изменённых файлов: 38 добавлений и 1 удалений

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

@ -215,6 +215,16 @@ interface calIItemBase : nsISupports
// top-level attribute (e.g. id or title)
boolean isPropertyPromoted(in AString name);
/**
* Returns a particular parameter value for a property, or null if the
* parameter does not exist. If the property does not exist, throws.
*
* @param aPropertyName the name of the property
* @param aParameterName the name of the parameter on the property
*/
AString getPropertyParameter(in AString aPropertyName,
in AString aParameterName);
/**
* The organizer (originator) of the item. We will likely not
* honour or preserve all fields in the calIAttendee passed around here.

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

@ -182,6 +182,13 @@ calEvent.prototype = {
if (!this.eventPromotedProps[iprop.name]) {
var icalprop = icssvc.createIcalProperty(iprop.name);
icalprop.value = iprop.value;
var propBucket = this.mPropertyParams[iprop.name];
if (propBucket) {
for (paramName in propBucket) {
icalprop.setParameter(paramName,
propBucket[paramName]);
}
}
icalcomp.addProperty(icalprop);
}
} catch (e) {

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

@ -55,9 +55,11 @@ function NewCalDateTime(aJSDate) {
}
function calItemBase() {
this.mPropertyParams = {};
}
calItemBase.prototype = {
mPropertyParams: null,
mIsProxy: false,
QueryInterface: function (aIID) {
@ -386,6 +388,10 @@ calItemBase.prototype = {
} catch (e) { }
},
getPropertyParameter: function getPP(aPropName, aParamName) {
return this.mPropertyParams[aPropName][aParamName];
},
getAttendees: function (countObj) {
if (!this.mAttendees && this.mIsProxy && this.mParentItem) {
this.mAttendees = this.mParentItem.getAttendees(countObj);
@ -616,8 +622,15 @@ calItemBase.prototype = {
prop;
prop = icalcomp.getNextProperty("ANY")) {
if (!promoted[prop.propertyName]) {
// XXX keep parameters around, sigh
this.setProperty(prop.propertyName, prop.value);
var param = prop.getFirstParameterName();
while (param) {
if (!(prop.propertyName in this.mPropertyParams)) {
this.mPropertyParams[prop.propertyName] = {};
}
this.mPropertyParams[prop.propertyName][param] = prop.getParameter(param);
param = prop.getNextParameterName();
}
}
}
},

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

@ -207,6 +207,13 @@ calTodo.prototype = {
if (!this.todoPromotedProps[iprop.name]) {
var icalprop = icssvc.createIcalProperty(iprop.name);
icalprop.value = iprop.value;
var propBucket = this.mPropertyParams[iprop.name]
if (propBucket) {
for (paramName in propBucket) {
icalprop.setParameter(paramName,
propBucket[paramName]);
}
}
icalcomp.addProperty(icalprop);
}
} catch (e) {