From ecdd67f954d4420dd357fb4ff0a353fbac32ad82 Mon Sep 17 00:00:00 2001 From: "mvl%exedo.nl" Date: Wed, 15 Dec 2004 16:22:01 +0000 Subject: [PATCH] make calIItemBase.icalComponent read/write bug 274645, r=shaver git-svn-id: svn://10.0.0.236/trunk@166749 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/calendar/base/public/calIItemBase.idl | 2 +- mozilla/calendar/base/src/calEvent.js | 45 ++++++++++--------- mozilla/calendar/base/src/calEvent.js.pre | 45 ++++++++++--------- 3 files changed, 49 insertions(+), 43 deletions(-) diff --git a/mozilla/calendar/base/public/calIItemBase.idl b/mozilla/calendar/base/public/calIItemBase.idl index c2f636aabbc..2030deda0af 100644 --- a/mozilla/calendar/base/public/calIItemBase.idl +++ b/mozilla/calendar/base/public/calIItemBase.idl @@ -116,7 +116,7 @@ interface calIItemBase : nsISupports // an icalComponent for this item, suitable for serialization. // the icalComponent returned is not live: changes in it or this // item will not be reflected in the other. - readonly attribute calIIcalComponent icalComponent; + attribute calIIcalComponent icalComponent; // // alarms diff --git a/mozilla/calendar/base/src/calEvent.js b/mozilla/calendar/base/src/calEvent.js index 768108ceb48..f0f00c1d9ce 100644 --- a/mozilla/calendar/base/src/calEvent.js +++ b/mozilla/calendar/base/src/calEvent.js @@ -67,27 +67,7 @@ calEvent.prototype = { { cal: "mStampDate", ics: "stampTime" } ], set icalString(value) { - if (this.mImmutable) - throw Components.results.NS_ERROR_FAILURE; - var event = icalFromString(value); - if (event.componentType != "VEVENT"); { - event = event.getFirstSubcomponent("VEVENT"); - if (!event) - - throw Components.results.NS_ERROR_INVALID_ARG; - } - - this.setItemBaseFromICS(event); - this.mapPropsFromICS(event, this.icsEventPropMap); - this.mIsAllDay = this.mStartDate && this.mStartDate.isDate; - - var promotedProps = { - "DTSTART": true, - "DTEND": true, - "DTSTAMP": true, - __proto__: this.itemBasePromotedProps - }; - this.importUnpromotedProperties(event, promotedProps); + this.icalComponent = icalFromString(value); }, get icalString() { @@ -123,4 +103,27 @@ calEvent.prototype = { } return icalcomp; }, + + set icalComponent(event) { + if (this.mImmutable) + throw Components.results.NS_ERROR_FAILURE; + if (event.componentType != "VEVENT"); { + event = event.getFirstSubcomponent("VEVENT"); + if (!event) + + throw Components.results.NS_ERROR_INVALID_ARG; + } + + this.setItemBaseFromICS(event); + this.mapPropsFromICS(event, this.icsEventPropMap); + this.mIsAllDay = this.mStartDate && this.mStartDate.isDate; + + var promotedProps = { + "DTSTART": true, + "DTEND": true, + "DTSTAMP": true, + __proto__: this.itemBasePromotedProps + }; + this.importUnpromotedProperties(event, promotedProps); + } }; diff --git a/mozilla/calendar/base/src/calEvent.js.pre b/mozilla/calendar/base/src/calEvent.js.pre index ad3120f576d..f4f9510e2ff 100644 --- a/mozilla/calendar/base/src/calEvent.js.pre +++ b/mozilla/calendar/base/src/calEvent.js.pre @@ -112,27 +112,7 @@ calEvent.prototype = { { cal: "mStampDate", ics: "stampTime" } ], set icalString(value) { - if (this.mImmutable) - throw Components.results.NS_ERROR_FAILURE; - var event = icalFromString(value); - if (event.componentType != "VEVENT"); { - event = event.getFirstSubcomponent("VEVENT"); - if (!event) - // throw Components.results.NS_ERROR_CALENDAR_WRONG_COMPONENT_TYPE; - throw Components.results.NS_ERROR_INVALID_ARG; - } - - this.setItemBaseFromICS(event); - this.mapPropsFromICS(event, this.icsEventPropMap); - this.mIsAllDay = this.mStartDate && this.mStartDate.isDate; - - var promotedProps = { - "DTSTART": true, - "DTEND": true, - "DTSTAMP": true, - __proto__: this.itemBasePromotedProps - }; - this.importUnpromotedProperties(event, promotedProps); + this.icalComponent = icalFromString(value); }, get icalString() { @@ -168,4 +148,27 @@ calEvent.prototype = { } return icalcomp; }, + + set icalComponent(event) { + if (this.mImmutable) + throw Components.results.NS_ERROR_FAILURE; + if (event.componentType != "VEVENT"); { + event = event.getFirstSubcomponent("VEVENT"); + if (!event) + // throw Components.results.NS_ERROR_CALENDAR_WRONG_COMPONENT_TYPE; + throw Components.results.NS_ERROR_INVALID_ARG; + } + + this.setItemBaseFromICS(event); + this.mapPropsFromICS(event, this.icsEventPropMap); + this.mIsAllDay = this.mStartDate && this.mStartDate.isDate; + + var promotedProps = { + "DTSTART": true, + "DTEND": true, + "DTSTAMP": true, + __proto__: this.itemBasePromotedProps + }; + this.importUnpromotedProperties(event, promotedProps); + } };