Skip to content
Permalink
Browse files

Some fixes to allow extension to work with TB38/Lightning 4.0.2

  • Loading branch information...
moldybeats committed Sep 13, 2015
1 parent 4ef6075 commit 24b820e9ba5153f39d4bf6e198afe697ffe9196e
Showing with 32 additions and 56 deletions.
  1. +22 −43 components/calStormCows.js
  2. +3 −3 install.rdf
  3. +7 −10 modules/rtmclient.jsm
@@ -31,18 +31,14 @@ calStormCows.prototype = {
__proto__: cal.ProviderBase.prototype,

classID: Components.ID("{62227ad7-1b03-4ada-b640-8d794157cda3}"),
contractID: "@mozilla.org/calendar/calendar;1?type=stormcows",
classDescription: "StormCows",

getInterfaces: function getInterfaces(count) {
const ifaces = [Components.interfaces.calICalendarProvider,
Components.interfaces.calICalendar,
Components.interfaces.nsIClassInfo,
Components.interfaces.nsISupports];
count.value = ifaces.length;
return ifaces;
},

QueryInterface: XPCOMUtils.generateQI([Components.interfaces.calICalendar]),
classInfo: XPCOMUtils.generateCI({
classDescription: "StormCows",
contractID: "@mozilla.org/calendar/calendar;1?type=stormcows",
classID: Components.ID("{62227ad7-1b03-4ada-b640-8d794157cda3}"),
interfaces: [Components.interfaces.calICalendar]
}),

getHelperForLanguage: function getHelperForLanguage(language) {
return null;
},
@@ -116,39 +112,17 @@ calStormCows.prototype = {
this.getItems_callback(-1, items, aListener);
},

/*
* nsISupports
*/
QueryInterface: function (aIID) {
return cal.doQueryInterface(this, calStormCows.prototype, aIID, null, this);
},

/*
* calICalendarProvider interface
*/
get prefChromeOverlay() {
return null;
},

get displayName() {
return 'StormCows';
},

createCalendar: function cSC_createCal() {
throw NS_ERROR_NOT_IMPLEMENTED;
},

deleteCalendar: function cSC_deleteCal(cal, listener) {
throw NS_ERROR_NOT_IMPLEMENTED;
},

/*
* calICalendar interface
*/
get type() {
return "stormcows";
},

get providerID() {
return "{62227ad7-1b03-4ada-b640-8d794157cda3}";
},

get canRefresh() {
return true;
},
@@ -160,6 +134,15 @@ calStormCows.prototype = {
this.mUri = aUri;
},

get id() {
return this.mID;
},
set id(val) {
let setter = this.__proto__.__proto__.__lookupSetter__("id");
val = setter.call(this, val);
return val;
},

getProperty: function cSC_getProperty(aName) {
return this.__proto__.__proto__.getProperty.apply(this, arguments);
},
@@ -452,8 +435,4 @@ calStormCows.prototype = {
}
};


/** Module Registration */
function NSGetFactory(cid) {
return (XPCOMUtils.generateNSGetFactory([calStormCows]))(cid);
}
var NSGetFactory = XPCOMUtils.generateNSGetFactory([calStormCows]);
@@ -10,7 +10,7 @@
<em:id>{62227ad7-1b03-4ada-b640-8d794157cda3}</em:id>
<em:name>StormCows</em:name>
<em:description>Allows two-way access between Remember The Milk and calendar events or todo items.</em:description>
<em:version>0.3</em:version>
<em:version>0.4</em:version>
<em:creator>moldybeats</em:creator>
<em:type>2</em:type>

@@ -20,8 +20,8 @@
<Description>
<!-- Thunderbird -->
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>17.0</em:minVersion>
<em:maxVersion>17.*</em:maxVersion>
<em:minVersion>38.0</em:minVersion>
<em:maxVersion>38.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
@@ -661,19 +661,18 @@ let rtmClient = {

if (itemType == 'events') {
item = cal.createEvent();
let startDate = cal.createDateTime();
startDate.jsDate = new Date(due);
let startDate = cal.createDateTime(due);
let endDate = null;
let duration = cal.createDuration();
if (tasks[k].has_due_time == '0') {
startDate.isDate = true;
startDate = startDate.getInTimezone(tzService.defaultTimezone);
startDate = startDate.getInTimezone(cal.calendarDefaultTimezone());
endDate = startDate.clone();
duration.days = 1;
endDate.addDuration(duration);
} else {
startDate.isDate = false;
startDate = startDate.getInTimezone(tzService.defaultTimezone);
startDate = startDate.getInTimezone(cal.calendarDefaultTimezone());
endDate = startDate.clone();
duration.hours = 1;
endDate.addDuration(duration);
@@ -687,14 +686,13 @@ let rtmClient = {
if (!due) {
item.dueDate = null;
} else {
let dueDate = cal.createDateTime();
dueDate.jsDate = new Date(due);
let dueDate = cal.createDateTime(due);
if (tasks[k].has_due_time == '0') {
dueDate.isDate = true;
} else {
dueDate.isDate = false;
}
dueDate = dueDate.getInTimezone(tzService.defaultTimezone);
dueDate = dueDate.getInTimezone(cal.calendarDefaultTimezone());

item.dueDate = dueDate;
}
@@ -705,9 +703,8 @@ let rtmClient = {
item.percentComplete = 0;
item.isCompleted = false;
} else {
let completedDate = cal.createDateTime();
completedDate.jsDate = new Date(completed);
completedDate = completedDate.getInTimezone(tzService.defaultTimezone);
let completedDate = cal.createDateTime(completed);
completedDate = completedDate.getInTimezone(cal.calendarDefaultTimezone());
completedDate.isDate = false;
item.completedDate = completedDate;
item.percentComplete = 100;

0 comments on commit 24b820e

Please sign in to comment.
You can’t perform that action at this time.