Skip to content

Commit

Permalink
[#40] Adjusted code to current TB requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
mbalbus committed Oct 24, 2021
1 parent 3c3e1a9 commit abbe37a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 40 deletions.
6 changes: 0 additions & 6 deletions src/legacy/modules/bindings/libical.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,10 @@ const libical = {
},

exposeFuntions: function() {
Object
.getOwnPropertyNames(this.lib)
.forEach(name => this.LOG(`Got variable ${name}`));

Object
.getOwnPropertyNames(this.lib)
.filter(name => (name !== "constructor" && !this[name]))
// .filter(name => name !== "init")
.forEach(name => {
this.LOG(`Exposing function ${name}`);
this[name] = this.lib[name];
});
},
Expand Down
31 changes: 15 additions & 16 deletions src/legacy/modules/calEdsProvider.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,22 @@ const calEdsProviderInterfaces = [
Components.interfaces.calICalendar,
Components.interfaces.calICompositeCalendar
];

class CalEdsProvider extends cal.provider.BaseClass {
QueryInterface = ChromeUtils.generateQI(calEdsProviderInterfaces);
constructor() {
super();

mBatchCalendar = null;
mBatchClient = null;
this.QueryInterface = ChromeUtils.generateQI(calEdsProviderInterfaces);
this.mBatchCalendar = null;
this.mBatchClient = null;

registry = null;
this.registry = null;

// calICompositeCalendar
this.defaultCalendar = null;
this.prefPrefix = null;
this.statusDisplayed = false;

constructor() {
super();
this.initProviderBase();
addLogger(this, "calEDSProvider");
glib.init();
Expand Down Expand Up @@ -951,17 +957,10 @@ class CalEdsProvider extends cal.provider.BaseClass {
}

// calICompositeCalendar
defaultCalendar = null;
// calICompositeCalendar
prefPrefix = null;

statusDisplayed = false;

// calICompositeCalendar
setStatusObserver = function(/* calIStatusObserver */ aStatusObserver, /* nsIDOMChromeWindow */ aWindow) {
setStatusObserver(/* calIStatusObserver */ aStatusObserver, /* nsIDOMChromeWindow */ aWindow) {
// FIXME implement
throw NS_ERROR_NOT_IMPLEMENTED;
};
}

shutdown() {
this.LOG("Closing EDS Calendar Service");
Expand All @@ -976,4 +975,4 @@ class CalEdsProvider extends cal.provider.BaseClass {
}
}

this.calEdsProvider = new CalEdsProvider();
const calEdsProvider = new CalEdsProvider();
33 changes: 16 additions & 17 deletions src/legacy/modules/edsCalendarClient.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ const { calEdsProvider } = ChromeUtils.import("resource://edscalendar/legacy/mod
const EXPORTED_SYMBOLS = ["edsCalendarClient"];


class EdsCalendarClient {
calendar = null;
const edsCalendarClient = {

calendar: null,

async startEdsCalendarSync() {
addLogger(this, "edsCalendarClient");
Expand All @@ -54,27 +55,27 @@ class EdsCalendarClient {
.then(edsCalendarClient.initCompositeCalendar)
.then(edsCalendarClient.attachCalendarObservers)
.then(() => edsCalendarClient.LOG("Init finished"));
}
},

initCompositeCalendar() {
if (edsCalendarClient.calendar === null) {
edsCalendarClient.calendar = cal.view.getCompositeCalendar(cal.window.getCalendarWindow());
edsCalendarClient.LOG("Got composite calendar");
}
}
},

attachCalendarObservers() {
if (edsCalendarClient.calendar) {
edsCalendarClient.calendar.removeObserver(edsCalendarClient.calendarObserver);
edsCalendarClient.calendar.addObserver(edsCalendarClient.calendarObserver);
edsCalendarClient.LOG("Added observers");
}
}
},

// get all the items from all calendars and add them to EDS
processCalendars(calendar) {
calendar.getItems(Components.interfaces.calICalendar.ITEM_FILTER_ALL_ITEMS, 0, null, null, edsCalendarClient.calendarGetListener);
}
},


async attachDebuggerIfNeeded() {
Expand All @@ -86,7 +87,7 @@ class EdsCalendarClient {
resolve();
}, 30_000));
}
}
},

operationTypeToString(operationType) {
let result;
Expand All @@ -108,7 +109,7 @@ class EdsCalendarClient {
break;
}
return result;
}
},

shutdown() {
if (this.asyncHelper) {
Expand All @@ -121,10 +122,10 @@ class EdsCalendarClient {
this.edsCalendarService.shutdown();
}
this.LOG("Eds Calendar client is shutdown");
}
},

// calIOperationListener
calendarGetListener = {
calendarGetListener: {

onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) {
if (!Components.isSuccessCode(aStatus)) {
Expand Down Expand Up @@ -159,9 +160,9 @@ class EdsCalendarClient {
}
edsCalendarClient.asyncHelper.asyncLoop(aItemscalendar, processItem);
}
};
},

calendarChangeListener = {
calendarChangeListener: {
onOperationComplete: function(aCalendar, aStatus, aOperationType, aId, aDetail) {
if (!Components.isSuccessCode(aStatus)) {
edsCalendarClient.ERROR("Operation " + edsCalendarClient.operationTypeToString(aOperationType) +
Expand All @@ -182,9 +183,9 @@ class EdsCalendarClient {
onGetResult: function(aCalendar, aStatus, aItemType, aDetail, aCount, aItemscalendar) {
throw "Unexpected operation";
}
};
},

calendarObserver = {
calendarObserver: {
QueryInterface: ChromeUtils.generateQI([
Components.interfaces.calIObserver,
Components.interfaces.calICompositeObserver
Expand Down Expand Up @@ -246,6 +247,4 @@ class EdsCalendarClient {
// calIObserver
onLoad: function(aCalendar) { }
}
}

this.edsCalendarClient = new EdsCalendarClient();
};
3 changes: 2 additions & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"applications": {
"gecko": {
"id": "{e6696d02-466a-11e3-a162-04e36188709b}",
"strict_min_version": "78.0"
"strict_min_version": "78.0",
"strict_max_version": "91.*"
}
},
"name": "EDS Calendar Integration",
Expand Down

0 comments on commit abbe37a

Please sign in to comment.