1 /* Evolution calendar utilities and types 2 * 3 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) 4 * 5 * This library is free software: you can redistribute it and/or modify it 6 * under the terms of the GNU Lesser General Public License as published by 7 * the Free Software Foundation. 8 * 9 * This library is distributed in the hope that it will be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 12 * for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public License 15 * along with this library. If not, see <http://www.gnu.org/licenses/>. 16 * 17 * Authors: Federico Mena-Quintero <federico@ximian.com> 18 */ 19 20 #if !defined (__LIBECAL_H_INSIDE__) && !defined (LIBECAL_COMPILATION) 21 #error "Only <libecal/libecal.h> should be included directly." 22 #endif 23 24 #ifndef E_CAL_UTIL_H 25 #define E_CAL_UTIL_H 26 27 #include <libical-glib/libical-glib.h> 28 #include <time.h> 29 #include <libedataserver/libedataserver.h> 30 #include <libecal/e-cal-component.h> 31 #include <libecal/e-cal-recur.h> 32 #include <libecal/e-cal-enums.h> 33 34 G_BEGIN_DECLS 35 36 /* The static capabilities to be supported by backends */ 37 #define E_CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT "no-alarm-repeat" 38 #define E_CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS "no-audio-alarms" 39 #define E_CAL_STATIC_CAPABILITY_NO_DISPLAY_ALARMS "no-display-alarms" 40 #define E_CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS "no-email-alarms" 41 #define E_CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS "no-procedure-alarms" 42 #define E_CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT "no-task-assignment" 43 #define E_CAL_STATIC_CAPABILITY_NO_THISANDFUTURE "no-thisandfuture" 44 #define E_CAL_STATIC_CAPABILITY_NO_THISANDPRIOR "no-thisandprior" 45 #define E_CAL_STATIC_CAPABILITY_NO_TRANSPARENCY "no-transparency" 46 47 /** 48 * E_CAL_STATIC_CAPABILITY_MEMO_START_DATE: 49 * 50 * Flag indicating that the backend does not support memo's start date 51 * 52 * Since: 3.12 53 */ 54 #define E_CAL_STATIC_CAPABILITY_NO_MEMO_START_DATE "no-memo-start-date" 55 56 /** 57 * E_CAL_STATIC_CAPABILITY_ALARM_DESCRIPTION: 58 * 59 * Flag indicating that the backend supports alarm description 60 * 61 * Since: 3.8 62 */ 63 #define E_CAL_STATIC_CAPABILITY_ALARM_DESCRIPTION "alarm-description" 64 65 /** 66 * E_CAL_STATIC_CAPABILITY_NO_ALARM_AFTER_START: 67 * 68 * Flag indicating that the backend does not support alarm after start the event 69 * 70 * Since: 3.8 71 */ 72 #define E_CAL_STATIC_CAPABILITY_NO_ALARM_AFTER_START "no-alarm-after-start" 73 74 /** 75 * E_CAL_STATIC_CAPABILITY_BULK_ADDS: 76 * 77 * Flag indicating that the backend supports bulk additions. 78 * 79 * Since: 3.6 80 */ 81 #define E_CAL_STATIC_CAPABILITY_BULK_ADDS "bulk-adds" 82 83 /** 84 * E_CAL_STATIC_CAPABILITY_BULK_MODIFIES: 85 * 86 * Flag indicating that the backend supports bulk modifications. 87 * 88 * Since: 3.6 89 */ 90 #define E_CAL_STATIC_CAPABILITY_BULK_MODIFIES "bulk-modifies" 91 92 /** 93 * E_CAL_STATIC_CAPABILITY_BULK_REMOVES: 94 * 95 * Flag indicating that the backend supports bulk removals. 96 * 97 * Since: 3.6 98 */ 99 #define E_CAL_STATIC_CAPABILITY_BULK_REMOVES "bulk-removes" 100 101 /** 102 * E_CAL_STATIC_CAPABILITY_REMOVE_ONLY_THIS: 103 * 104 * FIXME: Document me. 105 * 106 * Since: 3.2 107 **/ 108 #define E_CAL_STATIC_CAPABILITY_REMOVE_ONLY_THIS "remove-only-this" 109 110 #define E_CAL_STATIC_CAPABILITY_ONE_ALARM_ONLY "one-alarm-only" 111 #define E_CAL_STATIC_CAPABILITY_ORGANIZER_MUST_ATTEND "organizer-must-attend" 112 #define E_CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS "organizer-not-email-address" 113 #define E_CAL_STATIC_CAPABILITY_REMOVE_ALARMS "remove-alarms" 114 115 /** 116 * E_CAL_STATIC_CAPABILITY_CREATE_MESSAGES: 117 * 118 * Since: 2.26 119 **/ 120 #define E_CAL_STATIC_CAPABILITY_CREATE_MESSAGES "create-messages" 121 122 #define E_CAL_STATIC_CAPABILITY_SAVE_SCHEDULES "save-schedules" 123 #define E_CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK "no-conv-to-assign-task" 124 #define E_CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR "no-conv-to-recur" 125 #define E_CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS "no-general-options" 126 #define E_CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS "require-send-options" 127 #define E_CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER "recurrences-no-master-object" 128 #define E_CAL_STATIC_CAPABILITY_ORGANIZER_MUST_ACCEPT "organizer-must-accept" 129 #define E_CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED "delegate-support" 130 #define E_CAL_STATIC_CAPABILITY_NO_ORGANIZER "no-organizer" 131 #define E_CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY "delegate-to-many" 132 #define E_CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING "has-unaccepted-meeting" 133 134 /** 135 * E_CAL_STATIC_CAPABILITY_REFRESH_SUPPORTED: 136 * 137 * Since: 2.30 138 **/ 139 #define E_CAL_STATIC_CAPABILITY_REFRESH_SUPPORTED "refresh-supported" 140 141 /** 142 * E_CAL_STATIC_CAPABILITY_ALL_DAY_EVENT_AS_TIME: 143 * 144 * Let the client know that it should store All Day event times as time 145 * with a time zone, rather than as a date. 146 * 147 * Since: 3.18 148 **/ 149 #define E_CAL_STATIC_CAPABILITY_ALL_DAY_EVENT_AS_TIME "all-day-event-as-time" 150 151 /** 152 * E_CAL_STATIC_CAPABILITY_TASK_DATE_ONLY: 153 * 154 * Let the client know that the Task Start date, Due date and Completed date 155 * can be entered only as dates. When the capability is not set, then these 156 * can be date and time. 157 * 158 * Since: 3.24 159 **/ 160 #define E_CAL_STATIC_CAPABILITY_TASK_DATE_ONLY "task-date-only" 161 162 /** 163 * E_CAL_STATIC_CAPABILITY_TASK_CAN_RECUR: 164 * 165 * When the capability is set, the client can store and provide recurring 166 * tasks, otherwise it cannot. 167 * 168 * Since: 3.30 169 **/ 170 #define E_CAL_STATIC_CAPABILITY_TASK_CAN_RECUR "task-can-recur" 171 172 /** 173 * E_CAL_STATIC_CAPABILITY_TASK_NO_ALARM: 174 * 175 * When the capability is set, the client cannot store reminders 176 * on tasks, otherwise it can. 177 * 178 * Since: 3.30 179 **/ 180 #define E_CAL_STATIC_CAPABILITY_TASK_NO_ALARM "task-no-alarm" 181 182 /** 183 * E_CAL_STATIC_CAPABILITY_COMPONENT_COLOR: 184 * 185 * When the capability is set, the client supports storing color 186 * for individual components. 187 * 188 * Since: 3.30 189 **/ 190 #define E_CAL_STATIC_CAPABILITY_COMPONENT_COLOR "component-color" 191 192 /** 193 * E_CAL_STATIC_CAPABILITY_TASK_HANDLE_RECUR: 194 * 195 * When the capability is set, the backend handles task recurrence 196 * completion on its own. This does not imply E_CAL_STATIC_CAPABILITY_TASK_CAN_RECUR. 197 * 198 * Since: 3.34 199 **/ 200 #define E_CAL_STATIC_CAPABILITY_TASK_HANDLE_RECUR "task-handle-recur" 201 202 /** 203 * E_CAL_STATIC_CAPABILITY_SIMPLE_MEMO: 204 * 205 * When the capability is set, the backend handles only simple memos, 206 * which means it stores only memo description. The summary can be changed 207 * by the backend, if needed. 208 * 209 * Since: 3.38 210 **/ 211 #define E_CAL_STATIC_CAPABILITY_SIMPLE_MEMO "simple-memo" 212 213 /** 214 * E_CAL_STATIC_CAPABILITY_SIMPLE_MEMO_WITH_SUMMARY: 215 * 216 * Similar to the %E_CAL_STATIC_CAPABILITY_SIMPLE_MEMO, except the backend stores 217 * the description and the summary separately. 218 * 219 * Since: 3.42 220 **/ 221 222 #define E_CAL_STATIC_CAPABILITY_SIMPLE_MEMO_WITH_SUMMARY "simple-memo-with-summary" 223 224 struct _ECalClient; 225 226 ICalComponent * e_cal_util_new_top_level (void); 227 ICalComponent * e_cal_util_new_component (ICalComponentKind kind); 228 ICalTimezone * e_cal_util_copy_timezone (const ICalTimezone *zone); 229 230 ICalComponent * e_cal_util_parse_ics_string (const gchar *string); 231 ICalComponent * e_cal_util_parse_ics_file (const gchar *filename); 232 233 ECalComponentAlarms * 234 e_cal_util_generate_alarms_for_comp 235 (ECalComponent *comp, 236 time_t start, 237 time_t end, 238 ECalComponentAlarmAction *omit, 239 ECalRecurResolveTimezoneCb resolve_tzid, 240 gpointer user_data, 241 ICalTimezone *default_timezone); 242 gint e_cal_util_generate_alarms_for_list 243 (GList *comps, /* ECalComponent * */ 244 time_t start, 245 time_t end, 246 ECalComponentAlarmAction *omit, 247 GSList **comp_alarms, 248 ECalRecurResolveTimezoneCb resolve_tzid, 249 gpointer user_data, 250 ICalTimezone *default_timezone); 251 252 const gchar * e_cal_util_priority_to_string (gint priority); 253 gint e_cal_util_priority_from_string (const gchar *string); 254 255 gchar * e_cal_util_seconds_to_string (gint64 seconds); 256 257 void e_cal_util_add_timezones_from_component 258 (ICalComponent *vcal_comp, 259 ICalComponent *icalcomp); 260 261 gboolean e_cal_util_property_has_parameter 262 (ICalProperty *prop, 263 ICalParameterKind param_kind); 264 gboolean e_cal_util_component_has_property 265 (ICalComponent *icalcomp, 266 ICalPropertyKind prop_kind); 267 gboolean e_cal_util_component_is_instance 268 (ICalComponent *icalcomp); 269 gboolean e_cal_util_component_has_alarms (ICalComponent *icalcomp); 270 gboolean e_cal_util_component_has_organizer 271 (ICalComponent *icalcomp); 272 gboolean e_cal_util_component_has_recurrences 273 (ICalComponent *icalcomp); 274 gboolean e_cal_util_component_has_rdates (ICalComponent *icalcomp); 275 gboolean e_cal_util_component_has_rrules (ICalComponent *icalcomp); 276 gboolean e_cal_util_component_has_attendee 277 (ICalComponent *icalcomp); 278 gchar * e_cal_util_component_get_recurid_as_string 279 (ICalComponent *icalcomp); 280 ICalComponent * e_cal_util_construct_instance (ICalComponent *icalcomp, 281 const ICalTime *rid); 282 /* #ifndef EDS_DISABLE_DEPRECATED */ /* Fully deprecate it for 3.40 */ 283 void e_cal_util_remove_instances (ICalComponent *icalcomp, 284 const ICalTime *rid, 285 ECalObjModType mod); 286 ICalComponent * e_cal_util_split_at_instance (ICalComponent *icalcomp, 287 const ICalTime *rid, 288 const ICalTime *master_dtstart); 289 /* #endif / * EDS_DISABLE_DEPRECATED */ 290 void e_cal_util_normalize_rrule_until_value 291 (ICalComponent *icalcomp, 292 ICalTime *ttuntil, 293 ECalRecurResolveTimezoneCb tz_cb, 294 gpointer tz_cb_data); 295 void e_cal_util_remove_instances_ex (ICalComponent *icalcomp, 296 const ICalTime *rid, 297 ECalObjModType mod, 298 ECalRecurResolveTimezoneCb tz_cb, 299 gpointer tz_cb_data); 300 ICalComponent * e_cal_util_split_at_instance_ex (ICalComponent *icalcomp, 301 const ICalTime *rid, 302 const ICalTime *master_dtstart, 303 ECalRecurResolveTimezoneCb tz_cb, 304 gpointer tz_cb_data); 305 gboolean e_cal_util_is_first_instance (ECalComponent *comp, 306 const ICalTime *rid, 307 ECalRecurResolveTimezoneCb tz_cb, 308 gpointer tz_cb_data); 309 310 gchar * e_cal_util_get_system_timezone_location (void); 311 ICalTimezone * e_cal_util_get_system_timezone (void); 312 void e_cal_util_get_component_occur_times 313 (ECalComponent *comp, 314 time_t *out_start, 315 time_t *out_end, 316 ECalRecurResolveTimezoneCb tz_cb, 317 gpointer tz_cb_data, 318 const ICalTimezone *default_timezone, 319 ICalComponentKind kind); 320 321 gboolean e_cal_util_component_has_x_property 322 (ICalComponent *icalcomp, 323 const gchar *x_name); 324 ICalProperty * e_cal_util_component_find_x_property 325 (ICalComponent *icalcomp, 326 const gchar *x_name); 327 gchar * e_cal_util_component_dup_x_property 328 (ICalComponent *icalcomp, 329 const gchar *x_name); 330 void e_cal_util_component_set_x_property 331 (ICalComponent *icalcomp, 332 const gchar *x_name, 333 const gchar *value); 334 gboolean e_cal_util_component_remove_x_property 335 (ICalComponent *icalcomp, 336 const gchar *x_name); 337 guint e_cal_util_component_remove_property_by_kind 338 (ICalComponent *icalcomp, 339 ICalPropertyKind kind, 340 gboolean all); 341 342 gboolean e_cal_util_init_recur_task_sync (ICalComponent *vtodo, 343 struct _ECalClient *cal_client, 344 GCancellable *cancellable, 345 GError **error); 346 gboolean e_cal_util_mark_task_complete_sync 347 (ICalComponent *vtodo, 348 time_t completed_time, 349 struct _ECalClient *cal_client, 350 GCancellable *cancellable, 351 GError **error); 352 EConflictResolution 353 e_cal_util_operation_flags_to_conflict_resolution 354 (guint32 flags); /* bit-or of ECalOperationFlags */ 355 guint32 e_cal_util_conflict_resolution_to_operation_flags /* bit-or of ECalOperationFlags */ 356 (EConflictResolution conflict_resolution); 357 gboolean e_cal_util_inline_local_attachments_sync 358 (ICalComponent *component, 359 GCancellable *cancellable, 360 GError **error); 361 gboolean e_cal_util_set_alarm_acknowledged 362 (ECalComponent *component, 363 const gchar *auid, 364 gint64 when); /* as time_t in UTC */ 365 void e_cal_util_clamp_vtimezone (ICalComponent *vtimezone, 366 const ICalTime *from, 367 const ICalTime *to); 368 void e_cal_util_clamp_vtimezone_by_component 369 (ICalComponent *vtimezone, 370 ICalComponent *component); 371 372 G_END_DECLS 373 374 #endif /* E_CAL_UTIL_H */ 375