summaryrefslogtreecommitdiffstats
path: root/comm/calendar/base/public
diff options
context:
space:
mode:
Diffstat (limited to 'comm/calendar/base/public')
-rw-r--r--comm/calendar/base/public/calIAlarm.idl157
-rw-r--r--comm/calendar/base/public/calIAlarmService.idl116
-rw-r--r--comm/calendar/base/public/calIAttachment.idl57
-rw-r--r--comm/calendar/base/public/calIAttendee.idl80
-rw-r--r--comm/calendar/base/public/calICalendar.idl605
-rw-r--r--comm/calendar/base/public/calICalendarACLManager.idl86
-rw-r--r--comm/calendar/base/public/calICalendarManager.idl139
-rw-r--r--comm/calendar/base/public/calICalendarProvider.idl89
-rw-r--r--comm/calendar/base/public/calICalendarView.idl216
-rw-r--r--comm/calendar/base/public/calICalendarViewController.idl75
-rw-r--r--comm/calendar/base/public/calIChangeLog.idl151
-rw-r--r--comm/calendar/base/public/calIDateTime.idl228
-rw-r--r--comm/calendar/base/public/calIDeletedItems.idl26
-rw-r--r--comm/calendar/base/public/calIDuration.idl104
-rw-r--r--comm/calendar/base/public/calIErrors.idl117
-rw-r--r--comm/calendar/base/public/calIEvent.idl42
-rw-r--r--comm/calendar/base/public/calIFreeBusyProvider.idl109
-rw-r--r--comm/calendar/base/public/calIICSService.idl242
-rw-r--r--comm/calendar/base/public/calIIcsParser.idl81
-rw-r--r--comm/calendar/base/public/calIIcsSerializer.idl73
-rw-r--r--comm/calendar/base/public/calIImportExport.idl56
-rw-r--r--comm/calendar/base/public/calIItemBase.idl372
-rw-r--r--comm/calendar/base/public/calIItipItem.idl112
-rw-r--r--comm/calendar/base/public/calIItipTransport.idl48
-rw-r--r--comm/calendar/base/public/calIOperation.idl46
-rw-r--r--comm/calendar/base/public/calIPeriod.idl58
-rw-r--r--comm/calendar/base/public/calIRecurrenceDate.idl24
-rw-r--r--comm/calendar/base/public/calIRecurrenceInfo.idl184
-rw-r--r--comm/calendar/base/public/calIRecurrenceItem.idl60
-rw-r--r--comm/calendar/base/public/calIRecurrenceRule.idl53
-rw-r--r--comm/calendar/base/public/calIRelation.idl45
-rw-r--r--comm/calendar/base/public/calISchedulingSupport.idl47
-rw-r--r--comm/calendar/base/public/calIStartupService.idl30
-rw-r--r--comm/calendar/base/public/calIStatusObserver.idl60
-rw-r--r--comm/calendar/base/public/calITimezone.idl43
-rw-r--r--comm/calendar/base/public/calITimezoneDatabase.idl37
-rw-r--r--comm/calendar/base/public/calITimezoneService.idl50
-rw-r--r--comm/calendar/base/public/calITodo.idl72
-rw-r--r--comm/calendar/base/public/calIWeekInfoService.idl50
-rw-r--r--comm/calendar/base/public/moz.build56
40 files changed, 4296 insertions, 0 deletions
diff --git a/comm/calendar/base/public/calIAlarm.idl b/comm/calendar/base/public/calIAlarm.idl
new file mode 100644
index 0000000000..4fe5f9c945
--- /dev/null
+++ b/comm/calendar/base/public/calIAlarm.idl
@@ -0,0 +1,157 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIVariant;
+
+interface calIAttachment;
+interface calIAttendee;
+interface calIDateTime;
+interface calIDuration;
+interface calIItemBase;
+interface calIIcalComponent;
+
+[scriptable, uuid(b8db7c7f-c168-4e11-becb-f26c1c4f5f8f)]
+interface calIAlarm : nsISupports
+{
+ /**
+ * Returns true if this alarm is able to be modified
+ */
+ readonly attribute boolean isMutable;
+
+ /**
+ * Makes this alarm immutable.
+ */
+ void makeImmutable();
+
+ /**
+ * Make a copy of this alarm. The returned alarm will be mutable.
+ */
+ calIAlarm clone();
+
+ /**
+ * How this alarm is shown. Special values as described in rfc2445 are
+ * AUDIO, DISPLAY, EMAIL
+ * In addition, custom actions may be defined as an X-Prop, i.e
+ * X-SMS.
+ *
+ * Note that aside from setting this action, the frontend must be able to
+ * handle the specified action. Unknown actions WILL NOT be notified for.
+ */
+ attribute AUTF8String action;
+
+ /**
+ * The offset between the item's date and the alarm time.
+ * This will be null for absolute alarms.
+ */
+ attribute calIDuration offset;
+
+ /**
+ * The absolute date and time the alarm should fire.
+ * This will be null for relative alarms.
+ */
+ attribute calIDateTime alarmDate;
+
+ /**
+ * One of the ALARM_RELATED constants below.
+ */
+ attribute unsigned long related;
+
+ /**
+ * The alarm is absolute and is therefore not related to either.
+ */
+ const unsigned long ALARM_RELATED_ABSOLUTE = 0;
+
+ /**
+ * The alarm's offset should be based off of the startDate or
+ * entryDate (for events and tasks, respectively)
+ */
+ const unsigned long ALARM_RELATED_START = 1;
+
+ /**
+ * the alarm's offset should be based off of the endDate or
+ * dueDate (for events and tasks, respectively)
+ */
+ const unsigned long ALARM_RELATED_END = 2;
+
+ /**
+ * Times the alarm should be repeated. This value is the number of
+ * ADDITIONAL alarms, aside from the actual alarm.
+ *
+ * For the alarm to be valid, if repeat is specified, the repeatOffset
+ * attribute MUST also be specified.
+ */
+ attribute unsigned long repeat;
+
+ /**
+ * The duration between the alarm and each subsequent repeat
+ *
+ * For the alarm to be valid, if repeatOffset is specified, the repeat
+ * attribute MUST also be specified.
+ */
+ attribute calIDuration repeatOffset;
+
+ /**
+ * If repeat is specified, this helper returns the first DATETIME the alarm
+ * should be repeated on.
+ * This will be null for relative alarms.
+ */
+ readonly attribute calIDateTime repeatDate;
+
+ /**
+ * The description of the alarm. Not valid for AUDIO alarms.
+ */
+ attribute AUTF8String description;
+
+ /**
+ * The summary of the alarm. Not valid for AUDIO and DISPLAY alarms.
+ */
+ attribute AUTF8String summary;
+
+ /**
+ * Manage Attendee for this alarm. Not valid for AUDIO and DISPLAY alarms.
+ */
+ void addAttendee(in calIAttendee aAttendee);
+ void deleteAttendee(in calIAttendee aAttendee);
+ void clearAttendees();
+ Array<calIAttendee> getAttendees();
+
+ /**
+ * Manage Attachments for this alarm.
+ * For EMAIL alarms, more than one attachment can be specified.
+ * For AUDIO alarms, one Attachment can be specified.
+ * For DISPLAY alarms, attachments are invalid.
+ */
+ void addAttachment(in calIAttachment aAttachment);
+ void deleteAttachment(in calIAttachment aAttachment);
+ void clearAttachments();
+ Array<calIAttachment> getAttachments();
+
+ /**
+ * The human readable representation of this alarm. Uses locale strings.
+ *
+ * @param aItem The item to base the string on. Defaults to an event.
+ */
+ AUTF8String toString([optional] in calIItemBase aItem);
+
+ /**
+ * The ical representation of this VALARM
+ */
+ attribute AUTF8String icalString;
+
+ /**
+ * The ical component of this VALARM
+ */
+ attribute calIIcalComponent icalComponent;
+
+ // Property bag
+ boolean hasProperty(in AUTF8String name);
+ nsIVariant getProperty(in AUTF8String name);
+ void setProperty(in AUTF8String name, in nsIVariant value);
+ void deleteProperty(in AUTF8String name);
+
+ // Each inner array has two elements: a string and a nsIVariant.
+ readonly attribute Array<Array<jsval> > properties;
+};
diff --git a/comm/calendar/base/public/calIAlarmService.idl b/comm/calendar/base/public/calIAlarmService.idl
new file mode 100644
index 0000000000..4af77628db
--- /dev/null
+++ b/comm/calendar/base/public/calIAlarmService.idl
@@ -0,0 +1,116 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIItemBase;
+interface calICalendar;
+interface calIDuration;
+interface calITimezone;
+interface calIAlarm;
+interface calIOperation;
+
+[scriptable,uuid(dc96dd04-d2dd-448e-b307-8c8ff39c72af)]
+interface calIAlarmServiceObserver : nsISupports
+{
+ /**
+ * Gets called when an alarm has fired. Depending on type of alarm, an
+ * observer could bring up a dialog or play a sound.
+ */
+ void onAlarm(in calIItemBase item, in calIAlarm alarm);
+
+ /**
+ * Gets called when an notification has fired. The notification is only
+ * controlled by prefs, and is independent from the alarm/reminder.
+ */
+ void onNotification(in calIItemBase item);
+
+ /**
+ * Called if alarm(s) of a specific item are to be removed from
+ * the alarm window.
+ *
+ * @param aItem corresponding item, maybe master item of recurring
+ * series (then all alarms belonging to this item are to
+ * be removed)
+ */
+ void onRemoveAlarmsByItem(in calIItemBase item);
+
+ /**
+ * Called if all alarms of a specific calendar are to be removed.
+ */
+ void onRemoveAlarmsByCalendar(in calICalendar calendar);
+
+ /**
+ * Called when all alarms of a specific calendar are loaded.
+ */
+ void onAlarmsLoaded(in calICalendar calendar);
+};
+
+[scriptable,uuid(42cfa9ce-49d6-11e5-b88c-5b90eedc1c47)]
+interface calIAlarmService : nsISupports
+{
+ /**
+ * Upper limit for the snooze period for an alarm. To avoid performance issues, don't change this
+ * to a value larger then 1 at least until bug 861594 or a similar concept is implemented.
+ */
+ const unsigned long MAX_SNOOZE_MONTHS = 1;
+
+ /**
+ * This is the timezone that all-day events will be converted to in order to
+ * determine when their alarms should fire.
+ */
+ attribute calITimezone timezone;
+
+ /**
+ * Will return true while the alarm service is in the process of loading alarms
+ */
+ attribute boolean isLoading;
+
+ /**
+ * Cause the alarm service to start up, create a list of upcoming
+ * alarms in all registered calendars, add observers to watch for
+ * calendar registration and unregistration, and setup a timer to
+ * maintain that list and fire alarms.
+ *
+ * @note Will throw NS_ERROR_NOT_INITIALIZED if you have not previously set
+ * the timezone attribute.
+ */
+ void startup();
+
+ /**
+ * Shuts down the alarm service, canceling all timers and removing all
+ * alarms.
+ */
+ void shutdown();
+
+ /* add and remove observers that will be notified when an
+ alarm has gone off. It is up to the application to display
+ the alarm.
+ */
+ void addObserver(in calIAlarmServiceObserver observer);
+ void removeObserver(in calIAlarmServiceObserver observer);
+
+ /**
+ * Call to reschedule an alarm to be notified at a later point. The alarm will
+ * instead fire at "now + duration" This will cause an event to be scheduled
+ * even if it was not previously scheduled.
+ *
+ * @param item The item the alarm belongs to.
+ * @param alarm The alarm to snooze.
+ * @param duration The duration in minutes to snooze for.
+ * @return The operation that modifies the item to snooze the
+ * alarm.
+ */
+ calIOperation snoozeAlarm(in calIItemBase item, in calIAlarm alarm, in calIDuration duration);
+
+ /**
+ * Dismisses the given alarm for the passed occurrence.
+ *
+ * @param item The item the alarm belongs to.
+ * @param alarm The alarm to dismiss.
+ * @return The operation that modifies the item to dismiss the
+ * alarm.
+ */
+ calIOperation dismissAlarm(in calIItemBase item, in calIAlarm alarm);
+};
diff --git a/comm/calendar/base/public/calIAttachment.idl b/comm/calendar/base/public/calIAttachment.idl
new file mode 100644
index 0000000000..7ca054d5a2
--- /dev/null
+++ b/comm/calendar/base/public/calIAttachment.idl
@@ -0,0 +1,57 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIURI;
+interface calIIcalProperty;
+interface calIItemBase;
+
+[scriptable,uuid(7a17d45d-1c0e-4877-baa3-0eb67e770498)]
+interface calIAttachment : nsISupports
+{
+ /**
+ * The hash id is used to identify this attachment and compare it to others.
+ */
+ readonly attribute AUTF8String hashId;
+
+ /**
+ * An nsIURI object that points to the file (local or remote)
+ */
+ attribute nsIURI uri;
+
+ /**
+ * Raw attachment data, in case its not an uri
+ */
+ attribute AUTF8String rawData;
+
+ /**
+ * The type of file that this attachment refers to
+ */
+ attribute AString formatType;
+
+ /**
+ * The encoding the (local) file should be encoded with.
+ */
+ attribute AUTF8String encoding;
+
+ /**
+ * The calIIcalProperty corresponding to this object. Can be used for
+ * serializing/unserializing from ics files.
+ */
+ attribute calIIcalProperty icalProperty;
+ attribute AUTF8String icalString;
+
+ /**
+ * For accessing additional parameters, such as x-params.
+ */
+ AUTF8String getParameter(in AString name);
+ void setParameter(in AString name, in AUTF8String value);
+ void deleteParameter(in AString name);
+
+ /**
+ * Clone this calIAttachment instance into a new object.
+ */
+ calIAttachment clone();
+};
diff --git a/comm/calendar/base/public/calIAttendee.idl b/comm/calendar/base/public/calIAttendee.idl
new file mode 100644
index 0000000000..ccbda1827e
--- /dev/null
+++ b/comm/calendar/base/public/calIAttendee.idl
@@ -0,0 +1,80 @@
+/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIIcalProperty;
+
+[scriptable,uuid(73a074ad-8812-4055-af75-14b509b8c5fe)]
+interface calIAttendee : nsISupports
+{
+ readonly attribute boolean isMutable;
+
+ // makes this item immutable
+ void makeImmutable();
+
+ // clone always returns a mutable event
+ calIAttendee clone();
+
+ attribute AUTF8String id;
+ attribute AUTF8String commonName;
+ attribute AUTF8String rsvp;
+
+ /**
+ * If true, indicates that this is not a standard attendee, but rather this
+ * icalProperty corresponds to the organizer of the event (rfc2445 Sec 4.8.4.3)
+ */
+ attribute boolean isOrganizer;
+
+ /**
+ * CHAIR
+ * REQ-PARTICIPANT
+ * OPT-PARTICIPANT
+ * NON-PARTICIPANT
+ */
+ attribute AUTF8String role;
+
+ /**
+ * NEEDS-ACTION
+ * ACCEPTED
+ * DECLINED
+ * TENTATIVE
+ * DELEGATED
+ * COMPLETED
+ * IN-PROCESS
+ */
+ attribute AUTF8String participationStatus;
+
+ /**
+ * INDIVIDUAL
+ * GROUP
+ * RESOURCE
+ * ROOM
+ * UNKNOWN
+ */
+ attribute AUTF8String userType;
+
+ // Each inner array has two elements: a string and a nsIVariant.
+ readonly attribute Array<Array<jsval> > properties;
+
+ // If you use the has/get/set/deleteProperty
+ // methods, property names are case-insensitive.
+ //
+ // For purposes of ICS serialization, all property names in
+ // the hashbag are in uppercase.
+ AUTF8String getProperty(in AString name);
+ void setProperty(in AString name, in AUTF8String value);
+ void deleteProperty(in AString name);
+
+ attribute calIIcalProperty icalProperty;
+ attribute AUTF8String icalString;
+
+ /**
+ * The display name of the attendee. If the attendee has a common name, this
+ * is used. Otherwise, the attendee id is displayed (often an email), with the
+ * mailto: prefix dropped.
+ */
+ AUTF8String toString();
+};
diff --git a/comm/calendar/base/public/calICalendar.idl b/comm/calendar/base/public/calICalendar.idl
new file mode 100644
index 0000000000..8366dbaf38
--- /dev/null
+++ b/comm/calendar/base/public/calICalendar.idl
@@ -0,0 +1,605 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+// decls for stuff from other files
+interface nsIURI;
+interface calIItemBase;
+interface nsIVariant;
+
+// forward decls for this file
+interface calICalendarACLManager;
+interface calICalendarACLEntry;
+interface calIObserver;
+interface calIOperationListener;
+interface calIRange;
+interface calISchedulingSupport;
+interface calIDateTime;
+interface calIOperation;
+interface calIStatusObserver;
+interface nsIDOMChromeWindow;
+
+
+[scriptable, uuid(b18782c0-6557-4e8e-931d-4bf052f0a31e)]
+interface calICalendar : nsISupports
+{
+ /**
+ * Unique ID of this calendar. Only the calendar manager is allowed to set
+ * this attribute. For everybody else, it should be considered to be
+ * read-only.
+ * The id is null for unregistered calendars.
+ */
+ attribute AUTF8String id;
+
+ /**
+ * Name of the calendar
+ * Notes: Can only be set after the calendar is registered with the calendar manager.
+ */
+ attribute AUTF8String name;
+
+ /**
+ * Type of the calendar
+ * 'memory', 'storage', 'caldav', etc
+ */
+ readonly attribute AUTF8String type;
+
+ /**
+ * If this calendar is provided by an extension, this attribute should return
+ * the extension's id, otherwise null.
+ */
+ readonly attribute AString providerID;
+
+ /**
+ * Returns the acl manager for the calendar, based on the "aclManagerClass"
+ * property. If this property is not defined, the default manager is used
+ */
+ readonly attribute calICalendarACLManager aclManager;
+
+ /**
+ * Returns the acl entry associated to the calendar.
+ */
+ readonly attribute calICalendarACLEntry aclEntry;
+
+ /**
+ * Multiple calendar instances may be composited, logically acting as a
+ * single calendar, e.g. for caching puorposing.
+ * This attribute determines the topmost calendar that returned items should
+ * belong to. If the current instance is the topmost calendar, then it should
+ * be returned directly.
+ *
+ * @see calIItemBase::calendar
+ */
+ attribute calICalendar superCalendar;
+
+ /**
+ * Setting this URI causes the calendar to be (re)loaded.
+ * This is not an unique identifier! It is also not unchangeable. Don't
+ * use it to identify a calendar, use the id attribute for that purpose.
+ */
+ attribute nsIURI uri;
+
+ /**
+ * Is this calendar read-only? Used by the UI to decide whether or not
+ * widgetry should allow editing.
+ */
+ attribute boolean readOnly;
+
+ /**
+ * Whether or not it makes sense to call refresh() on this calendar.
+ */
+ readonly attribute boolean canRefresh;
+
+ /**
+ * Setting this attribute to true will prevent the calendar to make calendar properties
+ * persistent, which is useful if you would like to set properties on unregistered
+ * calendar instances.
+ */
+ attribute boolean transientProperties;
+
+ /**
+ * Gets a calendar property.
+ * The call returns null in case the property is not known;
+ * callers should use a sensible default in that case.
+ *
+ * It's up to the provider where to store properties,
+ * e.g. on the server or in local prefs.
+ *
+ * Currently known properties are:
+ * [boolean] disabled
+ * [boolean] auto-enabled If true, the calendar will be enabled on next startup.
+ * [boolean] force-disabled If true, the calendar cannot be enabled (transient).
+ * [boolean] calendar-main-in-composite
+ * [string] name
+ * [boolean] readOnly
+ * [boolean] requiresNetwork If false, the calendar does not require
+ * network access at all. This is mainy used
+ * as a UI hint.
+ * [boolean] suppressAlarms If true, alarms of this calendar are not minded.
+ * [boolean] cache.supported If true, the calendar should to be cached,
+ * e.g. this generally applies to network calendars;
+ * default is true (if not present).
+ * [boolean] cache.enabled If true, the calendar is cached; default is false.
+ * [boolean] cache.always If true, the cache will always be enabled
+ * and the user cannot turn it off. For
+ * backward compatibility, return true for
+ * cache.enabled too.
+ *
+ * [nsresult] currentStatus The current error status of the calendar (transient).
+ *
+ * [calIItipTransport] itip.transport If the provider implements a custom calIItipTransport (transient)
+ * If null, then Email Scheduling will effectively be
+ * disabled. This means for example, the calendar will
+ * not show up in the list of calendars to store an
+ * invitation in.
+ * [boolean] itip.disableRevisionChecks If true, the iTIP handling code disables revision checks
+ * against SEQUENCE and DTSTAMP, and will never reject an
+ * iTIP message as outdated
+ * [nsIMsgIdentity] imip.identity If provided, this is the email identity used for
+ * scheduling purposes
+ * [boolean] imip.identity.disabled If true, this calendar doesn't support switching imip
+ * identities. This for example means that the
+ * dropdown of identities will not be shown in the
+ * calendar properties dialog. (transient)
+ * scheduling purposes
+ * [nsIMsgAccount] imip.account If provided, this is the email account used for
+ * scheduling purposes
+ * [string] imip.identity.key If provided, this is the email internal identity key used to
+ * get the above
+ *
+ * [string] organizerId If provided, this is the preset organizer id on creating
+ * scheduling appointments (transient)
+ * [string] organizerCN If provided, this is the preset organizer common name on creating
+ * scheduling appointments (transient)
+ *
+ * The following calendar capabilities can be used to inform the UI or backend
+ * that certain features are not supported. If not otherwise mentioned, not
+ * specifying these capabilities assumes a default value of true
+ * capabilities.alarms.popup.supported Supports popup alarms
+ * capabilities.alarms.oninviations.supported Supports alarms on inviations.
+ * capabilities.alarms.maxCount Maximum number of alarms supported per event
+ * capabilities.attachments.supported Supports attachments
+ * capabilities.categories.maxCount Maximum number of supported categories.
+ * -1 means infinite, 0 means disabled.
+ * capabilities.privacy.supported Supports a privacy state
+ * capabilities.priority.supported Supports the priority field
+ * capabilities.events.supported Supports tasks
+ * capabilities.tasks.supported Supports events
+ * capabilities.timezones.floating.supported Supports local time
+ * capabilities.timezones.UTC.supported Supports UTC/GMT timezone
+ * capabilities.autoschedule.supported Supports caldav schedule properties in
+ * icalendar (SCHEDULE-AGENT, SCHEDULE-STATUS...)
+ *
+ * The following capabilities are used to restrict the values for specific
+ * fields. An array should be specified with the values, the default
+ * values are specified here. Extensions using this need to take care of
+ * adding any UI elements needed in an overlay. To make sure the correct
+ * elements are shown, those elements should additionally specify an attribute
+ * "provider", with the type of the provider.
+ *
+ * capabilities.privacy.values = ["PUBLIC", "CONFIDENTIAL", "PRIVATE"];
+ *
+ * The following special capability disables rewriting the WWW-Authenticate
+ * header on HTTP requests to include the calendar name. The default value
+ * is false, i.e rewriting is NOT disabled.
+ *
+ * capabilities.realmrewrite.disabled = false
+ *
+ * The following capability describes if the calendar can be permanently
+ * deleted, or just unsubscribed. If this property is not specified, then
+ * only unsubscribing is allowed. If an empty array is specified, neither
+ * deleting nor unsubscribing is presented in the UI.
+ *
+ * capabilities.removeModes = ["delete", "unsubscribe"]
+ *
+ * @param aName property name
+ * @return value (string, integer and boolean values are supported),
+ * else null
+ */
+ nsIVariant getProperty(in AUTF8String aName);
+
+ /**
+ * Sets a calendar property.
+ * This will (only) cause a notification onPropertyChanged() in case
+ * the value has changed.
+ *
+ * It's up to the provider where to store properties,
+ * e.g. on the server or in local prefs.
+ *
+ * @param aName property name
+ * @param aValue value
+ * (string, integer and boolean values are supported)
+ */
+ void setProperty(in AUTF8String aName, in nsIVariant aValue);
+
+ /**
+ * Deletes a calendar property.
+ *
+ * It's up to the provider where to store properties,
+ * e.g. on the server or in local prefs.
+ *
+ * @param aName property name
+ */
+ void deleteProperty(in AUTF8String aName);
+
+ /**
+ * In combination with the other parameters to getItems(), these
+ * constants provide for a very basic filtering mechanisms for use
+ * in getting and observing items. At some point fairly soon, we're
+ * going to need to generalize this mechanism significantly (so we
+ * can allow boolean logic, categories, etc.).
+ *
+ * When adding item filters (bits which, when not set to 1, reduce the
+ * scope of the results), use bit positions <= 15, so that
+ * ITEM_FILTER_ALL_ITEMS remains compatible for components that have the
+ * constant compiled in.
+ *
+ * XXX the naming here is questionable; adding a filter (setting a bit, in
+ * this case) usually _reduces_ the set of items that pass the set of
+ * filters, rather than adding to it.
+ */
+ const unsigned long ITEM_FILTER_COMPLETED_YES = 1 << 0;
+ const unsigned long ITEM_FILTER_COMPLETED_NO = 1 << 1;
+ const unsigned long ITEM_FILTER_COMPLETED_ALL = (ITEM_FILTER_COMPLETED_YES |
+ ITEM_FILTER_COMPLETED_NO);
+
+ const unsigned long ITEM_FILTER_TYPE_TODO = 1 << 2;
+ const unsigned long ITEM_FILTER_TYPE_EVENT = 1 << 3;
+ const unsigned long ITEM_FILTER_TYPE_JOURNAL = 1 << 4;
+ const unsigned long ITEM_FILTER_TYPE_ALL = (ITEM_FILTER_TYPE_TODO |
+ ITEM_FILTER_TYPE_EVENT |
+ ITEM_FILTER_TYPE_JOURNAL);
+
+ const unsigned long ITEM_FILTER_ALL_ITEMS = 0xFFFF;
+
+ /**
+ * If set, return calIItemBase occurrences for all the appropriate instances,
+ * as determined by an item's recurrenceInfo. All of these occurrences will
+ * have their parentItem set to the recurrence parent. If not set, will
+ * return only calIItemBase parent items.
+ */
+ const unsigned long ITEM_FILTER_CLASS_OCCURRENCES = 1 << 16;
+
+ /**
+ * Scope: Attendee
+ * Filter items that correspond to an invitation from another
+ * user and the current user has not replied to it yet.
+ */
+ const unsigned long ITEM_FILTER_REQUEST_NEEDS_ACTION = 1 << 17;
+
+ /**
+ * Flags for items that have been created, modified or deleted while
+ * offline.
+ * ITEM_FILTER_OFFLINE_DELETED is a particular case in that elements *must*
+ * be excluded from searches when not specified in the filter mask.
+ */
+ const unsigned long ITEM_FILTER_OFFLINE_CREATED = 1 << 29;
+ const unsigned long ITEM_FILTER_OFFLINE_MODIFIED = 1 << 30;
+ const unsigned long ITEM_FILTER_OFFLINE_DELETED = 1 << 31;
+
+ void addObserver( in calIObserver observer );
+ void removeObserver( in calIObserver observer );
+
+ /**
+ * supportsScheduling indicates whether the calendar implements the
+ * calISchedulingSupport interface.
+ */
+ readonly attribute boolean supportsScheduling;
+
+ /**
+ * getSchedulingSupport provides a calISchedulingSupport implementation for
+ * calendars that support it.
+ */
+ calISchedulingSupport getSchedulingSupport();
+
+ /**
+ * addItem adds the given calIItemBase to the calendar.
+ *
+ * @param aItem item to add
+ * @return optional operation handle to track the operation
+ *
+ * - If aItem already has an ID, that ID is used when adding.
+ * - If aItem is mutable and has no ID, the calendar is expected
+ * to generate an ID for the item.
+ * - If aItem is immutable and has no ID, an error is thrown.
+ *
+ * The result of the operation is the calIItemBase corresponding to the
+ * immutable version of the newly added item.
+ *
+ * If an item with a given ID already exists in the calendar, the Promise is
+ * rejected with a NS_ERROR_XXXXX error.
+ *
+ * @return {Promise<calIItemBase>}
+ */
+ Promise addItem(in calIItemBase aItem);
+
+ /**
+ * adoptItem adds the given calIItemBase to the calendar, but doesn't
+ * clone it. It adopts the item as-is. This is generally for use in
+ * performance-critical situations where there is no danger of the caller
+ * using the item after making the call.
+ *
+ * @see addItem
+ *
+ * @return {Promise<calIItemBase>}
+ */
+ Promise adoptItem(in calIItemBase aItem);
+
+ /**
+ * modifyItem takes a modified item and modifies the
+ * calendar's internal version of the item to match. The item is expected to
+ * be mutable and have an ID that already exists in the calendar. If it does
+ * not, the Promise is rejected with NS_ERROR_XXXXX.
+ *
+ * If the generation of the given aNewItem does not match the generation
+ * of the internal item (indicating that someone else modified the
+ * item), the Promise is rejected with NS_ERROR_XXXXX.
+ *
+ * If you would like to disable revision checks, pass null as aOldItem. This
+ * will overwrite the item on the server.
+ *
+ * @param aNewItem new version to replace the old one
+ * @param aOldItem caller's view of the item to be changed, as it is now
+ * @return {Promise<calIItemBase>} the newly-updated immutable version of
+ * the modified item.
+ *
+ */
+ Promise modifyItem(in calIItemBase aNewItem, in calIItemBase aOldItem);
+
+ /**
+ * Deletes an item. The item is expected to have an ID that already exists in
+ * the calendar.
+ *
+ * @param aItem item to delete
+ * @return {Promise<void>} optional operation handle to track the operation
+ */
+ Promise deleteItem(in calIItemBase aItem);
+
+ /**
+ * Get a single event. The event will be typed as one of the subclasses
+ * of calIItemBase (whichever concrete type is most appropriate).
+ *
+ * @param aId UID of the event
+ * @return {Promise<calIItemBase|null>} A Promise that is resolved with the item if found.
+ */
+ Promise getItem(in string aId);
+
+ /**
+ * XXX As mentioned above, this method isn't suitably general. It's just
+ * placeholder until it gets supplanted by something more SQL or RDF-like.
+ *
+ * Ordering: This method is currently guaranteed to return lists ordered
+ * as follows to make for the least amount of pain when
+ * migrating existing frontend code:
+ *
+ * The events are sorted based on the order of their next occurrence
+ * if they recur in the future or their last occurrence in the past
+ * otherwise. Here's a presentation of the sort criteria using the
+ * time axis:
+ *
+ * -----(Last occurrence of Event1)---(Last occurrence of Event2)----(Now)----(Next occurrence of Event3)---->
+ *
+ * (Note that Event1 and Event2 will not recur in the future.)
+ *
+ * We should probably be able get rid of this ordering constraint
+ * at some point in the future.
+ *
+ * Note that the range is intended to act as a mask on the
+ * occurrences, not just the initial recurring items. So if a
+ * getItems() call without ITEM_FILTER_CLASS_occurrenceS is made, all
+ * events and todos which have occurrences inside the range should
+ * be returned, even if some of those events or todos themselves
+ * live outside the range.
+ *
+ * @param aItemFilter ITEM_FILTER flags, or-ed together
+ * @param aCount Maximum number of items to return, or 0 for
+ * an unbounded query.
+ * @param aRangeStart Items starting at this time or after should be
+ * returned. If invalid, assume "since the beginning
+ * of time".
+ * @param aRangeEndEx Items starting before (not including) aRangeEndEx should be
+ * returned. If null, assume "until the end of time".
+ * @return {ReadableStream<calIItemBase>}
+ */
+ jsval getItems(in unsigned long aItemFilter,
+ in unsigned long aCount,
+ in calIDateTime aRangeStart,
+ in calIDateTime aRangeEndEx);
+
+ /**
+ * Similar to getItems() but returns all results in a single array.
+ * @param aItemFilter ITEM_FILTER flags, or-ed together
+ * @param aCount Maximum number of items to return, or 0 for
+ * an unbounded query.
+ * @param aRangeStart Items starting at this time or after should be
+ * returned. If invalid, assume "since the beginning
+ * of time".
+ * @param aRangeEndEx Items starting before (not including) aRangeEndEx should be
+ * returned. If null, assume "until the end of time".
+ * @return {Promise<calIItemBase[]>}
+ */
+ Promise getItemsAsArray(in unsigned long aItemFilter,
+ in unsigned long aCount,
+ in calIDateTime aRangeStart,
+ in calIDateTime aRangeEndEx);
+
+ /**
+ * Refresh the datasource, and call the observers for any changes found.
+ * If the provider doesn't know the details of the changes it must call
+ * onLoad on its observers.
+ *
+ * @return optional operation handle to track the operation
+ */
+ calIOperation refresh();
+
+ /**
+ * Turn on batch mode. Observers will get a notification of this.
+ * They will still get notified for every individual change, but they are
+ * free to ignore those notifications.
+ * Use this when a lot of changes are about to happen, and it would be
+ * useless to refresh the display (or the backend store) for every change.
+ * Caller must make sure to also call endBatchMode. Make sure all errors
+ * are caught!
+ */
+ void startBatch();
+
+ /**
+ * Turn off batch mode.
+ */
+ void endBatch();
+};
+
+/**
+ * Used to allow multiple calendars (eg work and home) to be easily queried
+ * and displayed as a single unit. All calendars are referenced by ID, i.e.
+ * calendars need to have an ID when being added.
+ */
+[scriptable, uuid(6748fa00-79b5-4728-84f3-20dd47e0b031)]
+interface calICompositeCalendar : calICalendar
+{
+ /**
+ * Adds a calendar to the composite, if not already part of it.
+ *
+ * @param aCalendar the calendar to be added
+ */
+ void addCalendar(in calICalendar aCalendar);
+
+ /**
+ * Remove a calendar from the composite
+ *
+ * @param aCalendar the calendar to be removed
+ */
+ void removeCalendar(in calICalendar aCalendar);
+
+ /**
+ * If a calendar for the given ID exists in the CompositeCalendar,
+ * return it; otherwise return null.
+ *
+ * @param aId id of calendar
+ * @return calendar, or null if none
+ */
+ calICalendar getCalendarById(in AUTF8String aId);
+
+ /* return a list of all calendars currently registered */
+ Array<calICalendar> getCalendars();
+
+ /**
+ * In order for addItem() to be called on this object, it is first necessary
+ * to set this attribute to specify which underlying calendar the item is
+ * to be added to.
+ */
+ attribute calICalendar defaultCalendar;
+
+ /**
+ * If set, the composite will initialize itself from calICalendarManager
+ * prefs keyed off of the provided prefPrefix, and update those prefs to
+ * track changes in calendar membership and default calendar.
+ */
+ attribute ACString prefPrefix;
+
+ /**
+ * If returns true there is a process running that needs to displayed
+ * by the statusObserver
+ */
+ readonly attribute boolean statusDisplayed;
+
+ /**
+ * Sets a statusobserver for status notifications like startMeteors() and StopMeteors().
+ */
+ void setStatusObserver(in calIStatusObserver aStatusObserver, in nsIDOMChromeWindow aWindow);
+};
+
+/**
+ * Make a more general nsIObserverService2 and friends to support
+ * nsISupports data and use that instead?
+ *
+ * NOTE: When adding methods here, please also add them in calUtils.jsm's
+ * createAdapter() method.
+ */
+[scriptable, uuid(2953c9b2-2c73-11d9-80b6-00045ace3b8d)]
+interface calIObserver : nsISupports
+{
+ void onStartBatch(in calICalendar aCalendar);
+ void onEndBatch(in calICalendar aCalendar);
+ void onLoad( in calICalendar aCalendar );
+ void onAddItem( in calIItemBase aItem );
+ void onModifyItem( in calIItemBase aNewItem, in calIItemBase aOldItem );
+ void onDeleteItem( in calIItemBase aDeletedItem );
+ void onError( in calICalendar aCalendar, in nsresult aErrNo, in AUTF8String aMessage );
+
+ /// Called after a property is changed.
+ void onPropertyChanged(in calICalendar aCalendar,
+ in AUTF8String aName,
+ in nsIVariant aValue,
+ in nsIVariant aOldValue);
+
+ /// Called before the property is deleted.
+ void onPropertyDeleting(in calICalendar aCalendar,
+ in AUTF8String aName);
+};
+
+/**
+ * calICompositeObserver interface adds things to observe changes to
+ * a calICompositeCalendar
+ */
+[scriptable, uuid(a3584c92-b8eb-4aa8-a638-e46a2e11d6a9)]
+interface calICompositeObserver : calIObserver
+{
+ void onCalendarAdded( in calICalendar aCalendar );
+ void onCalendarRemoved( in calICalendar aCalendar );
+ void onDefaultCalendarChanged( in calICalendar aNewDefaultCalendar );
+};
+
+/**
+ * Async operations are called back via this interface. If you know that your
+ * object is not going to get called back for either of these methods, having
+ * them return NS_ERROR_NOT_IMPLEMENTED is reasonable.
+ *
+ * NOTE: When adding methods here, please also add them in calUtils.jsm's
+ * createAdapter() method.
+ */
+[scriptable, uuid(ed3d87d8-2c77-11d9-8f5f-00045ace3b8d)]
+interface calIOperationListener : nsISupports
+{
+ /**
+ * For add, modify, and delete.
+ *
+ * @param aCalendar the calICalendar on which the operation took place
+ * @param aStatus status code summarizing what happened
+ * @param aOperationType type of operation that was completed
+ * @param aId UUID of element that was changed
+ * @param aDetail not yet fully specified. If aStatus is an error
+ * result, this will probably be an extended error
+ * string (eg one returned by a server).
+ */
+ void onOperationComplete(in calICalendar aCalendar,
+ in nsresult aStatus,
+ in unsigned long aOperationType,
+ in string aId,
+ in nsIVariant aDetail);
+ const unsigned long ADD = 1;
+ const unsigned long MODIFY = 2;
+ const unsigned long DELETE = 3;
+ const unsigned long GET = 4;
+
+ /**
+ * For getItem and getItems.
+ *
+ * @param aStatus status code summarizing what happened.
+ * @param aItemType type of interface returned in the array (@see
+ * calICalendar::GetItems).
+ * @param aDetail not yet fully specified. If aStatus is an error
+ * result, this will probably be an extended error
+ * string (eg one returned by a server).
+ * @param aItems array of immutable items
+ *
+ * Multiple onGetResults might be called
+ */
+ void onGetResult(in calICalendar aCalendar,
+ in nsresult aStatus,
+ in nsIIDRef aItemType,
+ in nsIVariant aDetail,
+ [iid_is(aItemType)] in Array<nsQIResult> aItems);
+};
diff --git a/comm/calendar/base/public/calICalendarACLManager.idl b/comm/calendar/base/public/calICalendarACLManager.idl
new file mode 100644
index 0000000000..21499fa93e
--- /dev/null
+++ b/comm/calendar/base/public/calICalendarACLManager.idl
@@ -0,0 +1,86 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIMsgIdentity;
+interface nsIURI;
+
+interface calICalendar;
+interface calIItemBase;
+interface calIOperationListener;
+
+interface calIItemACLEntry;
+
+/**
+ */
+[scriptable, uuid(a64bd8a0-e9f0-4f64-928a-1c98861e4703)]
+interface calICalendarACLManager : nsISupports
+{
+ /* Gets the calICalendarACLEntry of the current user for the specified
+ calendar. */
+ void getCalendarEntry(in calICalendar aCalendar,
+ in calIOperationListener aListener);
+
+ /* Gets the calIItemACLEntry of the current user for the specified
+ calendar item. Depending on the implementation, each item can have
+ different permissions based on specific attributes.
+ (TODO: should be made asynchronous one day) */
+ calIItemACLEntry getItemEntry(in calIItemBase aItem);
+};
+
+[scriptable, uuid(f3da7954-52a4-45a9-bd7d-96c518133d0c)]
+interface calICalendarACLEntry : nsISupports
+{
+ /* The calICalendarACLManager instance that generated this entry. */
+ readonly attribute calICalendarACLManager aclManager;
+
+ /* Whether the underlying calendar does have access control. */
+ readonly attribute boolean hasAccessControl;
+
+ /* Whether the user accessing the calendar is its owner. */
+ readonly attribute boolean userIsOwner;
+
+ /* Whether the user accessing the calendar can add items to it. */
+ readonly attribute boolean userCanAddItems;
+
+ /* Whether the user accessing the calendar can remove items from it. */
+ readonly attribute boolean userCanDeleteItems;
+
+ /* Returns the list of user ids matching the user accessing the
+ calendar. */
+ Array<AString> getUserAddresses();
+
+ /* Returns the list of instantiated identities for the user accessing the
+ calendar. */
+ Array<nsIMsgIdentity> getUserIdentities();
+ /* Returns the list of instantiated identities for the user representing
+ the calendar owner. */
+ Array<nsIMsgIdentity> getOwnerIdentities();
+
+ /* Helper method that forces a cleanup of any cache and a reload of the
+ current entry.
+ (TODO: should be made asynchronous one day) */
+ void refresh();
+};
+
+[scriptable, uuid(4d0b7ced-8c57-4efa-87e7-8dd5b7481312)]
+interface calIItemACLEntry : nsISupports
+{
+ /* The parent calICalendarACLEntry instance. */
+ readonly attribute calICalendarACLEntry calendarEntry;
+
+ /* Whether the active user can fully modify the item. */
+ readonly attribute boolean userCanModify;
+
+ /* Whether the active user can respond to this item, if it is an invitation. */
+ readonly attribute boolean userCanRespond;
+
+ /* Whether the active user can view all the item properties. */
+ readonly attribute boolean userCanViewAll;
+
+ /* Whether the active user can only see when this item occurs without
+ knowing any details. */
+ readonly attribute boolean userCanViewDateAndTime;
+};
diff --git a/comm/calendar/base/public/calICalendarManager.idl b/comm/calendar/base/public/calICalendarManager.idl
new file mode 100644
index 0000000000..6eff2075a3
--- /dev/null
+++ b/comm/calendar/base/public/calICalendarManager.idl
@@ -0,0 +1,139 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calICalendar;
+interface calIObserver;
+interface nsIURI;
+interface nsIVariant;
+
+interface calICalendarManagerObserver;
+
+[scriptable, uuid(fd8a2565-cb0f-4ecc-945d-760d75ab16d8)]
+interface calICalendarManager : nsISupports
+{
+ /**
+ * Gives the number of registered calendars that require network access.
+ */
+ readonly attribute uint32_t networkCalendarCount;
+
+ /***
+ * Gives the number of registered readonly calendars.
+ */
+ readonly attribute uint32_t readOnlyCalendarCount;
+
+ /**
+ * Gives the number of registered calendars
+ */
+ readonly attribute uint32_t calendarCount;
+
+ /**
+ * Register a calendar provider with the given JavaScript implementation. The implementation must
+ * implement calICalendar, and can optionally implement a number of other related interfaces.
+ * Please see the documentation for calICalendar for more details.
+ *
+ * @param {string} aType The calendar type string, see calICalendar::type.
+ * @param {Object} aImplementation The class that implements calICalendar.
+ */
+ void registerCalendarProvider(in AUTF8String aType, in jsval aImplementation);
+
+ /**
+ * Unregister a calendar provider by type. Already registered calendars will be replaced by a
+ * dummy calendar that is force-disabled.
+ *
+ * @param {string} aType The calendar type string, see calICalendar::type.
+ * @param {boolean} aTemporary If true, cached calendars will not be cleared.
+ */
+ void unregisterCalendarProvider(in AUTF8String aType, [optional] in boolean aTemporary);
+
+ /**
+ * Checks if a calendar provider has been dynamically registered with the given type. This does
+ * not check for the built-in XPCOM providers.
+ *
+ * @param {string} aType The calendar type string, see calICalendar::type.
+ */
+ boolean hasCalendarProvider(in AUTF8String aType);
+
+ /*
+ * create a new calendar
+ * aType is the type ("caldav", "storage", etc)
+ */
+ calICalendar createCalendar(in AUTF8String aType, in nsIURI aURL);
+
+ /* register a newly created calendar with the calendar service */
+ void registerCalendar(in calICalendar aCalendar);
+
+ /* unregister a calendar */
+ void unregisterCalendar(in calICalendar aCalendar);
+
+ /** Remove the calendar following the calendar's capabilities.removeModes. */
+ const unsigned short REMOVE_AUTO = 0;
+
+ /** Just unsubscribe from the calendar, do not delete it. */
+ const unsigned short REMOVE_NO_DELETE = 1;
+
+ /** Passing this flag will cause the call to fail if the calendar is registered */
+ const unsigned short REMOVE_NO_UNREGISTER = 2;
+
+ /**
+ * Unregister and delete the calendar from the calendar manager. By default
+ * the calendar will be removed based on the capabilities.removeModes
+ * property of the calendar.
+ *
+ * WARNING: If the calendar supports deletion, the calendar will be
+ * permanently deleted. You can prevent this with the REMOVE_NO_DELETE flag.
+ *
+ * @param aCalendar The calendar to remove.
+ * @param aMode A combination of the above mode flags.
+ */
+ void removeCalendar(in calICalendar aCalendar, [optional] in uint8_t aMode);
+
+ /* get a calendar by its id */
+ calICalendar getCalendarById(in AUTF8String aId);
+
+ /* return a list of all calendars currently registered */
+ Array<calICalendar> getCalendars();
+
+ /** Add an observer for the calendar manager, i.e when calendars are registered */
+ void addObserver(in calICalendarManagerObserver aObserver);
+ /** Remove an observer for the calendar manager */
+ void removeObserver(in calICalendarManagerObserver aObserver);
+
+ /** Add an observer to handle changes to all calendars (even disabled or unchecked ones) */
+ void addCalendarObserver(in calIObserver aObserver);
+ /** Remove an observer to handle changes to all calendars */
+ void removeCalendarObserver(in calIObserver aObserver);
+
+ /* XXX private, don't use:
+ will vanish as soon as providers will directly read/write from moz prefs
+ */
+ nsIVariant getCalendarPref_(in calICalendar aCalendar,
+ in AUTF8String aName);
+ void setCalendarPref_(in calICalendar aCalendar,
+ in nsIVariant aName,
+ in nsIVariant aValue);
+ void deleteCalendarPref_(in calICalendar aCalendar,
+ in AUTF8String aName);
+
+};
+
+/**
+ * Observer to handle actions done by the calendar manager
+ *
+ * NOTE: When adding methods here, please also add them in calUtils.jsm's
+ * createAdapter() method.
+ */
+[scriptable, uuid(383f36f1-e669-4ca4-be7f-06b43910f44a)]
+interface calICalendarManagerObserver : nsISupports
+{
+ /** Called after the calendar is registered */
+ void onCalendarRegistered(in calICalendar aCalendar);
+
+ /** Called before the unregister actually takes place */
+ void onCalendarUnregistering(in calICalendar aCalendar);
+
+ /** Called before the delete actually takes place */
+ void onCalendarDeleting(in calICalendar aCalendar);
+};
diff --git a/comm/calendar/base/public/calICalendarProvider.idl b/comm/calendar/base/public/calICalendarProvider.idl
new file mode 100644
index 0000000000..e6adf7a060
--- /dev/null
+++ b/comm/calendar/base/public/calICalendarProvider.idl
@@ -0,0 +1,89 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIURI;
+interface calICalendar;
+interface nsIVariant;
+interface calIProviderListener;
+
+/**
+ * High-level interface to allow providers to be pluggable.
+ */
+[scriptable, uuid(30e22db4-9f13-11d9-80d6-000b7d081f44)]
+interface calICalendarProvider : nsISupports
+{
+ /**
+ * The type of provider, this may be used as a key to uniquely identify a
+ * provider and should match the type= part of the contract id of both the
+ * provider and the matching calICalendar implementation.
+ */
+ readonly attribute AUTF8String type;
+
+ /**
+ * The way to refer to this provider in UI for the end-user
+ * (eg "Shared ICS File").
+ */
+ readonly attribute AUTF8String displayName;
+
+ /**
+ * The way to refer to this provider in the UI when needing to display a short
+ * label to describe the type (eg "CalDAV", "ICS", etc.). This is different
+ * from the type attribute as it's not meant to be used as unique identifier
+ * but only as a shorter non-localized label.
+ */
+ readonly attribute AUTF8String shortName;
+
+ /**
+ * Delete a calendar. Deletes the actual underlying calendar, which
+ * could be (for example) a file or a calendar on a server
+ *
+ * @param aCalendar the calendar to delete
+ * @param aListener where to call the results back to
+ */
+ void deleteCalendar(in calICalendar aCalendar,
+ in calIProviderListener aListener);
+
+ /**
+ * Detect calendars using the given parameters (location, username, etc.).
+ *
+ * @param username The username to use.
+ * @param password The password to use.
+ * @param location The location to use. It could be a hostname, a
+ * specific URL, the origin URL, etc.
+ * @param savePassword Whether to save the password or not.
+ * @param extraProperties Any additional properties needed.
+ * @return Promise resolved with an array of found calendars.
+ * (Array<calICalendar>). If no calendars were
+ * found, resolved with an empty array. If an
+ * error occurs, rejected with the error.
+ */
+ Promise detectCalendars(in AUTF8String username, in AUTF8String password,
+ in AUTF8String location, in boolean savePassword,
+ [optional] in jsval extraProperties);
+};
+
+[scriptable, uuid(0eebe99e-a22d-11d9-87a6-000b7d081f44)]
+interface calIProviderListener : nsISupports
+{
+ /**
+ * @param aStatus status code summarizing what happened
+ * @param aDetail not yet fully specified. If aStatus is an error
+ * result, this will probably be an extended error
+ * string (eg one returned by a server).
+ */
+ void onCreateCalendar(in calICalendar aCalendar, in nsresult aStatus,
+ in nsIVariant aDetail);
+
+ /**
+ * @param aStatus status code summarizing what happened
+ * @param aDetail not yet fully specified. If aStatus is an error
+ * result, this will probably be an extended error
+ * string (eg one returned by a server).
+ */
+ void onDeleteCalendar(in calICalendar aCalendar, in nsresult aStatus,
+ in nsIVariant aDetail);
+};
diff --git a/comm/calendar/base/public/calICalendarView.idl b/comm/calendar/base/public/calICalendarView.idl
new file mode 100644
index 0000000000..d9024d21e9
--- /dev/null
+++ b/comm/calendar/base/public/calICalendarView.idl
@@ -0,0 +1,216 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+#include "nsISupports.idl"
+
+interface calICalendar;
+interface calIDateTime;
+interface calICalendarViewController;
+interface calIItemBase;
+
+/**
+ * An interface for view widgets containing calendaring data.
+ *
+ * @note Code that implements this interface is intended to be pure
+ * widgetry and thus not have any preference dependencies.
+ */
+
+[scriptable, uuid(0e392744-4b2e-4b64-8862-2fb707d900a7)]
+interface calICalendarView : nsISupports
+{
+
+ /**
+ * Oftentimes other elements in the DOM in which a calIDecoratedView is
+ * used want to be aware of whether or not the view is selected. An element
+ * whose ID is observerID can be included in that DOM, and will be set to be
+ * enabled or disabled depending on whether the view is selected.
+ */
+ readonly attribute AUTF8String observerID;
+
+ /**
+ * the controller for this view
+ */
+ attribute calICalendarViewController controller;
+
+ /**
+ * If true, the view supports workdays only
+ */
+ readonly attribute boolean supportsWorkdaysOnly;
+
+ /**
+ * If this is set to 'true', the view should not display days specified to be
+ * non-workdays. The implementor is responsible for obtaining what those
+ * days are on its own.
+ */
+ attribute boolean workdaysOnly;
+
+ /**
+ * Whether or not tasks are to be displayed in the calICalendarView
+ */
+ attribute boolean tasksInView;
+
+ /**
+ * If true, the view is rotatable
+ */
+ readonly attribute boolean supportsRotation;
+
+ /**
+ * If set, the view will be rotated (i.e time on top, date at left)
+ */
+ attribute boolean rotated;
+
+ /**
+ * If true, the view is zoomable
+ */
+ readonly attribute boolean supportsZoom;
+
+ /**
+ * Zoom view in one level. Defaults to one level.
+ */
+ void zoomIn([optional] in uint32_t level);
+
+ /**
+ * Zoom view out one level. Defaults to one level.
+ */
+ void zoomOut([optional] in uint32_t level);
+
+ /**
+ * Reset view zoom.
+ */
+ void zoomReset();
+
+ /**
+ * Whether or not completed tasks are shown in the calICalendarView
+ */
+ attribute boolean showCompleted;
+
+ /**
+ * Ensure that the given date is visible; the view is free
+ * to show more dates than the given date (e.g. week view
+ * would show the entire week).
+ */
+ void showDate(in calIDateTime aDate);
+
+ /**
+ * Set a date range for the view to display, from aStartDate
+ * to aEndDate, inclusive.
+ *
+ * Some views may decide to utilize the time portion of these
+ * calIDateTimes; pass in calIDateTimes that are dates if you
+ * want to make sure this doesn't happen.
+ */
+ void setDateRange(in calIDateTime aStartDate, in calIDateTime aEndDate);
+
+ /**
+ * The start date of the view's display. If the view is displaying
+ * disjoint dates, this will be the earliest date that's displayed.
+ */
+ readonly attribute calIDateTime startDate;
+
+ /**
+ * The end date of the view's display. If the view is displaying
+ * disjoint dates, this will be the latest date that's displayed.
+ *
+ * Note that this won't be equivalent to the aEndDate passed to
+ * setDateRange, because that date isn't actually displayed!
+ */
+ readonly attribute calIDateTime endDate;
+
+ /**
+ * The first day shown in the embedded view
+ */
+ readonly attribute calIDateTime startDay;
+
+ /**
+ * The last day shown in the embedded view
+ */
+ readonly attribute calIDateTime endDay;
+
+ /**
+ * True if this view supports disjoint dates
+ */
+ readonly attribute boolean supportsDisjointDates;
+
+ /**
+ * True if this view currently has a disjoint date set.
+ */
+ readonly attribute boolean hasDisjointDates;
+
+ /**
+ * Returns the list of dates being shown by this calendar.
+ * If a date range is set, it will expand out the date range by
+ * day and return the full set.
+ */
+ Array<calIDateTime> getDateList();
+
+ /**
+ * Get the items currently selected in this view.
+ *
+ * @return the array of items currently selected in this.
+ */
+ Array<calIItemBase> getSelectedItems();
+
+ /**
+ * Select an array of items in the view. Items outside the view's current
+ * display range will be ignored.
+ *
+ * @param aCount the number of items to select
+ * @param aItems an array of items to select
+ * @param aSuppressEvent if true, the 'itemselect' event will not be fired.
+ */
+ void setSelectedItems(in Array<calIItemBase> aItems, [optional] in boolean aSuppressEvent);
+
+ /**
+ * Make as many of the selected items as possible are visible in the view.
+ */
+ void centerSelectedItems();
+
+ /**
+ * Get or set the selected day.
+ */
+ attribute calIDateTime selectedDay;
+
+ /**
+ * Get or set the timezone that the view's elements should be displayed in.
+ * Setting this does not refresh the view.
+ */
+ attribute AUTF8String timezone;
+
+ /**
+ * Ensures that the given date is visible, and that the view is centered
+ * around this date. aDate becomes the selectedDay of the view. Calling
+ * this function with the current selectedDay effectively refreshes the view
+ *
+ * @param aDate the date that must be shown in the view and becomes
+ * the selected day
+ */
+ void goToDay(in calIDateTime aDate);
+
+ /**
+ * Moves the view a specific number of pages. Negative numbers correspond to
+ * moving the view backwards. Note that it is up to the view to determine
+ * how the selected day ought to move as well.
+ *
+ * @param aNumber the number of pages to move the view
+ */
+ void moveView(in long aNumber);
+
+ /**
+ * gets the description of the range displayed by the view
+ */
+ AString getRangeDescription();
+
+ /**
+ * The type of the view e.g "day", "week", "multiweek" or "month" that refers
+ * to the displayed time period.
+ */
+ readonly attribute string type;
+ /**
+ * removes the dropshadows that are inserted into childelements during a
+ * drag and drop session
+ */
+
+ void removeDropShadows();
+};
diff --git a/comm/calendar/base/public/calICalendarViewController.idl b/comm/calendar/base/public/calICalendarViewController.idl
new file mode 100644
index 0000000000..823a72fe34
--- /dev/null
+++ b/comm/calendar/base/public/calICalendarViewController.idl
@@ -0,0 +1,75 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+#include "nsISupports.idl"
+
+interface calICalendar;
+interface calIDateTime;
+interface calIEvent;
+interface calIItemBase;
+
+[scriptable, uuid(40430501-a666-4c24-b234-eeac5ccb70f6)]
+interface calICalendarViewController : nsISupports
+{
+ /**
+ * Create an event, with an optional start time and optional end
+ * time in the given Calendar. The Calendar will be the
+ * displayCalendar set on the View which invokes this method
+ * on the controller, or null, if the views wish to delegate the
+ * choice of the calendar to the controller.
+ *
+ * If neither aStartTime or aEndTime are given, the user wants to
+ * create a generic event with no information prefilled.
+ *
+ * If aStartTime is given and is a date, the user wants to
+ * create an all day event, optionally a multi-all-day event if
+ * aEndTime is given (and is also a date).
+ *
+ * If aStartTime is given and is a time, but no aEndTime is
+ * given, the user wants to create an event starting at
+ * aStartTime and of the default duration. The controller has the
+ * option of creating this event automatically or via the dialog.
+ *
+ * If both aStartTime and aEndTime are given as times, then
+ * the user wants to create an event going from aStartTime
+ * to aEndTime.
+ */
+ void createNewEvent (in calICalendar aCalendar,
+ in calIDateTime aStartTime,
+ in calIDateTime aEndTime);
+
+ /**
+ * View an occurrence of an event. This opens the event in a read-only
+ * summary dialog.
+ */
+ void viewOccurrence(in calIItemBase aOccurrence);
+
+ /**
+ * Modify aOccurrence. If aNewStartTime and aNewEndTime are given,
+ * update the event to those times. If aNewTitle is given, modify the title
+ * of the item. If no parameters are given, ask the user to modify.
+ */
+ void modifyOccurrence (in calIItemBase aOccurrence,
+ in calIDateTime aNewStartTime,
+ in calIDateTime aNewEndTime,
+ in AString aNewTitle);
+ /**
+ * Delete all events in the given array. If more than one event is passed,
+ * this will prompt whether to delete just this occurrence or all occurrences.
+ * All passed events will be handled in one transaction, i.e undoing this will
+ * make all events reappear.
+ *
+ * @param aCount The number of events in the array
+ * @param aOccurrences An array of Items/Occurrences to delete
+ * @param aUseParentItems If set, each occurrence will have its parent item
+ * deleted.
+ * @param aDoNotConfirm If set, the events will be deleted without
+ * confirmation.
+ */
+ void deleteOccurrences (in Array<calIItemBase> aOccurrences,
+ in boolean aUseParentItems,
+ in boolean aDoNotConfirm);
+};
diff --git a/comm/calendar/base/public/calIChangeLog.idl b/comm/calendar/base/public/calIChangeLog.idl
new file mode 100644
index 0000000000..e49e42f61d
--- /dev/null
+++ b/comm/calendar/base/public/calIChangeLog.idl
@@ -0,0 +1,151 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "calICalendar.idl"
+
+interface calIGenericOperationListener;
+interface calIOperation;
+
+/**
+ * Interface for managing offline flags in offline storage
+ * (calStorageCalendar), in particular from calICachedCalendar.
+ */
+[scriptable, uuid(36dc2c93-5851-40d2-9ba9-b1f6e682c75c)]
+interface calIOfflineStorage : calICalendar {
+ /**
+ * Mark the item of which the id is passed as parameter as new.
+ *
+ * @param aItem the item to add
+ *
+ * @return {Promise<void>}
+ */
+ Promise addOfflineItem(in calIItemBase aItem);
+
+ /**
+ * Mark the item of which the id is passed as parameter as modified.
+ *
+ * @param aItem the item to modify
+ *
+ * @return {Promise<void>}
+ */
+ Promise modifyOfflineItem(in calIItemBase aItem);
+
+ /**
+ * Mark the item of which the id is passed as parameter as deleted.
+ *
+ * @param aItem the item to delete
+ * @return {Promise<void>}
+ */
+ Promise deleteOfflineItem(in calIItemBase aItem);
+
+ /**
+ * Retrieves the offline flag for the given item.
+ *
+ * @param aItem the item to reset
+ * @return {Promise<number>}
+ */
+ Promise getItemOfflineFlag(in calIItemBase aItem);
+
+ /**
+ * Remove any offline flag from the item record.
+ *
+ * @param aItem the item to reset
+ * @return {Promise<void>}
+ */
+ Promise resetItemOfflineFlag(in calIItemBase aItem);
+};
+
+/**
+ * Interface for synchronously working providers on storing items,
+ * e.g. storage, memory. All modifying commands return after the
+ * modification has been performed.
+ *
+ * @note
+ * This interface is used in conjunction with changelog-based synchronization
+ * and additionally offers storing meta-data for items for this purpose.
+ * The meta data is stored as long as the corresponding items persist in
+ * the calendar and automatically cleanup up once the item is deleted from
+ * the calendar, but is not altered when an item is modified (modifyItem).
+ * Meta data can be fetched/stored per (master) item, i.e. if you need to
+ * store meta data for individual overridden items, you need to store it
+ * along with the master item's meta data.
+ * Finally, keep in mind that the meta data is "calendar local" and not
+ * automatically transferred when storing the item on another calISyncWriteCalendar.
+ */
+[scriptable, uuid(651e137b-2f3a-4595-af89-da51b6a37f85)]
+interface calISyncWriteCalendar : calICalendar {
+ /**
+ * Adds or replaces meta data of an item.
+ *
+ * @param id an item id
+ * @param value an arbitrary string
+ */
+ void setMetaData(in AUTF8String id,
+ in AUTF8String value);
+
+ /**
+ * Deletes meta data of an item.
+ *
+ * @param id an item id
+ */
+ void deleteMetaData(in AUTF8String id);
+
+ /**
+ * Gets meta data of an item or null if there's none or the item id is invalid.
+ *
+ * @param id an item id
+ */
+ AUTF8String getMetaData(in AUTF8String id);
+
+ /**
+ * Gets all meta data IDs.
+ */
+ Array<AString> getAllMetaDataIds();
+
+ /**
+ * Gets all meta data values.
+ */
+ Array<AString> getAllMetaDataValues();
+};
+
+/**
+ * Calendar implementing this interface have improved means of replaying their
+ * changelog data. This could for example mean, that the provider can retrieve
+ * changes between now and the last sync.
+ *
+ * Not implementing this interface is perfectly valid for calendars, that need
+ * to do a full sync each time anyway (i.e ics)
+ */
+[scriptable, uuid(0bf4c6a2-b4c7-4cae-993a-4408d8bded3e)]
+interface calIChangeLog : nsISupports {
+
+ // To denote no offline flag, use null
+ const long OFFLINE_FLAG_CREATED_RECORD = 1;
+ const long OFFLINE_FLAG_MODIFIED_RECORD = 2;
+ const long OFFLINE_FLAG_DELETED_RECORD = 4;
+
+ /**
+ * Enable the changelog calendar to retrieve offline data right after instantiation.
+ */
+ attribute calISyncWriteCalendar offlineStorage;
+
+ /**
+ * Resets the changelog. This is used if the cache should be refreshed.
+ */
+ void resetLog();
+
+ /**
+ * Instructs the calendar to replay remote changes into the above offlineStorage
+ * calendar. The calendar itself is responsible for storing anything needed
+ * to keep track of what items need updating.
+ *
+ * TODO: We might reconsider to replay on calICalendar,
+ * but this complicates implementing this interface
+ * enormously for providers.
+ *
+ * @param aDestination The calendar to sync changes into
+ * @param aListener The listener to notify when the operation completes.
+ */
+ calIOperation replayChangesOn(in calIGenericOperationListener aListener);
+};
diff --git a/comm/calendar/base/public/calIDateTime.idl b/comm/calendar/base/public/calIDateTime.idl
new file mode 100644
index 0000000000..e4da295843
--- /dev/null
+++ b/comm/calendar/base/public/calIDateTime.idl
@@ -0,0 +1,228 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIDuration;
+interface calITimezone;
+
+[scriptable, uuid(fe3e9a58-2938-4b2c-9085-4989d5f7244f)]
+interface calIDateTime : nsISupports
+{
+ /**
+ * isMutable is true if this instance is modifiable.
+ * If isMutable is false, any attempts to modify
+ * the object will throw NS_ERROR_OBJECT_IS_IMMUTABLE.
+ */
+ readonly attribute boolean isMutable;
+
+ /**
+ * Make this calIDateTime instance immutable.
+ */
+ void makeImmutable();
+
+ /**
+ * Clone this calIDateTime instance into a new
+ * mutable object.
+ */
+ calIDateTime clone();
+
+ /**
+ * valid is true if this object contains a valid
+ * time/date.
+ */
+ // true if this thing is set/valid
+ readonly attribute boolean isValid;
+
+ /**
+ * nativeTime contains this instance's PRTime value relative
+ * to the UTC epoch, regardless of the timezone that's set
+ * on this instance. If nativeTime is set, the given UTC PRTime
+ * value is exploded into year/month/etc, forcing the timezone
+ * setting to UTC.
+ *
+ * @warning: When the timezone is set to 'floating', this will return
+ * the nativeTime as-if the timezone was UTC. Take this into account
+ * when comparing values.
+ *
+ * @note on objects that are pinned to a timezone and have isDate set,
+ * nativeTime will be 00:00:00 in the timezone of that date, not 00:00:00 in
+ * UTC.
+ */
+ attribute PRTime nativeTime;
+
+ /**
+ * Full 4-digit year value (e.g. "1989", "2004")
+ */
+ attribute short year;
+
+ /**
+ * Month, 0-11, 0 = January
+ */
+ attribute short month;
+
+ /**
+ * Day of month, 1-[28,29,30,31]
+ */
+ attribute short day;
+
+ /**
+ * Hour, 0-23
+ */
+ attribute short hour;
+
+ /**
+ * Minute, 0-59
+ */
+ attribute short minute;
+
+ /**
+ * Second, 0-59
+ */
+ attribute short second;
+
+ /**
+ * Gets or sets the timezone of this calIDateTime instance.
+ * Setting the timezone does not change the actual date/time components;
+ * to convert between timezones, use getInTimezone().
+ *
+ * @throws NS_ERROR_INVALID_ARG if null is passed in.
+ */
+ attribute calITimezone timezone;
+
+ /**
+ * Resets the datetime object.
+ *
+ * @param year full 4-digit year value (e.g. "1989", "2004")
+ * @param month month, 0-11, 0 = January
+ * @param day day of month, 1-[28,29,31]
+ * @param hour hour, 0-23
+ * @param minute minute, 0-59
+ * @param second second, 0-59
+ * @param timezone timezone
+ *
+ * The passed datetime will be normalized, e.g. a minute value of 60 will
+ * increase the hour.
+ *
+ * @throws NS_ERROR_INVALID_ARG if no timezone is passed in.
+ */
+ void resetTo(in short year,
+ in short month,
+ in short day,
+ in short hour,
+ in short minute,
+ in short second,
+ in calITimezone timezone);
+
+ /**
+ * The offset of the timezone this datetime is in, relative to UTC, in
+ * seconds. A positive number means that the timezone is ahead of UTC.
+ */
+ readonly attribute long timezoneOffset;
+
+ /**
+ * isDate indicates that this calIDateTime instance represents a date
+ * (a whole day), and not a specific time on that day. If isDate is set,
+ * accessing the hour/minute/second fields will return 0, and and setting
+ * them is an illegal operation.
+ */
+ attribute boolean isDate;
+
+ /*
+ * computed values
+ */
+
+ /**
+ * Day of the week. 0-6, with Sunday = 0.
+ */
+ readonly attribute short weekday;
+
+ /**
+ * Day of the year, 1-[365,366].
+ */
+ readonly attribute short yearday;
+
+ /*
+ * Methods
+ */
+
+ /**
+ * Resets this instance to Jan 1, 1970 00:00:00 UTC.
+ */
+ void reset();
+
+ /**
+ * Return a string representation of this instance.
+ */
+ AUTF8String toString();
+
+ /**
+ * Returns a string representation of this instance suitable for JSON.
+ */
+ AUTF8String toJSON();
+
+ /**
+ * Return a new calIDateTime instance that's the result of
+ * converting this one into the given timezone. Valid values
+ * for aTimezone are the same as the timezone field. If
+ * the "floating" timezone is given, then this object
+ * is just cloned, and the timezone is set to floating.
+ */
+ calIDateTime getInTimezone(in calITimezone aTimezone);
+
+ // add the given calIDateTime, treating it as a duration, to
+ // this item.
+ // XXX will change
+ void addDuration (in calIDuration aDuration);
+
+ // Subtract two dates and return a duration
+ // returns duration of this - aOtherDate
+ // if aOtherDate is > this the duration will be negative
+ calIDuration subtractDate (in calIDateTime aOtherDate);
+
+ /**
+ * Compare this calIDateTime instance to aOther. Returns -1, 0, 1 to
+ * indicate if this < aOther, this == aOther, or this > aOther,
+ * respectively.
+ *
+ * This comparison is timezone-aware; the given values are converted
+ * to a common timezone before comparing. If either this or aOther is
+ * floating, both objects are treated as floating for the comparison.
+ *
+ * If either this or aOther has isDate set, then only the date portion is
+ * compared.
+ *
+ * @exception calIErrors.INVALID_TIMEZONE bad timezone on this object
+ * (not the argument object)
+ */
+ long compare (in calIDateTime aOther);
+
+ //
+ // Some helper getters for calculating useful ranges
+ //
+
+ /**
+ * Returns SUNDAY of the given datetime object's week.
+ */
+ readonly attribute calIDateTime startOfWeek;
+
+ /**
+ * Returns SATURDAY of the datetime object's week.
+ */
+ readonly attribute calIDateTime endOfWeek;
+
+ // the start/end of the current object's month
+ readonly attribute calIDateTime startOfMonth;
+ readonly attribute calIDateTime endOfMonth;
+
+ // the start/end of the current object's year
+ readonly attribute calIDateTime startOfYear;
+ readonly attribute calIDateTime endOfYear;
+
+ /**
+ * This object as either an iCalendar DATE or DATETIME string, as
+ * appropriate and sets the timezone to either UTC or floating.
+ */
+ attribute ACString icalString;
+};
diff --git a/comm/calendar/base/public/calIDeletedItems.idl b/comm/calendar/base/public/calIDeletedItems.idl
new file mode 100644
index 0000000000..8045fa24b5
--- /dev/null
+++ b/comm/calendar/base/public/calIDeletedItems.idl
@@ -0,0 +1,26 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIDateTime;
+
+[scriptable, uuid(2414729b-37dc-456e-ba72-f9c33891e6ee)]
+interface calIDeletedItems : nsISupports
+{
+ /**
+ * Clean the database of all deleted items older than an internal threshold.
+ */
+ void flush();
+
+ /**
+ * Gets the time the item with given id was deleted at. If passed, the
+ * search will be restricted to a certain calendar
+ *
+ * @param aId The ID of the item to search for.
+ * @param aCalId The calendar id to restrict the search to.
+ * @return The date/time the item was deleted, or null if not found.
+ */
+ calIDateTime getDeletedDate(in AUTF8String aId, [optional] in AUTF8String aCalId);
+};
diff --git a/comm/calendar/base/public/calIDuration.idl b/comm/calendar/base/public/calIDuration.idl
new file mode 100644
index 0000000000..a6bb00ed79
--- /dev/null
+++ b/comm/calendar/base/public/calIDuration.idl
@@ -0,0 +1,104 @@
+/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(78537f21-fd5c-4e02-ab26-8ff6a3d946cb)]
+interface calIDuration : nsISupports
+{
+ /**
+ * isMutable is true if this instance is modifiable.
+ * If isMutable is false, any attempts to modify
+ * the object will throw CAL_ERROR_ITEM_IS_MUTABLE.
+ */
+ readonly attribute boolean isMutable;
+
+ /**
+ * Make this calIDuration instance immutable.
+ */
+ void makeImmutable();
+
+ /**
+ * Clone this calIDuration instance into a new
+ * mutable object.
+ */
+ calIDuration clone();
+
+ /**
+ * Is Negative
+ */
+ attribute boolean isNegative;
+
+ /**
+ * Weeks
+ */
+ attribute short weeks;
+
+ /**
+ * Days
+ */
+ attribute short days;
+
+ /**
+ * Hours
+ */
+ attribute short hours;
+
+ /**
+ * Minutes
+ */
+ attribute short minutes;
+
+ /**
+ * Seconds
+ */
+ attribute short seconds;
+
+ /**
+ * total duration in seconds
+ */
+ attribute long inSeconds;
+
+ /*
+ * Methods
+ */
+
+ /**
+ * Add a duration
+ */
+ void addDuration(in calIDuration aDuration);
+
+ /**
+ * Compare with another duration
+ *
+ * @param aOther to be compared with this object
+ *
+ * @return -1, 0, 1 if this < aOther, this == aOther, or this > aOther,
+ * respectively.
+ */
+ long compare(in calIDuration aOther);
+
+ /**
+ * Reset this duration to 0
+ */
+ void reset();
+
+ /**
+ * Normalize the duration
+ */
+ void normalize();
+
+ /**
+ * Return a string representation of this instance.
+ */
+ AUTF8String toString();
+
+ attribute jsval icalDuration;
+
+ /**
+ * This object as an iCalendar DURATION string
+ */
+ attribute ACString icalString;
+};
diff --git a/comm/calendar/base/public/calIErrors.idl b/comm/calendar/base/public/calIErrors.idl
new file mode 100644
index 0000000000..51571822e0
--- /dev/null
+++ b/comm/calendar/base/public/calIErrors.idl
@@ -0,0 +1,117 @@
+/* -*- Mode: IDL; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(404c7d78-bec7-474c-aa2a-82c0d0563bb6)]
+interface calIErrors : nsISupports
+{
+ /**
+ * The first two constants are copied from nsError.h, but named slightly
+ * differently, because if they're named the same, the names collide and
+ * the compiler can't deal.
+ */
+ const unsigned long CAL_ERROR_MODULE_CALENDAR = 5;
+ const unsigned long CAL_ERROR_MODULE_BASE_OFFSET = 0x45;
+
+ /**
+ * The beginning of this set of error codes, also copied from the macros
+ * in nsError.h.
+ */
+ const unsigned long ERROR_BASE = (1<<31) |
+ (CAL_ERROR_MODULE_CALENDAR + CAL_ERROR_MODULE_BASE_OFFSET) << 16;
+
+ /* Onto the actual errors! */
+
+ /**
+ * An invalid or nonexistent timezone was encountered.
+ */
+ const unsigned long INVALID_TIMEZONE = ERROR_BASE + 1;
+
+ /**
+ * Attempted to modify a readOnly calendar.
+ */
+ const unsigned long CAL_IS_READONLY = ERROR_BASE + 2;
+
+ /**
+ * Error while decoding an (ics) file from utf8
+ */
+ const unsigned long CAL_UTF8_DECODING_FAILED = ERROR_BASE + 3;
+
+ /**
+ * Tried to add an item to a calendar in which an item with the
+ * same ID already existed
+ */
+ const unsigned long DUPLICATE_ID = ERROR_BASE + 4;
+
+ /**
+ * Operation has been cancelled.
+ */
+ const unsigned long OPERATION_CANCELLED = ERROR_BASE + 5;
+
+ /**
+ * Creation of calendar object failed
+ */
+ const unsigned long PROVIDER_CREATION_FAILED = ERROR_BASE + 6;
+
+ /**
+ * Profile data has newer schema than we know in this calendar version.
+ */
+ const unsigned long STORAGE_UNKNOWN_SCHEMA_ERROR = ERROR_BASE + 7;
+
+ /**
+ * Profile data may refer to newer timezones than we know.
+ */
+ const unsigned long STORAGE_UNKNOWN_TIMEZONES_ERROR = ERROR_BASE + 8;
+
+ /**
+ * The calendar could not be accessed for reading.
+ */
+ const unsigned long READ_FAILED = ERROR_BASE + 9;
+
+ /**
+ * The calendar could not be accessed for modification.
+ */
+ const unsigned long MODIFICATION_FAILED = ERROR_BASE + 10;
+
+ /* ICS specific errors */
+ const unsigned long ICS_ERROR_BASE = ERROR_BASE + 0x100;
+
+ /**
+ * ICS errors, copied from icalerror.h.
+ * The numbers (minus ICS_ERROR_BASE) should match with the enum
+ * values from icalerror.h
+ */
+ const unsigned long ICS_NO_ERROR = ICS_ERROR_BASE + 0;
+ const unsigned long ICS_BADARG = ICS_ERROR_BASE + 1;
+ const unsigned long ICS_NEWFAILED = ICS_ERROR_BASE + 2;
+ const unsigned long ICS_ALLOCATION = ICS_ERROR_BASE + 3;
+ const unsigned long ICS_MALFORMEDDATA = ICS_ERROR_BASE + 4;
+ const unsigned long ICS_PARSE = ICS_ERROR_BASE + 5;
+ const unsigned long ICS_INTERNAL = ICS_ERROR_BASE + 6;
+ const unsigned long ICS_FILE = ICS_ERROR_BASE + 7;
+ const unsigned long ICS_USAGE = ICS_ERROR_BASE + 8;
+ const unsigned long ICS_UNIMPLEMENTED = ICS_ERROR_BASE + 9;
+ const unsigned long ICS_UNKNOWN = ICS_ERROR_BASE + 10;
+
+ /**
+ * Range for former WCAP provider. This could be re-used now in theory, but
+ * you might as well just add to the end.
+ * Range previously claimed is [ERROR_BASE + 0x200, ERROR_BASE + 0x300)
+ */
+ const unsigned long EX_WCAP_ERROR_BASE = ERROR_BASE + 0x200;
+
+ /**
+ * (Cal)DAV specific errors
+ * Range is [ERROR_BASE + 0x301, ERROR_BASE + 0x399]
+ */
+ const unsigned long DAV_ERROR_BASE = ERROR_BASE + 0x301;
+ const unsigned long DAV_NOT_DAV = DAV_ERROR_BASE + 0;
+ const unsigned long DAV_DAV_NOT_CALDAV = DAV_ERROR_BASE + 1;
+ const unsigned long DAV_NO_PROPS = DAV_ERROR_BASE + 2;
+ const unsigned long DAV_PUT_ERROR = DAV_ERROR_BASE + 3;
+ const unsigned long DAV_REMOVE_ERROR = DAV_ERROR_BASE + 4;
+ const unsigned long DAV_REPORT_ERROR = DAV_ERROR_BASE + 5;
+};
diff --git a/comm/calendar/base/public/calIEvent.idl b/comm/calendar/base/public/calIEvent.idl
new file mode 100644
index 0000000000..218163ec30
--- /dev/null
+++ b/comm/calendar/base/public/calIEvent.idl
@@ -0,0 +1,42 @@
+/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "calIItemBase.idl"
+
+interface calIDuration;
+
+//
+// calIEvent
+//
+// An interface for an event (analogous to a VEVENT)
+//
+
+[scriptable, uuid(5ab15c1c-e295-4d8e-a9a9-ba5bc848b59a)]
+interface calIEvent : calIItemBase
+{
+ // these attributes are marked readonly, as the calIDates are owned
+ // by the event; however, the actual calIDate objects are not read
+ // only and are intended to be manipulated to adjust dates.
+
+ /**
+ * The (inclusive) start of the event.
+ */
+ attribute calIDateTime startDate;
+
+ /**
+ * The (non-inclusive) end of the event.
+ * Note that for all-day events, non-inclusive means that this will be set
+ * to the day after the last day of the event.
+ * If startDate.isDate is set, endDate.isDate must also be set.
+ */
+ attribute calIDateTime endDate;
+
+ /**
+ * The duration of the event.
+ * equal to endDate - startDate
+ */
+ readonly attribute calIDuration duration;
+
+};
diff --git a/comm/calendar/base/public/calIFreeBusyProvider.idl b/comm/calendar/base/public/calIFreeBusyProvider.idl
new file mode 100644
index 0000000000..5215f54998
--- /dev/null
+++ b/comm/calendar/base/public/calIFreeBusyProvider.idl
@@ -0,0 +1,109 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIDateTime;
+interface calIPeriod;
+interface calIOperation;
+interface calIGenericOperationListener;
+
+[scriptable, uuid(EB24424C-DD22-4306-9379-FA098C61F5AF)]
+interface calIFreeBusyProvider : nsISupports
+{
+ /**
+ * Gets free/busy intervals.
+ * Results are notified to the passed listener interface.
+ *
+ * @param aCalId calid or MAILTO:rfc822addr
+ * @param aRangeStart start time of free-busy search
+ * @param aRangeEnd end time of free-busy search
+ * @param aBusyTypes what free-busy intervals should be returned
+ * @param aListener called with an array of calIFreeBusyInterval objects
+ * @return optional operation handle to track the operation
+ */
+ calIOperation getFreeBusyIntervals(in AUTF8String aCalId,
+ in calIDateTime aRangeStart,
+ in calIDateTime aRangeEnd,
+ in unsigned long aBusyTypes,
+ in calIGenericOperationListener aListener);
+};
+
+/**
+ * This interface reflects a free or busy interval in time.
+ * Referring to RFC 2445, section 4.2.9, for the different types.
+ */
+[scriptable, uuid(CCBEAF5E-DB87-4bc9-8BB7-24754B76BCB5)]
+interface calIFreeBusyInterval : nsISupports
+{
+ /**
+ * The calId this free-busy period belongs to.
+ */
+ readonly attribute AUTF8String calId;
+
+ /**
+ * The free-busy time interval.
+ */
+ readonly attribute calIPeriod interval;
+
+ /**
+ * The value UNKNOWN indicates that the free-busy information for the time interval is
+ * not known.
+ */
+ const unsigned long UNKNOWN = 0;
+
+ /**
+ * The value FREE indicates that the time interval is free for scheduling.
+ */
+ const unsigned long FREE = 1;
+
+ /**
+ * The value BUSY indicates that the time interval is busy because one
+ * or more events have been scheduled for that interval.
+ */
+ const unsigned long BUSY = 1 << 1;
+
+ /**
+ * The value BUSY_UNAVAILABLE indicates that the time interval is busy
+ * and that the interval can not be scheduled.
+ */
+ const unsigned long BUSY_UNAVAILABLE = 1 << 2;
+
+ /**
+ * The value BUSY_TENTATIVE indicates that the time interval is busy because
+ * one or more events have been tentatively scheduled for that interval.
+ */
+ const unsigned long BUSY_TENTATIVE = 1 << 3;
+
+ /**
+ * All BUSY* states.
+ */
+ const unsigned long BUSY_ALL = (BUSY |
+ BUSY_UNAVAILABLE |
+ BUSY_TENTATIVE);
+
+ /**
+ * One of the above types.
+ */
+ readonly attribute unsigned long freeBusyType;
+};
+
+/**
+ * This service acts as a central access point for free-busy lookup.
+ * A free-busy request will be multiplexed to all added free-busy providers.
+ * Adding a free-busy provider is transient.
+ */
+[scriptable, uuid(BE1796CF-CB53-482e-8942-D6CAA0A11BAA)]
+interface calIFreeBusyService : calIFreeBusyProvider
+{
+ /**
+ * Adds a new free-busy provider.
+ */
+ void addProvider(in calIFreeBusyProvider aProvider);
+
+ /**
+ * Removes a free-busy provider.
+ */
+ void removeProvider(in calIFreeBusyProvider aProvider);
+};
diff --git a/comm/calendar/base/public/calIICSService.idl b/comm/calendar/base/public/calIICSService.idl
new file mode 100644
index 0000000000..46d5f90320
--- /dev/null
+++ b/comm/calendar/base/public/calIICSService.idl
@@ -0,0 +1,242 @@
+/* -*- Mode: idl; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// XXX use strings for kind values instead of enumerated constants?
+
+
+#include "nsISupports.idl"
+
+interface calIItemBase;
+interface calIDateTime;
+interface calIDuration;
+interface calITimezone;
+
+interface calIIcalProperty;
+interface nsIInputStream;
+
+/**
+ * General notes:
+ *
+ * As with libical, use of getNextFoo(footype) is only valid if there have been
+ * no intervening getNextFoo(otherfootype)s, or removeFoo()s, or addFoo()s. In
+ * general, you want to do as little manipulation of your FooContainers as
+ * possible while iterating over them.
+ */
+[scriptable,uuid(59132cf2-e48c-4807-ab53-779f414a7fbc)]
+interface calIIcalComponent : nsISupports
+{
+ /**
+ * The parent ical property
+ */
+ readonly attribute calIIcalComponent parent;
+
+ /**
+ * Access to the inner ical.js objects. Only use these if you know what you
+ * are doing.
+ */
+ attribute jsval icalComponent;
+ attribute jsval icalTimezone;
+
+ /**
+ * This is the value that an integer-valued getter will provide if
+ * there is no such property on the wrapped ical structure.
+ */
+ const int32_t INVALID_VALUE = -1;
+
+ /**
+ * @param kind ANY, XROOT, VCALENDAR, VEVENT, etc.
+ */
+ calIIcalComponent getFirstSubcomponent(in AUTF8String componentType);
+ calIIcalComponent getNextSubcomponent(in AUTF8String componentType);
+
+ readonly attribute AUTF8String componentType;
+
+ attribute AUTF8String uid;
+ attribute AUTF8String prodid;
+ attribute AUTF8String version;
+
+ /**
+ * PUBLISH, REQUEST, REPLY, etc.
+ */
+ attribute AUTF8String method;
+
+ /**
+ * TENTATIVE, CONFIRMED, CANCELLED, etc.
+ */
+ attribute AUTF8String status;
+
+ attribute AUTF8String summary;
+ attribute AUTF8String description;
+ attribute AUTF8String location;
+ attribute AUTF8String categories;
+ attribute AUTF8String URL;
+
+ attribute int32_t priority;
+
+ attribute calIDateTime startTime;
+ attribute calIDateTime endTime;
+ readonly attribute calIDuration duration;
+ attribute calIDateTime dueTime;
+ attribute calIDateTime stampTime;
+
+ attribute calIDateTime createdTime;
+ attribute calIDateTime completedTime;
+ attribute calIDateTime lastModified;
+
+ /**
+ * The recurrence ID, a.k.a. DTSTART-of-calculated-occurrence,
+ * or null if this isn't an occurrence.
+ */
+ attribute calIDateTime recurrenceId;
+
+ AUTF8String serializeToICS();
+
+ /**
+ * Return a string representation of this instance.
+ */
+ AUTF8String toString();
+
+ /**
+ * Serializes this component (and subcomponents) directly to an
+ * input stream. Typically used for performance to avoid
+ * unnecessary conversions and XPConnect traversals.
+ *
+ * @result an input stream which can be read to get the serialized
+ * version of this component, encoded in UTF-8. Implements
+ * nsISeekableStream so that it can be used with
+ * nsIUploadChannel.
+ */
+ nsIInputStream serializeToICSStream();
+
+ void addSubcomponent(in calIIcalComponent comp);
+// If you add then remove a property/component, the referenced
+// timezones won't get purged out. There's currently no client code.
+// void removeSubcomponent(in calIIcalComponent comp);
+
+ /**
+ * @param kind ANY, ATTENDEE, X-WHATEVER, etc.
+ */
+ calIIcalProperty getFirstProperty(in AUTF8String kind);
+ calIIcalProperty getNextProperty(in AUTF8String kind);
+ void addProperty(in calIIcalProperty prop);
+// If you add then remove a property/component, the referenced
+// timezones won't get purged out. There's currently no client code.
+// void removeProperty(in calIIcalProperty prop);
+
+ /**
+ * Timezones need special handling, as they must be
+ * emitted as children of VCALENDAR, but can be referenced by
+ * any sub component.
+ * Adding a second timezone (of the same TZID) will remove the
+ * first one.
+ */
+ void addTimezoneReference(in calITimezone aTimezone);
+
+ /**
+ * Returns an array of VTIMEZONE components.
+ * These are the timezones that are in use by this
+ * component and its children.
+ */
+ Array<calITimezone> getReferencedTimezones();
+
+ /**
+ * Clones the component. The cloned component is decoupled from any parent.
+ * @return cloned component
+ */
+ calIIcalComponent clone();
+};
+
+[scriptable,uuid(5b13a69c-53d3-44a0-9203-f89f7e5e1604)]
+interface calIIcalProperty : nsISupports
+{
+ /**
+ * The whole property as an ical string.
+ * @exception Any error will be thrown as an calIError::ICS_ error.
+ */
+ readonly attribute AUTF8String icalString;
+
+ /**
+ * Access to the inner ical.js objects. Only use these if you know what you
+ * are doing.
+ */
+ attribute jsval icalProperty;
+
+ /**
+ * The parent component containing this property
+ */
+ readonly attribute calIIcalComponent parent;
+
+ /**
+ * Return a string representation of this instance.
+ */
+ AUTF8String toString();
+
+ /**
+ * The value of the property as string.
+ * The exception for properties of TEXT or X- type, those will be unescaped
+ * when getting, and also expects an unescaped string when setting.
+ * Datetime, numeric and other non-text types are represented as ical string
+ */
+ attribute AUTF8String value;
+
+ /**
+ * The value of the property in (escaped) ical format.
+ */
+ attribute AUTF8String valueAsIcalString;
+
+ /**
+ * The value of the property as date/datetime value, keeping
+ * track of the used timezone referenced in the owning component.
+ */
+ attribute calIDateTime valueAsDatetime;
+
+ // XXX attribute AUTF8String stringValueWithParams; ?
+ readonly attribute AUTF8String propertyName;
+
+ AUTF8String getParameter(in AUTF8String paramname);
+ void setParameter(in AUTF8String paramname, in AUTF8String paramval);
+
+ AUTF8String getFirstParameterName();
+ AUTF8String getNextParameterName();
+
+ void removeParameter(in AUTF8String paramname);
+ void clearXParameters();
+};
+
+[scriptable,uuid(eda9565f-f9bb-4846-b134-1e0653b2e767)]
+interface calIIcsComponentParsingListener : nsISupports
+{
+ /**
+ * Called when the parsing has completed.
+ *
+ * @param rc The result code of parsing
+ * @param rootComp The root ical component that was parsed
+ */
+ void onParsingComplete(in nsresult rc, in calIIcalComponent rootComp);
+};
+
+[scriptable,uuid(31e7636b-5a64-4d15-bc60-67b67cd85176)]
+interface calIICSService : nsISupports
+{
+ /**
+ * Parse an ICS string into components.
+ *
+ * @param serialized an ICS string
+ */
+ calIIcalComponent parseICS(in AUTF8String serialized);
+
+ /**
+ * Asynchronously parse an ICS string into components.
+ *
+ * @param serialized an ICS string
+ * @param listener The listener that notifies the root component
+ */
+ void parseICSAsync(in AUTF8String serialized,
+ in calIIcsComponentParsingListener listener);
+
+ calIIcalComponent createIcalComponent(in AUTF8String kind);
+ calIIcalProperty createIcalProperty(in AUTF8String kind);
+ calIIcalProperty createIcalPropertyFromString(in AUTF8String str);
+};
diff --git a/comm/calendar/base/public/calIIcsParser.idl b/comm/calendar/base/public/calIIcsParser.idl
new file mode 100644
index 0000000000..9d27edfa4b
--- /dev/null
+++ b/comm/calendar/base/public/calIIcsParser.idl
@@ -0,0 +1,81 @@
+/* -*- Mode: idl; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIIcalProperty;
+interface calIIcalComponent;
+interface calIItemBase;
+interface nsIInputStream;
+interface calIIcsParser;
+
+/**
+ * Listener being called once asynchronous parsing is done.
+ */
+[scriptable, uuid(d22527da-b0e2-41b7-b6f4-ee9c243cd285)]
+interface calIIcsParsingListener : nsISupports
+{
+ void onParsingComplete(in nsresult rc, in calIIcsParser parser);
+};
+
+/**
+ * An interface for parsing an ics string or stream into its items.
+ * Note that this is not a service. A new instance must be created for every new
+ * string or stream to be parsed.
+ */
+[scriptable, uuid(83e9befe-5e9e-49de-8bc2-d882f464f7e7)]
+interface calIIcsParser : nsISupports
+{
+ /**
+ * Parse an ics string into its items, and store top-level properties and
+ * components that are not interpreted.
+ *
+ * @param aICSString
+ * The ICS string to parse
+ * @param optional aAsyncParsing
+ * If non-null, parsing will be performed on a worker thread,
+ * and the passed listener is called when it's done
+ */
+ void parseString(in AString aICSString,
+ [optional] in calIIcsParsingListener aAsyncParsing);
+
+ /**
+ * Parse an input stream.
+ *
+ * @see parseString
+ * @param aICSString
+ * The stream to parse
+ * @param optional aAsyncParsing
+ * If non-null, parsing will be performed on a worker thread,
+ * and the passed listener is called when it's done
+ */
+ void parseFromStream(in nsIInputStream aStream,
+ [optional] in calIIcsParsingListener aAsyncParsing);
+
+ /**
+ * Get the items that were in the string or stream. In case an item represents a
+ * recurring series, the (unexpanded) parent item is returned only.
+ * Please keep in mind that any parentless items (see below) are not contained
+ * in the returned set of items.
+ */
+ Array<calIItemBase> getItems();
+
+ /**
+ * Get the parentless items that may have occurred, i.e. overridden items of a
+ * recurring series (having a RECURRENCE-ID) missing their parent item in the
+ * parsed content.
+ */
+ Array<calIItemBase> getParentlessItems();
+
+ /**
+ * Get the top-level properties that were not interpreted as anything special
+ */
+ Array<calIIcalProperty> getProperties();
+
+ /**
+ * Get the top-level components that were not interpreted as anything special
+ */
+ Array<calIIcalComponent> getComponents();
+};
diff --git a/comm/calendar/base/public/calIIcsSerializer.idl b/comm/calendar/base/public/calIIcsSerializer.idl
new file mode 100644
index 0000000000..2d81c8387c
--- /dev/null
+++ b/comm/calendar/base/public/calIIcsSerializer.idl
@@ -0,0 +1,73 @@
+/* -*- Mode: idl; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIIcalProperty;
+interface calIIcalComponent;
+interface calIItemBase;
+interface nsIOutputStream;
+interface nsIInputStream;
+
+/**
+ * An interface for serializing calendar items into an ICS string.
+ * Note that this is not a service. A new instance must be created for every new
+ * set of items to be serialized.
+ */
+[scriptable, uuid(4dcf6b4e-7322-4a61-a191-8d8cc1aea42e)]
+interface calIIcsSerializer : nsISupports
+{
+ /**
+ * Add some items to the items that are to be serialized. Can be called
+ * multiple times, and appends to the set on every call.
+ *
+ * @param aItems
+ * The items to be added
+ */
+ void addItems(in Array<calIItemBase> aItems);
+
+ /**
+ * Add a property to the top-level properties to be added on serializing. Can
+ * be called multiple times, and appends to the set on every call.
+ *
+ * @param aProperty
+ * The property to be added
+ */
+ void addProperty(in calIIcalProperty aProperty);
+
+ /**
+ * Add a component to the top-level components to be added on serializing. Can
+ * be called multiple times, and appends to the set on every call.
+ *
+ * @param aComponent
+ * The component to be added
+ */
+ void addComponent(in calIIcalComponent aComponent);
+
+ /**
+ * Serialize the added items, properties and components into an ICS string
+ *
+ * @returns
+ * A string containing the serialized items, properties and components.
+ */
+ AString serializeToString();
+
+ /**
+ * Serialize the added items, properties and components into an ICS stream
+ *
+ * @returns
+ * A stream containing the serialized items, properties and components.
+ */
+ nsIInputStream serializeToInputStream();
+
+ /**
+ * Serialize the added items, properties and components into an ICS stream
+ *
+ * @param aStream
+ * A stream into which the serialized items, properties and components
+ * will be written.
+ */
+ void serializeToStream(in nsIOutputStream aStream);
+};
diff --git a/comm/calendar/base/public/calIImportExport.idl b/comm/calendar/base/public/calIImportExport.idl
new file mode 100644
index 0000000000..1f16d351e3
--- /dev/null
+++ b/comm/calendar/base/public/calIImportExport.idl
@@ -0,0 +1,56 @@
+/* -*- Mode: IDL; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+#include "nsISupports.idl"
+
+interface calIItemBase;
+interface nsIInputStream;
+interface nsIOutputStream;
+
+[scriptable, uuid(efef8333-e995-4f45-bdf7-bfcabbd9793e)]
+interface calIFileType : nsISupports
+{
+ /**
+ * The default extension that should be associated
+ * with files of this type.
+ */
+ readonly attribute AString defaultExtension;
+
+ /**
+ * The extension filter to use in the filepicker's filter list.
+ * Separate multiple extensions with semicolon and space.
+ * For example "*.html; *.htm".
+ */
+ readonly attribute AString extensionFilter;
+
+ /**
+ * The description to show to the user in the filter list.
+ */
+ readonly attribute AString description;
+};
+
+[scriptable, uuid(dbe262ca-d6c6-4691-8d46-e7f6bbe632ec)]
+interface calIImporter : nsISupports
+{
+ Array<calIFileType> getFileTypes();
+
+ Array<calIItemBase> importFromStream(in nsIInputStream aStream);
+};
+
+[scriptable, uuid(18c75bb3-6309-4c33-903f-6055fec39d07)]
+interface calIExporter : nsISupports
+{
+ Array<calIFileType> getFileTypes();
+
+ /**
+ * Export the items into the stream
+ *
+ * @param aStream the stream to put the data into
+ * @param aItems an array of items to be exported
+ * @param aTitle a title the exporter can choose to use
+ */
+ void exportToStream(in nsIOutputStream aStream, in Array<calIItemBase> aItems, in AString aTitle);
+};
diff --git a/comm/calendar/base/public/calIItemBase.idl b/comm/calendar/base/public/calIItemBase.idl
new file mode 100644
index 0000000000..f87935b297
--- /dev/null
+++ b/comm/calendar/base/public/calIItemBase.idl
@@ -0,0 +1,372 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIVariant;
+
+interface calIItemACLEntry;
+interface calIAlarm;
+interface calIAttachment;
+interface calIAttendee;
+interface calICalendar;
+interface calIDateTime;
+interface calIDuration;
+interface calIIcalComponent;
+interface calIRecurrenceInfo;
+interface calIRelation;
+
+//
+// calIItemBase
+//
+// Base for Events, Todos, Journals, etc.
+//
+
+[scriptable, uuid(9c988b8d-af45-4046-b05e-34417bba9058)]
+interface calIItemBase : nsISupports
+{
+ // returns true if this thing is able to be modified;
+ // if the item is not mutable, attempts to modify
+ // any data will throw CAL_ERROR_ITEM_IS_IMMUTABLE
+ readonly attribute boolean isMutable;
+
+ // makes this item immutable
+ void makeImmutable();
+
+ // clone always returns a mutable event
+ calIItemBase clone();
+
+ /**
+ * Returns true if this item is an instance of calIEvent.
+ */
+ boolean isEvent();
+
+ /**
+ * Returns true if this item is an instance of calITodo.
+ */
+ boolean isTodo();
+
+ /**
+ * Hash Id that incorporates the item's UID, RECURRENCE-ID and calendar.id
+ * to be used for lookup of items that come from different calendars.
+ * Setting either id, recurrenceId or the calendar attribute leads to
+ * a recomputation of hashId.
+ *
+ * @attention Individual implementors of calIItemBase must stick to the
+ * same algorithm that base/src/calItemBase.js uses.
+ */
+ readonly attribute AUTF8String hashId;
+
+ /**
+ * Checks whether the argument object refers the same calendar item as
+ * this one, by testing both the id and recurrenceId property. This
+ *
+ * @arg aItem the item to compare against this one
+ *
+ * @return true if both ids match, false otherwise
+ */
+ boolean hasSameIds(in calIItemBase aItem);
+
+ /**
+ * Returns the acl entry associated to the item.
+ */
+ readonly attribute calIItemACLEntry aclEntry;
+
+ //
+ // the generation number of this item
+ //
+ attribute uint32_t generation;
+
+ // the time when this item was created
+ readonly attribute calIDateTime creationDate;
+
+ // last time any attribute was modified on this item, in UTC
+ readonly attribute calIDateTime lastModifiedTime;
+
+ // last time a "significant change" was made to this item
+ readonly attribute calIDateTime stampTime;
+
+ // the calICalendar to which this event belongs
+ attribute calICalendar calendar;
+
+ // the ID of this event
+ attribute AUTF8String id;
+
+ // event title
+ attribute AUTF8String title;
+
+ /**
+ * The event's description in plain text.
+ *
+ * Setting this will reset descriptionHTML.
+ */
+ attribute AUTF8String descriptionText;
+
+ /**
+ * The event's description, as HTML.
+ *
+ * The text content MUST match descriptionText but the HTML can contain
+ * formatting, links etc.
+ *
+ * Getter: If HTML was not set, the plain text will be upconverted to HTML.
+ *
+ * Setter: Setting HTML data will set descriptionText to the
+ * downconverted pretty-printed plain text.
+ */
+ attribute AUTF8String descriptionHTML;
+
+ // event priority
+ attribute short priority;
+ attribute AUTF8String privacy;
+
+ // status of the event
+ attribute AUTF8String status;
+
+ // ical interop; writing this means parsing
+ // the ical string into this event
+ attribute AUTF8String icalString;
+
+ // an icalComponent for this item, suitable for serialization.
+ // the icalComponent returned is not live: changes in it or this
+ // item will not be reflected in the other.
+ attribute calIIcalComponent icalComponent;
+
+ //
+ // alarms
+ //
+
+ /**
+ * Get all alarms assigned to this item
+ *
+ * @param aAlarms The array of calIAlarms
+ */
+ Array<calIAlarm> getAlarms();
+
+ /**
+ * Add an alarm to the item
+ *
+ * @param aAlarm The calIAlarm to add
+ */
+ void addAlarm(in calIAlarm aAlarm);
+
+ /**
+ * Delete an alarm from the item
+ *
+ * @param aAlarm The calIAlarm to delete
+ */
+ void deleteAlarm(in calIAlarm aAlarm);
+
+ /**
+ * Clear all alarms from the item
+ */
+ void clearAlarms();
+
+ // The last time this alarm was fired and acknowledged by the user; coerced to UTC.
+ attribute calIDateTime alarmLastAck;
+
+ //
+ // recurrence
+ //
+ attribute calIRecurrenceInfo recurrenceInfo;
+ readonly attribute calIDateTime recurrenceStartDate;
+
+ //
+ // All event properties are stored in a property bag;
+ // some number of these are "promoted" to top-level
+ // accessor attributes. For example, "SUMMARY" is
+ // promoted to the top-level "title" attribute.
+ //
+ // If you use the has/get/set/deleteProperty
+ // methods, property names are case-insensitive.
+ //
+ // For purposes of ICS serialization, all property names in
+ // the hashbag are in uppercase.
+ //
+ // The isPropertyPromoted() attribute can will indicate
+ // if a particular property is promoted or not, for
+ // serialization purposes.
+ //
+
+ // Note that if this item is a proxy, then any requests for
+ // non-existent properties will be forward to the parent item.
+
+ // some other properties that may exist:
+ //
+ // 'description' - description (string)
+ // 'location' - location (string)
+ // 'categories' - categories (string)
+ // 'syncId' - sync id (string)
+ // 'inviteEmailAddress' - string
+ // alarmLength/alarmUnits/alarmEmailAddress/lastAlarmAck
+ // recurInterval/recurCount/recurWeekdays/recurWeeknumber
+
+ // these forward to an internal property bag; implemented here, so we can
+ // do access control on set/delete to have control over mutability.
+ // Each inner array has two elements: a string and a nsIVariant.
+ readonly attribute Array<Array<jsval> > properties;
+ boolean hasProperty(in AString name);
+
+ /**
+ * Gets a particular property.
+ * Objects passed back are still owned by the item, e.g. if callers need to
+ * store or modify a calIDateTime they must clone it.
+ */
+ nsIVariant getProperty(in AString name);
+
+ /**
+ * Sets a particular property.
+ * Ownership of objects gets passed to the item, e.g. callers must not
+ * modify a calIDateTime after it's been passed to an item.
+ *
+ * @warning this reflects the current implementation
+ * xxx todo: rethink whether it's more sensible to store
+ * clones in calItemBase.
+ */
+ void setProperty(in AString name, in nsIVariant value);
+
+ // will not throw an error if you delete a property that doesn't exist
+ void deleteProperty(in AString name);
+
+ // returns true if the given property is promoted to some
+ // top-level attribute (e.g. id or title)
+ boolean isPropertyPromoted(in AString name);
+
+ /**
+ * Returns a particular parameter value for a property, or null if the
+ * parameter does not exist. If the property does not exist, throws.
+ *
+ * @param aPropertyName the name of the property
+ * @param aParameterName the name of the parameter on the property
+ */
+ AString getPropertyParameter(in AString aPropertyName,
+ in AString aParameterName);
+
+ /**
+ * Checks if the given property has the given parameter.
+ *
+ * @param aPropertyName The name of the property.
+ * @param aParameterName The name of the parameter on the property.
+ * @return True, if the parameter exists on the property
+ */
+ boolean hasPropertyParameter(in AString aPropertyName,
+ in AString aParameterName);
+
+ /**
+ * Sets a particular parameter value for a property, or unsets if null is
+ * passed. If the property does not exist, throws.
+ *
+ * @param aPropertyName The name of the property
+ * @param aParameterName The name of the parameter on the property
+ * @param aParameterValue The value of the parameter to set
+ */
+ void setPropertyParameter(in AString aPropertyName,
+ in AString aParameterName,
+ in AUTF8String aParameterValue);
+
+ /**
+ * Returns the names of all the parameters set on the given property.
+ *
+ * @param aPropertyName {AString} The name of the property.
+ * @return {Array<AString} The parameter names.
+ */
+ Array<AString> getParameterNames(in AString aPropertyName);
+
+ /**
+ * The organizer (originator) of the item. We will likely not
+ * honour or preserve all fields in the calIAttendee passed around here.
+ * A base class like calIPerson might be more appropriate here, if we ever
+ * grow one.
+ */
+ attribute calIAttendee organizer;
+
+ //
+ // Attendees
+ //
+
+ // The array returned here is not live; it will not reflect calls to
+ // removeAttendee/addAttendee that follow the call to getAttendees.
+ Array<calIAttendee> getAttendees();
+
+ /**
+ * getAttendeeById's matching is done in a case-insensitive manner to handle
+ * places where "MAILTO:" or similar properties are capitalized arbitrarily
+ * by different calendar clients.
+ */
+ calIAttendee getAttendeeById(in AUTF8String id);
+ void addAttendee(in calIAttendee attendee);
+ void removeAttendee(in calIAttendee attendee);
+ void removeAllAttendees();
+
+ //
+ // Attachments
+ //
+ Array<calIAttachment> getAttachments();
+ void addAttachment(in calIAttachment attachment);
+ void removeAttachment(in calIAttachment attachment);
+ void removeAllAttachments();
+
+ //
+ // Categories
+ //
+
+ /**
+ * Gets the array of categories this item belongs to.
+ */
+ Array<AString> getCategories();
+
+ /**
+ * Sets the array of categories this item belongs to.
+ */
+ void setCategories(in Array<AString> aCategories);
+
+ //
+ // Relations
+ //
+
+ /**
+ * This gives back every relation where the item is neither the owner of the
+ * relation nor the referred relation
+ */
+ Array<calIRelation> getRelations();
+
+ /**
+ * Adds a relation to the item
+ */
+ void addRelation(in calIRelation relation);
+
+ /**
+ * Removes the relation for this item and the referred item
+ */
+ void removeRelation(in calIRelation relation);
+
+ /**
+ * Removes every relation for this item (in this items and also where it is referred
+ */
+ void removeAllRelations();
+
+ // Occurrence querying
+ //
+
+ /**
+ * Return a list of occurrences of this item between the given dates. The items
+ * returned are the same type as this one, as proxies.
+ */
+ Array<calIItemBase> getOccurrencesBetween(in calIDateTime aStartDate, in calIDateTime aEndDate);
+
+ /**
+ * If this item is a proxy or overridden item, parentItem will point upwards
+ * to our parent. Otherwise, it will point to this.
+ * parentItem can thus always be used for modifyItem() calls
+ * to providers.
+ */
+ attribute calIItemBase parentItem;
+
+ /**
+ * The recurrence ID, a.k.a. DTSTART-of-calculated-occurrence,
+ * or null if this isn't an occurrence.
+ * Be conservative about setting this. It isn't marked as such, but
+ * consider it as readonly.
+ */
+ attribute calIDateTime recurrenceId;
+};
diff --git a/comm/calendar/base/public/calIItipItem.idl b/comm/calendar/base/public/calIItipItem.idl
new file mode 100644
index 0000000000..acb6683f1f
--- /dev/null
+++ b/comm/calendar/base/public/calIItipItem.idl
@@ -0,0 +1,112 @@
+/* -*- Mode: idl; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIItemBase;
+interface calICalendar;
+
+/**
+ * calIItipItem is an interface used to carry information between the mime
+ * parser, the imip-bar UI, and the iTIP processor. It encapsulates a list of
+ * calIItemBase objects and provides specialized iTIP methods for those items.
+ */
+[scriptable, uuid(7539c158-c30d-41d0-90e9-41d315ac3eb1)]
+interface calIItipItem : nsISupports
+{
+ /**
+ * Initializes the item with an ics string
+ * @param - in parameter - AString of ical Data
+ */
+ void init(in AUTF8String icalData);
+
+ /**
+ * Creates a new calItipItem with the same attributes as the one that
+ * clone() is called upon.
+ */
+ calIItipItem clone();
+
+ /**
+ * Attribute: isSend - set to TRUE when sending this item to initiate an
+ * iMIP communication. This will be used by the iTIP processor to route
+ * the item directly to the email subsystem so that communication can be
+ * initiated. For example, if you are Sending a REQUEST, you would set
+ * this flag, and send the iTIP Item into the iTIP processor, which would
+ * handle everything else.
+ */
+ attribute boolean isSend;
+
+ /**
+ * Attribute: sender - set to the email address of the sender if part of an
+ * iMIP communication.
+ */
+ attribute AUTF8String sender;
+
+ /**
+ * Attribute: receivedMethod - method the iTIP item had upon receipt
+ */
+ attribute AUTF8String receivedMethod;
+
+ /**
+ * Attribute: responseMethod - method that the protocol handler (or the
+ * user) decides to use to respond to the iTIP item (could be COUNTER,
+ * REPLY, DECLINECOUNTER, etc)
+ */
+ attribute AUTF8String responseMethod;
+
+ /**
+ * Attribute: autoResponse Set to one of the three constants below
+ */
+ attribute unsigned long autoResponse;
+
+ /**
+ * Used to tell the iTIP processor to use an automatic response when
+ * handling this iTIP item
+ */
+ const unsigned long AUTO = 0;
+
+ /**
+ * Used to tell the iTIP processor to allow the user to edit the response
+ */
+ const unsigned long USER = 1;
+
+ /**
+ * Used to tell the iTIP processor not to respond at all.
+ */
+ const unsigned long NONE = 2;
+
+ /**
+ * Attribute: targetCalendar - the calendar that this thing should be
+ * stored in, if it should be stored onto a calendar.
+ */
+ attribute calICalendar targetCalendar;
+
+ /**
+ * The identity this item was received on. Helps to determine which
+ * attendee to manipulate. This should be the full email address of the
+ * attendee that is considered to be the local user.
+ */
+ attribute AUTF8String identity;
+
+ /**
+ * localStatus: The response that the user has made to the invitation in
+ * this ItipItem.
+ */
+ attribute AUTF8String localStatus;
+
+ /**
+ * Get the list of items that are encapsulated in this calIItipItem
+ * @returns An array of calIItemBase items that are inside this
+ * calIItipItem
+ */
+ Array<calIItemBase> getItemList();
+
+ /**
+ * Modifies the state of the given attendee in the item's ics
+ * @param attendeeId - AString containing attendee address
+ * @param status - AString containing the new attendee status
+ */
+ void setAttendeeStatus(in AString attendeeId, in AString status);
+};
diff --git a/comm/calendar/base/public/calIItipTransport.idl b/comm/calendar/base/public/calIItipTransport.idl
new file mode 100644
index 0000000000..72f6b7b63d
--- /dev/null
+++ b/comm/calendar/base/public/calIItipTransport.idl
@@ -0,0 +1,48 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIItipItem;
+interface calIAttendee;
+interface calIDateTime;
+
+/**
+ * calIItipTransport is a generic transport interface that is implemented
+ * by transports (eg: email, XMPP, etc.) wishing to send calIItipItems
+ */
+[scriptable, uuid(caedabb9-d886-4814-ada5-a5636d2fb939)]
+interface calIItipTransport : nsISupports
+{
+ /**
+ * Scheme to be used to prefix attendees. For example, the Email transport
+ * should return "mailto".
+ */
+ readonly attribute AUTF8String scheme;
+
+ /**
+ * Sending identity. This can be set to change the "sender" identity from
+ * defaultIdentity above.
+ */
+ attribute AUTF8String senderAddress;
+
+ /**
+ * Type of the transport: email, xmpp, etc.
+ */
+ readonly attribute AUTF8String type;
+
+ /**
+ * Sends a calIItipItem to the recipients using the specified title and
+ * alternative representation. If a calIItipItem is attached, then an ICS
+ * representation of those objects are generated and attached to the email.
+ * If the calIItipItem is null, then the item(s) is sent without any
+ * text/calendar mime part.
+ * @param recipientArray array of recipients
+ * @param calIItipItem set of calIItems encapsulated as calIItipItems
+ * @param sender the attendee the calIItipItem is coming from.
+ */
+ boolean sendItems(in Array<calIAttendee> recipientArray,
+ in calIItipItem item,
+ in calIAttendee sender);
+};
diff --git a/comm/calendar/base/public/calIOperation.idl b/comm/calendar/base/public/calIOperation.idl
new file mode 100644
index 0000000000..92f3e8bb8d
--- /dev/null
+++ b/comm/calendar/base/public/calIOperation.idl
@@ -0,0 +1,46 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIVariant.idl"
+
+[scriptable, uuid(B96C2997-7AAA-4619-AD48-B7EBD9236C93)]
+interface calIOperation : nsISupports
+{
+ /**
+ * Id for easy management of pending requests.
+ */
+ readonly attribute AUTF8String id;
+
+ /**
+ * Determines whether the request is pending, i.e. has not been completed.
+ */
+ readonly attribute boolean isPending;
+
+ /**
+ * Status of the request, e.g. NS_OK while pending or after successful
+ * completion, or NS_ERROR_FAILED when failed.
+ */
+ readonly attribute nsIVariant status;
+
+ /**
+ * Cancels a pending request and changes status.
+ * @param aStatus operation status to be set;
+ * defaults to calIErrors.OPERATION_CANCELLED if null
+ */
+ void cancel([optional] in nsIVariant aStatus);
+};
+
+[scriptable, uuid(1FA39726-63D2-440c-A464-296D2822B9DA)]
+interface calIGenericOperationListener : nsISupports
+{
+ /**
+ * Generic callback receiving result.
+ * Results may appear in multiple calls, i.e. callees have to collect
+ * until isPending is false.
+ *
+ * @param aOperation operation object
+ * @param aResult result or null in case of an error
+ */
+ void onResult(in calIOperation aOperation, in nsIVariant aResult);
+};
diff --git a/comm/calendar/base/public/calIPeriod.idl b/comm/calendar/base/public/calIPeriod.idl
new file mode 100644
index 0000000000..d11f0ebdb3
--- /dev/null
+++ b/comm/calendar/base/public/calIPeriod.idl
@@ -0,0 +1,58 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIDateTime;
+interface calIDuration;
+
+[scriptable,uuid(ace2a74c-bd08-476f-be8b-6565abc50339)]
+interface calIPeriod : nsISupports
+{
+ attribute jsval icalPeriod;
+
+ /**
+ * isMutable is true if this instance is modifiable.
+ * If isMutable is false, any attempts to modify
+ * the object will throw NS_ERROR_OBJECT_IS_IMMUTABLE.
+ */
+ readonly attribute boolean isMutable;
+
+ /**
+ * Make this calIPeriod instance immutable.
+ */
+ void makeImmutable();
+
+ /**
+ * Clone this calIPeriod instance into a new
+ * mutable object.
+ */
+ calIPeriod clone();
+
+ /**
+ * The start datetime of this period
+ */
+ attribute calIDateTime start;
+
+ /**
+ * The end datetime of this period
+ */
+ attribute calIDateTime end;
+
+ /**
+ * The duration, equal to end-start
+ */
+ readonly attribute calIDuration duration;
+
+
+ /**
+ * Return a string representation of this instance.
+ */
+ AUTF8String toString();
+
+ /**
+ * This object as an iCalendar DURATION string
+ */
+ attribute ACString icalString;
+};
diff --git a/comm/calendar/base/public/calIRecurrenceDate.idl b/comm/calendar/base/public/calIRecurrenceDate.idl
new file mode 100644
index 0000000000..33f1d4b482
--- /dev/null
+++ b/comm/calendar/base/public/calIRecurrenceDate.idl
@@ -0,0 +1,24 @@
+/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+#include "calIRecurrenceItem.idl"
+
+interface calIItemBase;
+interface calIDateTime;
+
+interface calIIcalProperty;
+
+// an interface implementing a RDATE or EXDATE
+
+[scriptable, uuid(c5b331d4-b470-475b-9497-db9e2731e559)]
+interface calIRecurrenceDate : calIRecurrenceItem
+{
+ //
+ // recurrence date set
+ //
+ attribute calIDateTime date;
+};
diff --git a/comm/calendar/base/public/calIRecurrenceInfo.idl b/comm/calendar/base/public/calIRecurrenceInfo.idl
new file mode 100644
index 0000000000..0e21298c47
--- /dev/null
+++ b/comm/calendar/base/public/calIRecurrenceInfo.idl
@@ -0,0 +1,184 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIItemBase;
+interface calIDateTime;
+
+interface calIRecurrenceItem;
+
+interface calIIcalProperty;
+
+[scriptable, uuid(8ca5db89-2583-4f0c-b845-4a6d2f229efd)]
+interface calIRecurrenceInfo : nsISupports
+{
+ // returns true if this thing is able to be modified;
+ // if the item is not mutable, attempts to modify
+ // any data will throw CAL_ERROR_ITEM_IS_IMMUTABLE
+ readonly attribute boolean isMutable;
+
+ // makes this item immutable
+ void makeImmutable();
+
+ // clone always returns a mutable event
+ calIRecurrenceInfo clone();
+
+ // initialize this with the item for which this recurrence
+ // applies, so that the start date can be tracked
+ attribute calIItemBase item;
+
+ /**
+ * The start date of an item is directly referenced by parts of calIRecurrenceInfo,
+ * thus changing the former without adjusting the latter would break the internal structure.
+ * This method provides the necessary functionality. There's no need to call it manually
+ * after writing to the start date of an item, since it's called automatically in the
+ * appropriate setter of an item.
+ */
+ void onStartDateChange(in calIDateTime aNewStartTime, in calIDateTime aOldStartTime);
+
+ /**
+ * If the base item's UID changes, this implicitly has to change all overridden items' UID, too.
+ *
+ * @param id new UID
+ */
+ void onIdChange(in AUTF8String aNewId);
+
+ /**
+ * The end point of the last occurrence, to avoid calculating occurrences for
+ * items that have finished recurring. If the object is mutable, or the
+ * recurrence is not finite, this value is the maximum possible PRTime.
+ */
+ readonly attribute PRTime recurrenceEndDate;
+
+ Array<calIRecurrenceItem> getRecurrenceItems();
+ /**
+ * Set of recurrence items; the order of these matters.
+ */
+ void setRecurrenceItems(in Array<calIRecurrenceItem> aItems);
+
+ unsigned long countRecurrenceItems();
+ void clearRecurrenceItems();
+ void appendRecurrenceItem(in calIRecurrenceItem aItem);
+
+ calIRecurrenceItem getRecurrenceItemAt(in unsigned long aIndex);
+ void deleteRecurrenceItemAt(in unsigned long aIndex);
+ void deleteRecurrenceItem(in calIRecurrenceItem aItem);
+ // inserts the item at the given index, pushing the item that was previously there forward
+ void insertRecurrenceItemAt(in calIRecurrenceItem aItem, in unsigned long aIndex);
+
+ /**
+ * isFinite is true if the recurrence items specify a finite number
+ * of occurrences. This is useful for UI and for possibly other users.
+ */
+ readonly attribute boolean isFinite;
+
+ /**
+ * This is a shortcut to appending or removing a single negative date
+ * assertion. aRecurrenceId needs to be a normal recurrence id, it may not be
+ * RDATE.
+ */
+ void removeOccurrenceAt(in calIDateTime aRecurrenceId);
+ void restoreOccurrenceAt(in calIDateTime aRecurrenceId);
+
+ /*
+ * exceptions
+ */
+
+ /**
+ * Modify an a particular occurrence with the given exception proxy
+ * item. If the recurrenceId isn't an already existing exception item,
+ * a new exception is added. Otherwise, the existing exception
+ * is modified.
+ *
+ * The item's parentItem must be equal to this RecurrenceInfo's
+ * item. <-- XXX check this, compare by calendar/id only
+ *
+ * @param anItem exceptional/overridden item
+ * @param aTakeOverOwnership whether the recurrence info object can take over
+ * the item or needs to clone it
+ */
+ void modifyException(in calIItemBase anItem, in boolean aTakeOverOwnership);
+
+ /**
+ * Return an existing exception item for the given recurrence ID.
+ * If an exception does not exist, null is returned.
+ */
+ calIItemBase getExceptionFor(in calIDateTime aRecurrenceId);
+
+ /**
+ * Removes an exception item for the given recurrence ID, if
+ * any exist.
+ */
+ void removeExceptionFor(in calIDateTime aRecurrenceId);
+
+ /**
+ * Returns a list of all recurrence ids that have exceptions.
+ */
+ Array<calIDateTime> getExceptionIds();
+
+ /*
+ * Recurrence calculation
+ */
+
+ /*
+ * Get the occurrence at the given recurrence ID; if there is no
+ * exception, then create a new proxy object with the normal occurrence.
+ * Otherwise, return the exception.
+ *
+ * @param aRecurrenceId The recurrence ID to get the occurrence for.
+ * @return The occurrence or exception corresponding to the id
+ */
+ calIItemBase getOccurrenceFor(in calIDateTime aRecurrenceId);
+
+ /**
+ * Return the chronologically next occurrence after aTime. This takes
+ * exceptions and EXDATE/RDATEs into account.
+ *
+ * @param aTime The (exclusive) date to start searching.
+ * @return The next occurrence, or null if there is none.
+ */
+ calIItemBase getNextOccurrence(in calIDateTime aTime);
+
+ /**
+ * Return the chronologically previous occurrence after aTime. This takes
+ * exceptions and EXDATE/RDATEs into account.
+ *
+ * @param aTime The (exclusive) date to start searching.
+ * @return The previous occurrence, or null if there is none.
+ */
+ calIItemBase getPreviousOccurrence(in calIDateTime aTime);
+
+ /**
+ * Return an array of calIDateTime representing all start times of this event
+ * between start (inclusive) and end (non-inclusive). Exceptions are taken
+ * into account.
+ *
+ * @param aRangeStart The (inclusive) date to start searching.
+ * @param aRangeEnd The (exclusive) date to end searching.
+ * @param aMaxCount The maximum number of dates to return
+ *
+ * @param aCount The number of dates returned.
+ * @return The array of dates.
+ */
+ Array<calIDateTime> getOccurrenceDates(in calIDateTime aRangeStart,
+ in calIDateTime aRangeEnd,
+ in unsigned long aMaxCount);
+
+ /**
+ * Return an array of calIItemBase representing all occurrences of this event
+ * between start (inclusive) and end (non-inclusive). Exceptions are taken
+ * into account.
+ *
+ * @param aRangeStart The (inclusive) date to start searching.
+ * @param aRangeEnd The (exclusive) date to end searching.
+ * @param aMaxCount The maximum number of occurrences to return
+ *
+ * @param aCount The number of occurrences returned.
+ * @return The array of occurrences.
+ */
+ Array<calIItemBase> getOccurrences(in calIDateTime aRangeStart,
+ in calIDateTime aRangeEnd,
+ in unsigned long aMaxCount);
+};
diff --git a/comm/calendar/base/public/calIRecurrenceItem.idl b/comm/calendar/base/public/calIRecurrenceItem.idl
new file mode 100644
index 0000000000..9e2b83dadb
--- /dev/null
+++ b/comm/calendar/base/public/calIRecurrenceItem.idl
@@ -0,0 +1,60 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIItemBase;
+interface calIDateTime;
+
+interface calIIcalProperty;
+
+[scriptable, uuid(918a243b-d887-41b0-8b4b-9cd56a9dd55f)]
+interface calIRecurrenceItem : nsISupports
+{
+ // returns true if this thing is able to be modified;
+ // if the item is not mutable, attempts to modify
+ // any data will throw CAL_ERROR_ITEM_IS_IMMUTABLE
+ readonly attribute boolean isMutable;
+
+ // makes this item immutable
+ void makeImmutable();
+
+ // clone always returns a mutable event
+ calIRecurrenceItem clone();
+
+ // defaults to false; if true, this item is to be interpreted
+ // as a negative rule (e.g. exceptions instead of rdates)
+ attribute boolean isNegative;
+
+ // returns whether this item has a finite number of dates
+ // or not (e.g. a rule with no end date)
+ readonly attribute boolean isFinite;
+
+ /**
+ * Search for the next occurrence after aTime and return its recurrence id.
+ * aRecurrenceId must be the recurrence id of an occurrence to search after.
+ * If this item has an unsupported FREQ value ("SECONDLY" or "MINUTELY"), null
+ * is returned.
+ *
+ * @require (aTime >= aRecurrenceId)
+ * @param aRecurrenceId The recurrence id to start searching at.
+ * @param aTime The earliest time to find the occurrence after.
+ */
+ calIDateTime getNextOccurrence(in calIDateTime aRecurrenceId,
+ in calIDateTime aTime);
+
+ /**
+ * Return an array of calIDateTime of the start of all occurrences of
+ * this event starting at aStartTime, between rangeStart and an
+ * optional rangeEnd. If this item has an unsupported FREQ value ("SECONDLY"
+ * or "MINUTELY"), an empty array is returned.
+ */
+ Array<calIDateTime> getOccurrences(in calIDateTime aStartTime,
+ in calIDateTime aRangeStart,
+ in calIDateTime aRangeEnd,
+ in unsigned long aMaxCount);
+
+ attribute calIIcalProperty icalProperty;
+ attribute AUTF8String icalString;
+};
diff --git a/comm/calendar/base/public/calIRecurrenceRule.idl b/comm/calendar/base/public/calIRecurrenceRule.idl
new file mode 100644
index 0000000000..8694036a8c
--- /dev/null
+++ b/comm/calendar/base/public/calIRecurrenceRule.idl
@@ -0,0 +1,53 @@
+/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+#include "calIRecurrenceItem.idl"
+
+interface calIItemBase;
+interface calIDateTime;
+
+// an interface implementing a RRULE
+
+[scriptable, uuid(e965a91a-49fa-41b5-b668-1a824a73bdbf)]
+interface calIRecurrenceRule : calIRecurrenceItem
+{
+ //
+ // rule-based recurrence
+ //
+
+ // null/"", "SECONDLY", "MINUTELY", "HOURLY", "DAILY", "WEEKLY",
+ // "MONTHLY", "YEARLY"
+ attribute AUTF8String type;
+
+ // repeat every N of type
+ attribute long interval;
+
+ // These two are mutually exclusive; whichever is set
+ // invalidates the other. It's only valid to read the one
+ // that was set; the other will throw NS_ERROR_FAILURE. Use
+ // isByCount to figure out whether count or untilDate is valid.
+ // Setting count to -1 or untilDate to null indicates infinite
+ // recurrence.
+ attribute long count;
+ attribute calIDateTime untilDate;
+
+ // if this isn't infinite recurrence, this flag indicates whether
+ // it was set by count or not
+ readonly attribute boolean isByCount;
+
+ // The week start for this rule, used for certain calculations. This is a
+ // value from 0=Sunday to 6=Saturday.
+ attribute short weekStart;
+
+ // the components defining the recurrence
+ // "BYSECOND", "BYMINUTE", "BYHOUR", "BYDAY",
+ // "BYMONTHDAY", "BYYEARDAY", "BYWEEKNO", "BYMONTH",
+ // "BYSETPOS"
+ Array<short> getComponent (in AUTF8String aComponentType);
+ void setComponent (in AUTF8String aComponentType, in Array<short> aValues);
+
+};
diff --git a/comm/calendar/base/public/calIRelation.idl b/comm/calendar/base/public/calIRelation.idl
new file mode 100644
index 0000000000..ee73dc9aaa
--- /dev/null
+++ b/comm/calendar/base/public/calIRelation.idl
@@ -0,0 +1,45 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIIcalProperty;
+interface calIItemBase;
+
+[scriptable,uuid(77f0820a-2b49-4c8e-86bf-2b6bda46e391)]
+interface calIRelation : nsISupports
+{
+ /**
+ * The type of the relation between the items:
+ * PARENT
+ * CHILD
+ * SIBLING
+ */
+ attribute AUTF8String relType;
+
+ /**
+ * The id of the related item
+ **/
+
+ attribute AUTF8String relId;
+
+ /**
+ * The calIIcalProperty corresponding to this object. Can be used for
+ * serializing/unserializing from ics files.
+ */
+ attribute calIIcalProperty icalProperty;
+ attribute AUTF8String icalString;
+
+ /**
+ * For accessing additional parameters, such as x-params.
+ */
+ AUTF8String getParameter(in AString name);
+ void setParameter(in AString name, in AUTF8String value);
+ void deleteParameter(in AString name);
+
+ /**
+ * Clone this calIRelation instance into a new object.
+ */
+ calIRelation clone();
+};
diff --git a/comm/calendar/base/public/calISchedulingSupport.idl b/comm/calendar/base/public/calISchedulingSupport.idl
new file mode 100644
index 0000000000..123ca35192
--- /dev/null
+++ b/comm/calendar/base/public/calISchedulingSupport.idl
@@ -0,0 +1,47 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+interface calIItemBase;
+interface calIAttendee;
+
+/**
+ * Accesses scheduling specific information of calendar items.
+ * Implementation by providers is optional.
+ */
+[scriptable, uuid(9221e243-c97e-4c5f-9e00-5d7d3521bb44)]
+interface calISchedulingSupport : nsISupports
+{
+ /**
+ * Tests whether the passed item corresponds to an invitation, e.g.
+ * the CUA or server has placed it in the calendar.
+ *
+ * @param aItem Item to be tested.
+ * @return Whether the passed item corresponds to an invitation.
+ */
+ boolean isInvitation(in calIItemBase aItem);
+
+ /**
+ * Gets the invited attendee if the passed item corresponds to
+ * an invitation. UI code will use that attendee to modify e.g. PARTSTAT.
+ * If isInvitation returns true, getInvitedAttendee must return
+ * an attendee. If isInvitation is false, getInvitedAttendee may return
+ * an attendee in case the organizer (and owner of the calendar) has
+ * invited himself.
+ *
+ * @param aItem Invitation item.
+ * @return Attendee object, or null.
+ */
+ calIAttendee getInvitedAttendee(in calIItemBase aItem);
+
+ /**
+ * Checks whether the provider keeps track of sending out the proper
+ * iTIP/iMIP message for a particular item.
+ *
+ * @param aMethod a iTIP method
+ * @param aItem an item that has been modified/deleted etc.
+ * @return true, if the provider keeps track of sending out passed message
+ */
+ boolean canNotify(in AUTF8String aMethod, in calIItemBase aItem);
+};
diff --git a/comm/calendar/base/public/calIStartupService.idl b/comm/calendar/base/public/calIStartupService.idl
new file mode 100644
index 0000000000..c387bf5a4b
--- /dev/null
+++ b/comm/calendar/base/public/calIStartupService.idl
@@ -0,0 +1,30 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+#include "calIOperation.idl"
+
+/**
+ * Interface that can be used on services that need to be started up and shut
+ * down. The service needs to be registered within calStartupService.js, so this
+ * is only useful from within calendar code. If you want calendar code to be
+ * fully initialized, listen to "calendar-startup-done" via nsIObserverService.
+ */
+[scriptable, uuid(99d52094-37f9-4c81-9c55-32fbeb6a79cf)]
+interface calIStartupService: nsISupports
+{
+ /**
+ * Function called when the service should be started
+ *
+ * @param completeListener The listener to call on startup completion.
+ */
+ void startup(in calIGenericOperationListener completeListener);
+
+ /**
+ * Function called when the service should be shut down.
+ *
+ * @param completeListener The listener to call on shutdown completion.
+ */
+ void shutdown(in calIGenericOperationListener completeListener);
+};
diff --git a/comm/calendar/base/public/calIStatusObserver.idl b/comm/calendar/base/public/calIStatusObserver.idl
new file mode 100644
index 0000000000..2dc48e14c4
--- /dev/null
+++ b/comm/calendar/base/public/calIStatusObserver.idl
@@ -0,0 +1,60 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+interface calICalendar;
+interface nsIDOMChromeWindow;
+
+[scriptable, uuid(60160f68-4514-41b4-a19d-2f2cf0143426)]
+interface calIStatusObserver : nsISupports
+{
+
+ void initialize(in nsIDOMChromeWindow aWindow);
+
+ /**
+ * Starts the display of an operation to check a series of calendars
+ * This operation may either be determined or undetermined
+ * @param aProgressMode An integer value that can accept DETERMINED_PROGRESS,
+ * UNDETERMINED_PROGRESS or NO_PROGRESS
+ * @param aCalendarsCount If the first parameter is DETERMINED_PROGRESS
+ * aCalendarCount is the number of Calendars
+ * which completion is to be displayed
+ */
+ void startMeteors(in unsigned long aProgressMode, in unsigned long aCalendarCount);
+
+ /**
+ * stops the display of an progressed operation
+ */
+ void stopMeteors();
+
+ /**
+ * increments the display value denoting that a calendar has been processed
+ */
+ void calendarCompleted(in calICalendar aCalendar);
+
+ /**
+ * @return An integer value denoting whether a progress is running or not;
+ * if it returns DETERMINED_PROGRESS a determined progress
+ is running;
+ * if it returns UNDETERMINED_PROGRESS an undetermined progress
+ is running;
+ * if it returns NO_PROGRESS no Progress is running.
+ */
+ readonly attribute unsigned long spinning;
+
+ /**
+ * A constant that denotes that no operation is running
+ */
+ const unsigned long NO_PROGRESS = 0;
+
+ /**
+ * A constant that refers to whether an operation is determined
+ */
+ const unsigned long DETERMINED_PROGRESS = 1;
+
+ /**
+ * A constant that refers to whether an operation is undetermined
+ */
+ const unsigned long UNDETERMINED_PROGRESS = 2;
+};
diff --git a/comm/calendar/base/public/calITimezone.idl b/comm/calendar/base/public/calITimezone.idl
new file mode 100644
index 0000000000..a6d6135abd
--- /dev/null
+++ b/comm/calendar/base/public/calITimezone.idl
@@ -0,0 +1,43 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIIcalComponent;
+
+[scriptable, uuid(d79161e7-0db9-427d-a0c3-27e0db3b030f)]
+interface calITimezone : nsISupports
+{
+ /**
+ * VTIMEZONE ical component, null if floating or UTC.
+ */
+ readonly attribute calIIcalComponent icalComponent;
+
+ /**
+ * The TZID of this timezone.
+ */
+ readonly attribute AUTF8String tzid;
+
+ /**
+ * Whether this timezone is the "floating" timezone.
+ */
+ readonly attribute boolean isFloating;
+
+ /**
+ * Whether this is the "UTC" timezone.
+ */
+ readonly attribute boolean isUTC;
+
+ /**
+ * Localized name of the timezone; falls back to TZID if unknown.
+ */
+ readonly attribute AString displayName;
+
+ /**
+ * For debugging purposes.
+ *
+ * @return "UTC", "floating" or component's ical representation
+ */
+ AUTF8String toString();
+};
diff --git a/comm/calendar/base/public/calITimezoneDatabase.idl b/comm/calendar/base/public/calITimezoneDatabase.idl
new file mode 100644
index 0000000000..6c9d0c0505
--- /dev/null
+++ b/comm/calendar/base/public/calITimezoneDatabase.idl
@@ -0,0 +1,37 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+/**
+ * Provides access to raw iCalendar timezone definitions. Intended for providing
+ * a backing database for a calITimezoneService; most consumers will want to use
+ * calITimezoneService instead.
+ */
+[scriptable, uuid(dcace7e1-9600-47ba-a27e-b3bc8222192a)]
+interface calITimezoneDatabase : nsISupports
+{
+ /**
+ * The version of the IANA Time Zone Database provided.
+ */
+ readonly attribute AUTF8String version;
+
+ /**
+ * Get all supported canonical timezone IDs. This does not include link
+ * timezone IDs and should only be used to provide users with a list of
+ * timezones they may select, not to restrict supported timezone values.
+ *
+ * @return a list of supported canonical timezone IDs
+ */
+ Array<AUTF8String> getCanonicalTimezoneIds();
+
+ /**
+ * Get an iCalendar timezone definition by timezone ID.
+ *
+ * @param tzid timezone ID for which to return definition
+ * @return a string containing an ical VTIMEZONE definition, or
+ * the empty string if the timezone ID is not recognized
+ */
+ AUTF8String getTimezoneDefinition(in AUTF8String tzid);
+};
diff --git a/comm/calendar/base/public/calITimezoneService.idl b/comm/calendar/base/public/calITimezoneService.idl
new file mode 100644
index 0000000000..6c7ef24112
--- /dev/null
+++ b/comm/calendar/base/public/calITimezoneService.idl
@@ -0,0 +1,50 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calITimezone;
+
+/**
+ * Provides access to timezone definitions from the IANA Time Zone Database.
+ */
+[scriptable, uuid(ab1bfe6a-ee95-4038-b594-34aeeda9911a)]
+interface calITimezoneService : nsISupports
+{
+ /**
+ * All canonical timezone IDs provided by the current IANA Time Zone
+ * Database; intended to provide a list of selectable timezones, not to
+ * restrict the list of valid timezones.
+ */
+ readonly attribute Array<AUTF8String> timezoneIds;
+
+ /**
+ * The version of the IANA Time Zone Database provided.
+ */
+ readonly attribute AUTF8String version;
+
+ /**
+ * Get a timezone definition by timezone ID.
+ *
+ * @param tzid timezone ID for which to return definition
+ * @return a timezone object, or null if ID is not recognized
+ */
+ calITimezone getTimezone(in AUTF8String tzid);
+
+ /**
+ * The definition for the "floating" timezone, in which times are relative
+ * to local time.
+ */
+ readonly attribute calITimezone floating;
+
+ /**
+ * The timezone definition for Coordinated Universal Time.
+ */
+ readonly attribute calITimezone UTC;
+
+ /**
+ * Returns the current default timezone for calendars/events.
+ */
+ readonly attribute calITimezone defaultTimezone;
+};
diff --git a/comm/calendar/base/public/calITodo.idl b/comm/calendar/base/public/calITodo.idl
new file mode 100644
index 0000000000..1ed322829d
--- /dev/null
+++ b/comm/calendar/base/public/calITodo.idl
@@ -0,0 +1,72 @@
+/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "calIItemBase.idl"
+
+//
+// calITodo
+//
+// An interface for a todo item (analogous to a VTODO)
+//
+
+[scriptable, uuid(0a93fdad-8a5c-44e9-8f90-16a6df819e03)]
+interface calITodo : calIItemBase
+{
+ const long CAL_TODO_STATUS_NEEDSACTION = 4;
+ const long CAL_TODO_STATUS_COMPLETED = 5;
+ const long CAL_TODO_STATUS_INPROCESS = 6;
+
+ // as per the rather broken RFC2445,
+
+ // entryDate maps to DTSTART, which is the day
+ // this todo shows up on, if set. (optional).
+ //
+ // dueDate maps to DUE, which is the day
+ // this todo is due, if set. (optional).
+ //
+ // If neither DUE nor DTSTART are set, then
+ // the todo appears "today" until it is completed.
+ //
+ // The completeDate is the date the todo was completed,
+ // or null if it hasn't been completed yet.
+
+ attribute calIDateTime entryDate;
+ attribute calIDateTime dueDate;
+ attribute calIDateTime completedDate;
+ attribute short percentComplete;
+
+ // A todo isCompleted if any of the following is true:
+ // - percentComplete is 100, or
+ // - completedDate is non-null, or
+ // - status is COMPLETED.
+ // Setting isCompleted to true will
+ // - set percentComplete to 100, and
+ // - set completedDate to the current time, if it is not already set, and
+ // - set status to COMPLETED.
+ // Setting isCompleted to false will remove percentComplete, completedDate,
+ // and status properties. (This returns the todo to its state at creation,
+ // in terms of completion-relevant properties.)
+ //
+ // If you would like to take advantage of the full, confusing disaster that
+ // is the RFC2445 VTODO status state space, you can feel free to set the
+ // fields individually, instead of setting isCompleted directly. (And then
+ // hope that whatever else you're talking to has the same set of rules for
+ // determining if something is completed or not.)
+ //
+ // Setting percentComplete, completedDate, or status individually does not
+ // affect any of the others at present. (E.g., setting the percentComplete
+ // from 100 to 50 doesn't clear completedDate, or change status to
+ // IN-PROCESS.) It's not clear that we want any more magic than a simple
+ // property to control "all complete" vs "not complete in any way".
+ attribute boolean isCompleted;
+
+ /**
+ * The duration of the todo, which is either set or defined as
+ * dueDate - entryDate.
+ * Please note that null is returned if there is no duration set and entry
+ * Date or dueDate don't exist.
+ */
+ attribute calIDuration duration;
+};
diff --git a/comm/calendar/base/public/calIWeekInfoService.idl b/comm/calendar/base/public/calIWeekInfoService.idl
new file mode 100644
index 0000000000..c688579418
--- /dev/null
+++ b/comm/calendar/base/public/calIWeekInfoService.idl
@@ -0,0 +1,50 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface calIDateTime;
+
+/**
+ * This interface will calculate a week title from a given datetime. This
+ * will depends on the users preferences.
+ * Extensions might override the default implementation, in order to
+ * generate week titles aimed at special cases (like weeknumbers for a
+ * schoolyear)
+ */
+[scriptable, uuid(650fd33b-ebf4-46fa-b9ca-dd80b2451498)]
+interface calIWeekInfoService: nsISupports
+{
+ /**
+ * Return the week title. It's meant to be displayed.
+ * (Usually, will return a weeknumber, but might return a string like Q1W4)
+ *
+ * @param dateTime
+ * The dateTime to get the weektitle for
+ * @returns
+ * A string, representing the week title. Will usually be the
+ * week number. Every week (7 days) should get a different string,
+ * but the switch from one week to the next isn't necessarily
+ * on sunday.
+ */
+ AString getWeekTitle(in calIDateTime dateTime);
+
+ /**
+ * Gets the first day of a week of a passed day under consideration
+ * of the preference setting "calendar.week.start"
+ *
+ * @param aDate The dateTime to get get the start of the week for
+ * @return A dateTime-object denoting the first day of the week
+ */
+ calIDateTime getStartOfWeek(in calIDateTime dateTime);
+
+ /**
+ * Gets the last day of a week of a passed day under consideration
+ * of the preference setting "calendar.week.start"
+ *
+ * @param aDate The dateTime to get get the last day of the week for
+ * @return A dateTime-object denoting the last day of the week
+ */
+ calIDateTime getEndOfWeek(in calIDateTime dateTime);
+};
diff --git a/comm/calendar/base/public/moz.build b/comm/calendar/base/public/moz.build
new file mode 100644
index 0000000000..8879b4e63b
--- /dev/null
+++ b/comm/calendar/base/public/moz.build
@@ -0,0 +1,56 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+XPIDL_SOURCES += [
+ "calIAlarm.idl",
+ "calIAlarmService.idl",
+ "calIAttachment.idl",
+ "calIAttendee.idl",
+ "calICalendar.idl",
+ "calICalendarACLManager.idl",
+ "calICalendarManager.idl",
+ "calICalendarProvider.idl",
+ "calICalendarView.idl",
+ "calICalendarViewController.idl",
+ "calIChangeLog.idl",
+ "calIDateTime.idl",
+ "calIDeletedItems.idl",
+ "calIDuration.idl",
+ "calIErrors.idl",
+ "calIEvent.idl",
+ "calIFreeBusyProvider.idl",
+ "calIIcsParser.idl",
+ "calIIcsSerializer.idl",
+ "calIICSService.idl",
+ "calIImportExport.idl",
+ "calIItemBase.idl",
+ "calIItipItem.idl",
+ "calIItipTransport.idl",
+ "calIOperation.idl",
+ "calIPeriod.idl",
+ "calIRecurrenceDate.idl",
+ "calIRecurrenceInfo.idl",
+ "calIRecurrenceItem.idl",
+ "calIRecurrenceRule.idl",
+ "calIRelation.idl",
+ "calISchedulingSupport.idl",
+ "calIStartupService.idl",
+ "calIStatusObserver.idl",
+ "calITimezone.idl",
+ "calITimezoneDatabase.idl",
+ "calITimezoneService.idl",
+ "calITodo.idl",
+ "calIWeekInfoService.idl",
+]
+
+XPIDL_MODULE = "calbase"
+
+EXPORTS += []
+
+with Files("**"):
+ BUG_COMPONENT = ("Calendar", "Internal Components")
+
+with Files("calIAlarm*"):
+ BUG_COMPONENT = ("Calendar", "Alarms")