зеркало из https://github.com/mozilla/pjs.git
continuing calItemBase/calEvent fixes. not part of the build.
This commit is contained in:
Родитель
90f11e6101
Коммит
e83783d4a5
|
@ -1,5 +1,7 @@
|
|||
function calEvent() {
|
||||
this.wrappedJSObject = this;
|
||||
this.initItemBase();
|
||||
this.initEvent();
|
||||
}
|
||||
|
||||
calEvent.prototype = {
|
||||
|
@ -10,13 +12,18 @@ calEvent.prototype = {
|
|||
!aIID.equals(Components.interfaces.calIItemBase) &&
|
||||
!aIID.equals(Components.interfaces.calIEvent))
|
||||
{
|
||||
dump ("calEvent QI failed to " + aIID + "\n");
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
initEvent: function () {
|
||||
this.mStartDate = createCalDateTime();
|
||||
this.mEndDate = createCalDateTime();
|
||||
this.mStampDate = createCalDateTime();
|
||||
},
|
||||
|
||||
clone: function () {
|
||||
var m = new calEvent();
|
||||
this.cloneItemBaseInto(m);
|
||||
|
|
|
@ -45,6 +45,8 @@
|
|||
//
|
||||
function calEvent() {
|
||||
this.wrappedJSObject = this;
|
||||
this.initItemBase();
|
||||
this.initEvent();
|
||||
}
|
||||
|
||||
calEvent.prototype = {
|
||||
|
@ -55,13 +57,18 @@ calEvent.prototype = {
|
|||
!aIID.equals(Components.interfaces.calIItemBase) &&
|
||||
!aIID.equals(Components.interfaces.calIEvent))
|
||||
{
|
||||
dump ("calEvent QI failed to " + aIID + "\n");
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
initEvent: function () {
|
||||
this.mStartDate = createCalDateTime();
|
||||
this.mEndDate = createCalDateTime();
|
||||
this.mStampDate = createCalDateTime();
|
||||
},
|
||||
|
||||
clone: function () {
|
||||
var m = new calEvent();
|
||||
this.cloneItemBaseInto(m);
|
||||
|
|
|
@ -30,6 +30,18 @@ calItemBase.prototype = {
|
|||
},
|
||||
|
||||
|
||||
initItemBase: function () {
|
||||
this.mCreationDate = createCalDateTime();
|
||||
this.mAlarmTime = createCalDateTime();
|
||||
|
||||
|
||||
this.mRecurrenceInfo = null;
|
||||
this.mAttachments = null;
|
||||
this.mContacts = null;
|
||||
this.mProperties = null;
|
||||
},
|
||||
|
||||
|
||||
|
||||
cloneItemBaseInto: function (m) {
|
||||
m.mImmutable = false;
|
||||
|
@ -107,3 +119,14 @@ calItemOccurrence.prototype = {
|
|||
next: null,
|
||||
previous: null
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function createCalDateTime() {
|
||||
const kCdtClass = Components.classes["@mozilla.org/calendar/datetime;1"];
|
||||
const kCdtInterface = Components.interfaces.calIDateTime;
|
||||
|
||||
return kCdtClass.createInstance(kCdtInterface);
|
||||
}
|
||||
|
|
|
@ -71,6 +71,18 @@ calItemBase.prototype = {
|
|||
this.mImmutable = true;
|
||||
},
|
||||
|
||||
// initialize this class's members
|
||||
initItemBase: function () {
|
||||
this.mCreationDate = createCalDateTime();
|
||||
this.mAlarmTime = createCalDateTime();
|
||||
|
||||
// fix me
|
||||
this.mRecurrenceInfo = null;
|
||||
this.mAttachments = null;
|
||||
this.mContacts = null;
|
||||
this.mProperties = null;
|
||||
},
|
||||
|
||||
// for subclasses to use; copies the ItemBase's values
|
||||
// into m
|
||||
cloneItemBaseInto: function (m) {
|
||||
|
@ -149,3 +161,14 @@ calItemOccurrence.prototype = {
|
|||
next: null,
|
||||
previous: null
|
||||
};
|
||||
|
||||
//
|
||||
// helper functions
|
||||
//
|
||||
|
||||
function createCalDateTime() {
|
||||
const kCdtClass = Components.classes["@mozilla.org/calendar/datetime;1"];
|
||||
const kCdtInterface = Components.interfaces.calIDateTime;
|
||||
|
||||
return kCdtClass.createInstance(kCdtInterface);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче