diff --git a/calendar/experiments/calendar/ext-calendar-utils.sys.mjs b/calendar/experiments/calendar/ext-calendar-utils.sys.mjs index 4b0bb34..ed5fbdd 100644 --- a/calendar/experiments/calendar/ext-calendar-utils.sys.mjs +++ b/calendar/experiments/calendar/ext-calendar-utils.sys.mjs @@ -63,6 +63,8 @@ export function convertCalendar(extension, calendar) { name: calendar.name, url: calendar.uri.spec, readOnly: calendar.readOnly, + visible: !!calendar.getProperty("calendar-main-in-composite"), + showReminders: !calendar.getProperty("suppressAlarms"), enabled: !calendar.getProperty("disabled"), color: calendar.getProperty("color") || "#A8C2E1", }; diff --git a/calendar/experiments/calendar/parent/ext-calendar-calendars.js b/calendar/experiments/calendar/parent/ext-calendar-calendars.js index c361a40..440c028 100644 --- a/calendar/experiments/calendar/parent/ext-calendar-calendars.js +++ b/calendar/experiments/calendar/parent/ext-calendar-calendars.js @@ -19,7 +19,7 @@ this.calendar_calendars = class extends ExtensionAPI { return { calendar: { calendars: { - async query({ type, url, name, color, readOnly, enabled }) { + async query({ type, url, name, color, readOnly, enabled, visible }) { let calendars = cal.manager.getCalendars(); let pattern = null; @@ -56,6 +56,10 @@ this.calendar_calendars = class extends ExtensionAPI { matches = false; } + if (visible != null & calendar.getProperty("calendar-main-in-composite") != visible) { + matches = false; + } + if (readOnly != null && calendar.readOnly != readOnly) { matches = false; } @@ -87,6 +91,12 @@ this.calendar_calendars = class extends ExtensionAPI { if (typeof createProperties.color != "undefined") { calendar.setProperty("color", createProperties.color); } + if (typeof createProperties.visible != "undefined") { + calendar.setProperty("calendar-main-in-composite", createProperties.visible); + } + if (typeof createProperties.showReminders != "undefined") { + calendar.setProperty("suppressAlarms", !createProperties.showReminders); + } cal.manager.registerCalendar(calendar); @@ -114,6 +124,14 @@ this.calendar_calendars = class extends ExtensionAPI { calendar.setProperty("disabled", !updateProperties.enabled); } + if (updateProperties.visible != null) { + calendar.setProperty("calendar-main-in-composite", updateProperties.visible); + } + + if (updateProperties.showReminders != null) { + calendar.setProperty("suppressAlarms", !updateProperties.showReminders); + } + for (let prop of ["readOnly", "name", "color"]) { if (updateProperties[prop] != null) { calendar.setProperty(prop, updateProperties[prop]); @@ -237,6 +255,12 @@ this.calendar_calendars = class extends ExtensionAPI { case "uri": fire.sync(converted, { url: value?.spec }); break; + case "suppressAlarms": + fire.sync(converted, { showReminders: !value }); + break; + case "calendar-main-in-composite": + fire.sync(converted, { visible: value }); + break; case "disabled": fire.sync(converted, { enabled: !value }); break; diff --git a/calendar/experiments/calendar/schema/calendar-calendars.json b/calendar/experiments/calendar/schema/calendar-calendars.json index 2c410b1..388fae5 100644 --- a/calendar/experiments/calendar/schema/calendar-calendars.json +++ b/calendar/experiments/calendar/schema/calendar-calendars.json @@ -13,6 +13,8 @@ "url": { "type": "string" }, "readOnly": { "type": "boolean" }, "enabled": { "type": "boolean" }, + "visible": { "type": "boolean" }, + "showReminders": { "type": "boolean" }, "color": { "type": "string", "optional": true }, "capabilities": { "$ref": "CalendarCapabilities", "optional": true } } @@ -25,6 +27,8 @@ "url": { "type": "string" }, "readOnly": { "type": "boolean" }, "enabled": { "type": "boolean" }, + "visible": { "type": "boolean" }, + "showReminders": { "type": "boolean" }, "color": { "type": "string", "optional": true } } }, @@ -104,6 +108,7 @@ "name": { "type": "string", "optional": true }, "color": { "type": "string", "optional": true }, "readOnly": { "type": "boolean", "optional": true }, + "visible": { "type": "boolean", "optional": true }, "enabled": { "type": "boolean", "optional": true } } } @@ -131,6 +136,8 @@ "url": { "type": "string" }, "readOnly": { "type": "boolean", "optional": true }, "enabled": { "type": "boolean", "optional": true }, + "visible": { "type": "boolean", "optional": true }, + "showReminders": { "type": "boolean", "optional": true }, "color": { "type": "string", "optional": true }, "capabilities": { "$ref": "CalendarCapabilities", "optional": true } }