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

260 строки
8.1 KiB
Plaintext

/* -*- Mode: idl; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** 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>
*
* 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;
interface nsIMutableArray;
interface nsISimpleEnumerator;
interface nsIVariant;
interface nsIPropertyBag;
interface calICalendar;
interface calIDateTime;
interface calIRecurrenceInfo;
interface calIAttendee;
interface calIIcalComponent;
//
// calIItemBase
//
// Base for Events, Todos, Journals, etc.
//
[scriptable, uuid(18521d75-346d-4616-8778-de2c4a9a676e)]
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();
//
// the generation number of this item; 0 means
// that it's never been stored in a store
//
readonly attribute PRUint32 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;
// indicate such a "significant change"
void updateStampTime();
// the calICalendar to which this event belongs
attribute calICalendar calendar;
// the ID of this event
attribute AUTF8String id;
// event title
attribute AUTF8String title;
// 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; alarmTime is null if there is no
// alarm set.
//
attribute calIDateTime alarmTime;
//
// recurrence
//
attribute calIRecurrenceInfo recurrenceInfo;
attribute calIDateTime recurrenceStartDate;
// attachments
// array of nsIMsgAttachment
// if this item is mutable, the returned array will be a nsIMutableArray
readonly attribute nsIArray attachments;
//
// 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.
//
// 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-existant 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.
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);
/**
* 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);
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);
/**
* The next occurrence after this one, if any.
*/
readonly attribute calIItemBase nextOccurrence;
/**
* The previous occurrence before this one, if any.
*/
readonly attribute calIItemBase previousOccurrence;
//
// proxy support
//
/**
* create a proxy for this item; the returned item
* proxy will have parentItem set to this instance.
*/
calIItemBase createProxy();
/**
* 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;
/**
* The recurrence ID, a.k.a. DTSTART-of-calculated-occurrence,
* or null if this isn't an occurrence.
*/
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;
};