Memos Component - submitted by Nathan Owens.
[platform/upstream/evolution-data-server.git] / calendar / libecal / e-cal.h
1 /* Evolution calendar ecal
2  *
3  * Copyright (C) 2001 Ximian, Inc.
4  * Copyright (C) 2004 Novell, Inc.
5  *
6  * Authors: Federico Mena-Quintero <federico@ximian.com>
7  *          Rodrigo Moya <rodrigo@novell.com>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of version 2 of the GNU Lesser General Public
11  * License as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef E_CAL_H
24 #define E_CAL_H
25
26 #include <glib-object.h>
27 #include <libedataserver/e-source-list.h>
28 #include <libedataserver/e-source.h>
29 #include <libecal/e-cal-recur.h>
30 #include <libecal/e-cal-util.h>
31 #include <libecal/e-cal-view.h>
32 #include <libecal/e-cal-types.h>
33
34 G_BEGIN_DECLS
35
36 \f
37
38 #define E_TYPE_CAL            (e_cal_get_type ())
39 #define E_CAL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL, ECal))
40 #define E_CAL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL, ECalClass))
41 #define E_IS_CAL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL))
42 #define E_IS_CAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL))
43
44 #define E_CAL_SET_MODE_STATUS_ENUM_TYPE (e_cal_set_mode_status_enum_get_type ())
45 #define CAL_MODE_ENUM_TYPE                   (cal_mode_enum_get_type ())
46
47 typedef struct _ECal ECal;
48 typedef struct _ECalClass ECalClass;
49 typedef struct _ECalPrivate ECalPrivate;
50
51 typedef enum {
52         E_CAL_SOURCE_TYPE_EVENT,
53         E_CAL_SOURCE_TYPE_TODO,
54         E_CAL_SOURCE_TYPE_JOURNAL,
55         E_CAL_SOURCE_TYPE_LAST
56 } ECalSourceType;
57
58 /* Set mode status for the e_cal_set_mode function */
59 typedef enum {
60         E_CAL_SET_MODE_SUCCESS,
61         E_CAL_SET_MODE_ERROR,
62         E_CAL_SET_MODE_NOT_SUPPORTED
63 } ECalSetModeStatus;
64
65 /* Whether the ecal is not loaded, is being loaded, or is already loaded */
66 typedef enum {
67         E_CAL_LOAD_NOT_LOADED,
68         E_CAL_LOAD_AUTHENTICATING,
69         E_CAL_LOAD_LOADING,
70         E_CAL_LOAD_LOADED
71 } ECalLoadState;
72
73 struct _ECal {
74         GObject object;
75
76         /*< private >*/
77         ECalPrivate *priv;
78 };
79
80 struct _ECalClass {
81         GObjectClass parent_class;
82
83         /* Notification signals */
84
85         void (* cal_opened) (ECal *ecal, ECalendarStatus status);
86         void (* cal_set_mode) (ECal *ecal, ECalSetModeStatus status, CalMode mode);     
87
88         void (* backend_error) (ECal *ecal, const char *message);
89         void (* backend_died) (ECal *ecal);
90 };
91
92 typedef char * (* ECalAuthFunc) (ECal *ecal,
93                                  const char *prompt,
94                                  const char *key,
95                                  gpointer user_data);
96
97 GType e_cal_get_type (void);
98
99 GType e_cal_open_status_enum_get_type (void);
100 GType e_cal_set_mode_status_enum_get_type (void);
101 GType cal_mode_enum_get_type (void);
102
103 ECal *e_cal_new (ESource *source, ECalSourceType type);
104 ECal *e_cal_new_from_uri (const gchar *uri, ECalSourceType type);
105 ECal *e_cal_new_system_calendar (void);
106 ECal *e_cal_new_system_tasks (void);
107 ECal *e_cal_new_system_memos (void);
108
109 void e_cal_set_auth_func (ECal *ecal, ECalAuthFunc func, gpointer data);
110
111 gboolean e_cal_open (ECal *ecal, gboolean only_if_exists, GError **error);
112 void e_cal_open_async (ECal *ecal, gboolean only_if_exists);
113 gboolean e_cal_remove (ECal *ecal, GError **error);
114
115 GList *e_cal_uri_list (ECal *ecal, CalMode mode);
116
117 ECalSourceType e_cal_get_source_type (ECal *ecal);
118 ECalLoadState e_cal_get_load_state (ECal *ecal);
119
120 ESource *e_cal_get_source (ECal *ecal);
121 const char *e_cal_get_uri (ECal *ecal);
122
123 gboolean e_cal_is_read_only (ECal *ecal, gboolean *read_only, GError **error);
124 gboolean e_cal_get_cal_address (ECal *ecal, char **cal_address, GError **error);
125 gboolean e_cal_get_alarm_email_address (ECal *ecal, char **alarm_address, GError **error);
126 gboolean e_cal_get_ldap_attribute (ECal *ecal, char **ldap_attribute, GError **error);
127
128 gboolean e_cal_get_one_alarm_only (ECal *ecal);
129 gboolean e_cal_get_organizer_must_attend (ECal *ecal);
130 gboolean e_cal_get_save_schedules (ECal *ecal);
131 gboolean e_cal_get_static_capability (ECal *ecal, const char *cap);
132 gboolean e_cal_get_organizer_must_accept (ECal *ecal);
133
134 gboolean e_cal_set_mode (ECal *ecal, CalMode mode);
135
136 gboolean e_cal_get_default_object (ECal *ecal,
137                                    icalcomponent **icalcomp, GError **error);
138
139 gboolean e_cal_get_object (ECal *ecal,
140                            const char *uid,
141                            const char *rid,
142                            icalcomponent **icalcomp,
143                            GError **error);
144 gboolean e_cal_get_objects_for_uid (ECal *ecal,
145                                     const char *uid,
146                                     GList **objects,
147                                     GError **error);
148
149 gboolean e_cal_get_changes (ECal *ecal, const char *change_id, GList **changes, GError **error);
150 void e_cal_free_change_list (GList *list);
151
152 gboolean e_cal_get_object_list (ECal *ecal, const char *query, GList **objects, GError **error);
153 gboolean e_cal_get_object_list_as_comp (ECal *ecal, const char *query, GList **objects, GError **error);
154 void e_cal_free_object_list (GList *objects);
155
156 gboolean e_cal_get_free_busy (ECal *ecal, GList *users, time_t start, time_t end, 
157                               GList **freebusy, GError **error);
158
159 void e_cal_generate_instances (ECal *ecal, time_t start, time_t end,
160                                ECalRecurInstanceFn cb, gpointer cb_data);
161 void e_cal_generate_instances_for_object (ECal *ecal, icalcomponent *icalcomp,
162                                           time_t start, time_t end,
163                                           ECalRecurInstanceFn cb, gpointer cb_data);
164
165 GSList *e_cal_get_alarms_in_range (ECal *ecal, time_t start, time_t end);
166
167 void e_cal_free_alarms (GSList *comp_alarms);
168
169 gboolean e_cal_get_alarms_for_object (ECal *ecal, const ECalComponentId *id,
170                                       time_t start, time_t end,
171                                       ECalComponentAlarms **alarms);
172
173 gboolean e_cal_create_object (ECal *ecal, icalcomponent *icalcomp, char **uid, GError **error);
174 gboolean e_cal_modify_object (ECal *ecal, icalcomponent *icalcomp, CalObjModType mod, GError **error);
175 gboolean e_cal_remove_object (ECal *ecal, const char *uid, GError **error);
176 gboolean e_cal_remove_object_with_mod (ECal *ecal, const char *uid, const char *rid, CalObjModType mod, GError **error);
177
178 gboolean e_cal_discard_alarm (ECal *ecal, ECalComponent *comp, const char *auid, GError **error);
179
180 gboolean e_cal_receive_objects (ECal *ecal, icalcomponent *icalcomp, GError **error);
181 gboolean e_cal_send_objects (ECal *ecal, icalcomponent *icalcomp, GList **users, icalcomponent **modified_icalcomp, GError **error);
182
183 gboolean e_cal_get_timezone (ECal *ecal, const char *tzid, icaltimezone **zone, GError **error);
184 gboolean e_cal_add_timezone (ECal *ecal, icaltimezone *izone, GError **error);
185 /* Sets the default timezone to use to resolve DATE and floating DATE-TIME
186    values. This will typically be from the user's timezone setting. Call this
187    before using any other functions. It will pass the default timezone on to
188    the server. Returns TRUE on success. */
189 gboolean e_cal_set_default_timezone (ECal *ecal, icaltimezone *zone, GError **error);
190
191 gboolean e_cal_get_query (ECal *ecal, const char *sexp, ECalView **query, GError **error);
192
193 /* Resolves TZIDs for the recurrence generator. */
194 icaltimezone *e_cal_resolve_tzid_cb (const char *tzid, gpointer data);
195
196 /* Returns a complete VCALENDAR for a VEVENT/VTODO including all VTIMEZONEs
197    used by the component. It also includes a 'METHOD:PUBLISH' property. */
198 char* e_cal_get_component_as_string (ECal *ecal, icalcomponent *icalcomp);
199
200 const char * e_cal_get_error_message (ECalendarStatus status);
201
202 /* Calendar/Tasks Discovery */
203 gboolean    e_cal_open_default (ECal **ecal, ECalSourceType type, ECalAuthFunc func, gpointer data, GError **error);
204 gboolean    e_cal_set_default (ECal  *ecal, GError **error);
205 gboolean    e_cal_set_default_source (ESource *source, ECalSourceType type, GError **error);
206 gboolean    e_cal_get_sources (ESourceList **sources, ECalSourceType type, GError **error);
207 const char * e_cal_get_local_attachment_store (ECal *ecal);
208 gboolean e_cal_get_recurrences_no_master (ECal *ecal);
209 gboolean e_cal_get_attachments_for_comp (ECal *ecal, const char *uid, const char *rid, GSList **list, GError **error);
210
211 G_END_DECLS
212
213 #endif