diff --git a/calendar/base/src/calItemBase.js.pre b/calendar/base/src/calItemBase.js.pre index 453684193a84..0f43288ff198 100644 --- a/calendar/base/src/calItemBase.js.pre +++ b/calendar/base/src/calItemBase.js.pre @@ -76,11 +76,13 @@ calItemBase.prototype = { this.mCreationDate = createCalDateTime(); this.mAlarmTime = createCalDateTime(); + this.mProperties = Components.classes["@mozilla.org/hash-property-bag;1"]. + createInstance(Components.interfaces.nsIWritablePropertyBag); + // fix me this.mRecurrenceInfo = null; this.mAttachments = null; this.mContacts = null; - this.mProperties = null; }, // for subclasses to use; copies the ItemBase's values @@ -141,6 +143,9 @@ calItemBase.prototype = { function calItemOccurrence () { this.wrappedJSObject = this; + + this.occurrenceStartDate = createCalDateTime(); + this.occurrenceEndDate = createCalDateTime(); } calItemOccurrence.prototype = { diff --git a/calendar/base/src/calItemModule.js b/calendar/base/src/calItemModule.js index 8e036f2bbded..cef230d1725a 100644 --- a/calendar/base/src/calItemModule.js +++ b/calendar/base/src/calItemModule.js @@ -44,6 +44,9 @@ var calItemModule = { mTodoCID: Components.ID("{7af51168-6abe-4a31-984d-6f8a3989212d}"), mTodoContractId: "@mozilla.org/calendar/todo;1", + mItemOccurrenceCID: Components.ID("{bad672b3-30b8-4ecd-8075-7153313d1f2c}"), + mItemOccurrenceContractId: "@mozilla.org/calendar/item-occurrence;1", + mScriptsLoaded: false, loadScripts: function () { if (this.mScriptsLoaded) @@ -80,8 +83,8 @@ var calItemModule = { registerSelf: function (compMgr, fileSpec, location, type) { compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); - var cids = [ this.mEventCID, this.mTodoCID ]; - var contractids = [ this.mEventContractId, this.mTodoContractId ]; + var cids = [ this.mEventCID, this.mTodoCID, this.mItemOccurrenceCID ]; + var contractids = [ this.mEventContractId, this.mTodoContractId, this.mItemOccurrenceContractId ]; for (var i = 0; i < cids.length; i++) { dump ("calItemModule: registering " + contractids[i] + "\n"); @@ -107,6 +110,9 @@ var calItemModule = { if (cid.equals(this.mTodoCID)) return this.mTodoFactory; + if (cid.equals(this.mItemOccurrenceCID)) + return this.mItemOccurrenceFactory; + throw Components.results.NS_ERROR_NO_INTERFACE; }, @@ -140,6 +146,21 @@ var calItemModule = { } }, + mItemOccurrenceFactory: { + QueryInterface: function (aIID) { + if (!aIID.equals(Components.interfaces.nsISupports) && + !aIID.equals(Components.interfaces.nsIFactory)) + throw Components.results.NS_ERROR_NO_INTERFACE; + return this; + }, + + createInstance: function (outer, iid) { + if (outer != null) + throw Components.results.NS_ERROR_NO_AGGREGATION; + return (new calItemOccurrence()).QueryInterface(iid); + } + }, + canUnload: function(compMgr) { return true; }