gecko-dev/calendar/base/public/calIItemBase.idl

314 lines
9.8 KiB
Plaintext
Raw Normal View History

/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2004-10-26 21:27:59 +00:00
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Oracle Corporation code.
*
* The Initial Developer of the Original Code is
* Oracle Corporation
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir.vukicevic@oracle.com>
* Mike Shaver <shaver@mozilla.org>
2004-10-26 21:27:59 +00:00
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIArray;
2004-11-03 21:48:23 +00:00
interface nsIMutableArray;
interface nsISimpleEnumerator;
interface nsIVariant;
interface nsIPropertyBag;
2004-10-26 21:27:59 +00:00
interface calICalendar;
interface calIDateTime;
interface calIDuration;
interface calIRecurrenceInfo;
2004-10-26 21:27:59 +00:00
interface calIAttendee;
interface calIIcalComponent;
2004-10-26 21:27:59 +00:00
//
// calIItemBase
//
// Base for Events, Todos, Journals, etc.
//
[scriptable, uuid(18521d75-346d-4616-8778-de2c4a9a676e)]
2004-11-03 21:48:23 +00:00
interface calIItemBase : nsISupports
2004-10-26 21:27:59 +00:00
{
// 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();
/**
* 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);
//
// the generation number of this item; 0 means
// that it's never been stored in a store
//
readonly attribute PRUint32 generation;
2004-10-26 21:27:59 +00:00
// 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;
2004-10-26 21:27:59 +00:00
// last time a "significant change" was made to this item
readonly attribute calIDateTime stampTime;
// indicate such a "significant change"
void updateStampTime();
2004-10-26 21:27:59 +00:00
// the calICalendar to which this event belongs
attribute calICalendar calendar;
2004-10-26 21:27:59 +00:00
// the ID of this event
attribute AUTF8String id;
// event title
attribute AUTF8String title;
// event priority
attribute short priority;
attribute AUTF8String privacy;
2004-10-26 21:27:59 +00:00
// status of the event
attribute AUTF8String status;
2004-10-26 21:27:59 +00:00
// 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;
2004-10-26 21:27:59 +00:00
//
// alarms
2004-10-26 21:27:59 +00:00
//
/**
* The amount of time from the date (specified by alarmRelated) to offset
* the alarm's firing time by
*/
attribute calIDuration alarmOffset;
/**
* One of the ALARM_RELATED constants below.
*/
attribute unsigned long alarmRelated;
/**
* Corresponds to an alarmOffset that should be based off of the startDate or
* entryDate (for events and tasks, respectively)
*/
const unsigned long ALARM_RELATED_START = 0;
/**
* Corresponds to an alarmOffset that should be based off of the endDate or
* dueDate (for events and tasks, respectively)
*/
const unsigned long ALARM_RELATED_END = 1;
// The last time this alarm was fired and acknowledged by the user
attribute calIDateTime alarmLastAck;
2004-10-26 21:27:59 +00:00
//
// recurrence
//
attribute calIRecurrenceInfo recurrenceInfo;
readonly attribute calIDateTime recurrenceStartDate;
2004-10-26 21:27:59 +00:00
// attachments
// array of nsIMsgAttachment
// if this item is mutable, the returned array will be a nsIMutableArray
readonly attribute nsIArray attachments;
2004-10-26 21:27:59 +00:00
//
// 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.
2004-10-26 21:27:59 +00:00
//
// If you use the has/get/getUnproxied/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.
2004-10-26 21:27:59 +00:00
//
// Note that if this item is a proxy, then any requests for
// non-existant properties will be forward to the parent item.
// some other properties that may exist:
//
2004-10-26 21:27:59 +00:00
// '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.
readonly attribute nsISimpleEnumerator propertyEnumerator;
boolean hasProperty(in AString name);
nsIVariant getProperty(in AString name);
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);
/**
* 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.
void getAttendees(out PRUint32 count,
[array,size_is(count),retval] out calIAttendee attendees);
calIAttendee getAttendeeById(in AUTF8String id);
void removeAttendee(in calIAttendee attendee);
void addAttendee(in calIAttendee attendee);
2004-12-14 00:44:21 +00:00
void removeAllAttendees();
//
// 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.
*/
void getOccurrencesBetween (in calIDateTime aStartDate, in calIDateTime aEndDate,
out PRUint32 aCount,
[array,size_is(aCount),retval] out calIItemBase aOccurrences);
2004-10-26 21:27:59 +00:00
/**
* The next occurrence after this one, if any.
*/
readonly attribute calIItemBase nextOccurrence;
2004-10-26 21:27:59 +00:00
/**
* The previous occurrence before this one, if any.
*/
readonly attribute calIItemBase previousOccurrence;
2004-10-26 21:27:59 +00:00
//
// proxy support
2004-10-26 21:27:59 +00:00
//
/**
* create a proxy for this item; the returned item
* proxy will have parentItem set to this instance.
*/
calIItemBase createProxy();
2005-04-24 10:52:27 +00:00
/**
* If this item is a proxy, 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;
2004-10-26 21:27:59 +00:00
/**
* 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;
/**
* Returns the given property value if it is natively set on the item,
* otherwise returns null.
*/
nsIVariant getUnproxiedProperty(in AString name);
/**
* An enumerator that lets us walk down the list of properties
* that are actually changed by this proxy from the base. If this
* item is not a proxy, then this list will be equivalent to the one
* returned from propertyEnumerator.
*
* The elements returned by the enumerator will be of type nsIProperty,
* as with a normal nsIPropertyBag enumerator.
*/
readonly attribute nsISimpleEnumerator unproxiedPropertyEnumerator;
};