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

224 строки
7.8 KiB
Plaintext
Исходник Обычный вид История

2004-11-22 23:24:13 +03:00
/* -*- Mode: idl; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** 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):
* Mike Shaver <shaver@off.net>
*
* 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 ***** */
// XXX use strings for kind values instead of enumerated constants?
2004-11-22 23:24:13 +03:00
#include "nsISupports.idl"
interface calIItemBase;
interface calIDateTime;
2004-11-22 23:24:13 +03:00
interface calIIcalProperty;
interface nsIUTF8StringEnumerator;
interface nsIInputStream;
[ptr] native icalpropertyptr(struct icalproperty_impl);
[ptr] native icalcomponentptr(struct icalcomponent_impl);
/**
* 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(c4637c40-3c4c-4ecd-b802-8b5b46bdf5a4)]
2004-11-22 23:24:13 +03:00
interface calIIcalComponent : nsISupports
{
/**
* This is the value that an integer-valued getter will provide if
* there is no such property on the wrapped ical structure.
*/
const PRInt32 INVALID_VALUE = -1;
/**
* @param kind ANY, XROOT, VCALENDAR, VEVENT, etc.
*/
calIIcalComponent getFirstSubcomponent(in AUTF8String componentType);
calIIcalComponent getNextSubcomponent(in AUTF8String componentType);
readonly attribute AUTF8String componentType;
2004-11-22 23:24:13 +03:00
attribute AUTF8String uid;
attribute AUTF8String prodid;
attribute AUTF8String version;
2004-11-22 23:24:13 +03:00
/**
* PUBLISH, REQUEST, REPLY, etc.
*/
attribute AUTF8String method;
/**
* TENTATIVE, CONFIRMED, CANCELLED, etc.
*/
attribute AUTF8String status;
/**
* OPAQUE, TRANSPARENT, etc.
*/
attribute AUTF8String transp;
2004-11-22 23:24:13 +03:00
attribute AUTF8String summary;
attribute AUTF8String description;
attribute AUTF8String location;
attribute AUTF8String categories;
2004-11-23 23:11:28 +03:00
attribute AUTF8String URL;
2004-11-22 23:24:13 +03:00
attribute PRInt32 priority;
2004-11-22 23:24:13 +03:00
/**
* PUBLIC, PRIVATE, CONFIDENTIAL, etc.
*/
attribute AUTF8String icalClass;
attribute calIDateTime startTime;
attribute calIDateTime endTime;
attribute calIDateTime dueTime;
attribute calIDateTime stampTime;
attribute calIDateTime createdTime;
attribute calIDateTime completedTime;
attribute calIDateTime lastModified;
2004-11-24 02:24:36 +03:00
AUTF8String serializeToICS();
/**
* 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);
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);
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. The components this expects to receive
* are VCALENDAR components with a single VTIMEZONE child.
* Adding the same TZID twice will cause the second and later
* adds to be ignored. Appropriate calIIcalComponents can
* be obtained via the calIICSService.
*/
void addTimezoneReference(in calIIcalComponent aTimezone);
/**
* Returns an array of VCALENDAR components, each with a single
* VTIMEZONE. These are the timezones that are in use by this
* component and its children. Child timezones are only added
* at addSubcomponent time.
*/
void getReferencedTimezones(out PRUint32 aCount,
[array,size_is(aCount),retval] out calIIcalComponent aTimezones);
[noscript,notxpcom] icalcomponentptr getIcalComponent();
};
[scriptable,uuid(17349a10-5d80-47fa-9bea-f22957357675)]
interface calIIcalProperty : nsISupports
{
/**
* 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;
// 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();
/**
* This does not work with X-PARAMETERS, due to limitations in libical.
* You have to use clearXParameters() and then rebuild the ones you wanted
* to preserve. Sorry about that.
*/
void removeParameter(in AUTF8String paramname);
void clearXParameters();
[noscript,notxpcom] icalpropertyptr getIcalProperty();
2004-11-22 23:24:13 +03:00
};
[scriptable,uuid(c788a1dc-0929-4029-9a14-e1bc654eafad)]
interface calIICSService : nsISupports
{
calIIcalComponent parseICS(in AUTF8String serialized);
calIIcalComponent createIcalComponent(in AUTF8String kind);
calIIcalProperty createIcalProperty(in AUTF8String kind);
/* I wish I could write this function atop libical!
boolean isLegalParameterValue(in AUTF8String paramKind,
in AUTF8String paramValue);
*/
/* Return a calIIcalComponent for the given timezone. Note that
* the component returned is a VCALENDAR with a VTIMEZONE child,
* not the VTIMEZONE itself.
*/
calIIcalComponent getTimezone(in AUTF8String tzid);
AUTF8String getTimezoneLatitude(in AUTF8String tzid);
AUTF8String getTimezoneLongitude(in AUTF8String tzid);
readonly attribute nsIUTF8StringEnumerator timezoneIds;
2004-11-22 23:24:13 +03:00
};