From abbe37a9ac15eab45855f4f4bf93f154b01d2b66 Mon Sep 17 00:00:00 2001 From: balbusm Date: Mon, 25 Oct 2021 00:58:17 +0200 Subject: [PATCH] [#40] Adjusted code to current TB requirements --- src/legacy/modules/bindings/libical.jsm | 6 ----- src/legacy/modules/calEdsProvider.jsm | 31 +++++++++++----------- src/legacy/modules/edsCalendarClient.jsm | 33 ++++++++++++------------ src/manifest.json | 3 ++- 4 files changed, 33 insertions(+), 40 deletions(-) diff --git a/src/legacy/modules/bindings/libical.jsm b/src/legacy/modules/bindings/libical.jsm index c2ee800..2138968 100644 --- a/src/legacy/modules/bindings/libical.jsm +++ b/src/legacy/modules/bindings/libical.jsm @@ -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]; }); }, diff --git a/src/legacy/modules/calEdsProvider.jsm b/src/legacy/modules/calEdsProvider.jsm index 5b50b8b..9751701 100644 --- a/src/legacy/modules/calEdsProvider.jsm +++ b/src/legacy/modules/calEdsProvider.jsm @@ -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(); @@ -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"); @@ -976,4 +975,4 @@ class CalEdsProvider extends cal.provider.BaseClass { } } -this.calEdsProvider = new CalEdsProvider(); +const calEdsProvider = new CalEdsProvider(); diff --git a/src/legacy/modules/edsCalendarClient.jsm b/src/legacy/modules/edsCalendarClient.jsm index ee5fab6..5f37920 100644 --- a/src/legacy/modules/edsCalendarClient.jsm +++ b/src/legacy/modules/edsCalendarClient.jsm @@ -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"); @@ -54,14 +55,14 @@ 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) { @@ -69,12 +70,12 @@ class EdsCalendarClient { 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() { @@ -86,7 +87,7 @@ class EdsCalendarClient { resolve(); }, 30_000)); } - } + }, operationTypeToString(operationType) { let result; @@ -108,7 +109,7 @@ class EdsCalendarClient { break; } return result; - } + }, shutdown() { if (this.asyncHelper) { @@ -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)) { @@ -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) + @@ -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 @@ -246,6 +247,4 @@ class EdsCalendarClient { // calIObserver onLoad: function(aCalendar) { } } -} - -this.edsCalendarClient = new EdsCalendarClient(); +}; diff --git a/src/manifest.json b/src/manifest.json index b022f85..2c4904d 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -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",