1 /*
2  * Evolution calendar - Utilities for manipulating ECalComponent objects
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, see <http://www.gnu.org/licenses/>.
15  *
16  *
17  * Authors:
18  *		Federico Mena-Quintero <federico@ximian.com>
19  *
20  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
21  *
22  */
23 
24 #ifndef COMP_UTIL_H
25 #define COMP_UTIL_H
26 
27 #include <gtk/gtk.h>
28 #include <libecal/libecal.h>
29 
30 #include <e-util/e-util.h>
31 #include <calendar/gui/e-cal-data-model.h>
32 
33 struct _EShell;
34 
35 void		cal_comp_util_add_exdate	(ECalComponent *comp,
36 						 time_t t,
37 						 ICalTimezone *zone);
38 
39 /* Returns TRUE if the component uses the given timezone for both DTSTART
40  * and DTEND, or if the UTC offsets of the start and end times are the same
41  * as in the given zone. */
42 gboolean	cal_comp_util_compare_event_timezones
43 						(ECalComponent *comp,
44 						 ECalClient *client,
45 						 ICalTimezone *zone);
46 
47 /* Returns the number of icons owned by the ECalComponent */
48 gint     	cal_comp_util_get_n_icons	(ECalComponent *comp,
49 						 GSList **pixbufs);
50 
51 gboolean	cal_comp_is_on_server_sync	(ECalComponent *comp,
52 						 ECalClient *client,
53 						 GCancellable *cancellable,
54 						 GError **error);
55 gboolean	cal_comp_is_icalcomp_on_server_sync
56 						(ICalComponent *icomp,
57 						 ECalClient *client,
58 						 GCancellable *cancellable,
59 						 GError **error);
60 
61 ECalComponent *	cal_comp_event_new_with_defaults_sync
62 						(ECalClient *client,
63 						 gboolean all_day,
64 						 gboolean use_default_reminder,
65 						 gint default_reminder_interval,
66 						 EDurationType default_reminder_units,
67 						 GCancellable *cancellable,
68 						 GError **error);
69 ECalComponent *	cal_comp_event_new_with_current_time_sync
70 						(ECalClient *client,
71 						 gboolean all_day,
72 						 gboolean use_default_reminder,
73 						 gint default_reminder_interval,
74 						 EDurationType default_reminder_units,
75 						 GCancellable *cancellable,
76 						 GError **error);
77 ECalComponent *	cal_comp_task_new_with_defaults_sync
78 						(ECalClient *client,
79 						 GCancellable *cancellable,
80 						 GError **error);
81 ECalComponent *	cal_comp_memo_new_with_defaults_sync
82 						(ECalClient *client,
83 						 GCancellable *cancellable,
84 						 GError **error);
85 
86 void		cal_comp_update_time_by_active_window
87 						(ECalComponent *comp,
88 						 struct _EShell *shell);
89 
90 void    	cal_comp_selection_set_string_list
91 						(GtkSelectionData *data,
92 						 GSList *str_list);
93 GSList *	cal_comp_selection_get_string_list
94 						(GtkSelectionData *data);
95 
96 void		cal_comp_set_dtstart_with_oldzone
97 						(ECalClient *client,
98 						 ECalComponent *comp,
99 						 const ECalComponentDateTime *pdate);
100 void		cal_comp_set_dtend_with_oldzone	(ECalClient *client,
101 						 ECalComponent *comp,
102 						 const ECalComponentDateTime *pdate);
103 
104 gboolean	comp_util_sanitize_recurrence_master_sync
105 						(ECalComponent *comp,
106 						 ECalClient *client,
107 						 GCancellable *cancellable,
108 						 GError **error);
109 
110 gchar *		comp_util_suggest_filename	(ICalComponent *icomp,
111 						 const gchar *default_name);
112 
113 void		cal_comp_get_instance_times	(ECalClient *client,
114 						 ICalComponent *icomp,
115 						 const ICalTimezone *default_zone,
116 						 ICalTime **out_instance_start,
117 						 ICalTime **out_instance_end,
118 						 GCancellable *cancellable);
119 time_t		cal_comp_gdate_to_timet		(const GDate *date,
120 						 const ICalTimezone *with_zone);
121 
122 void		cal_comp_transfer_item_to	(ECalClient *src_client,
123 						 ECalClient *dest_client,
124 						 ICalComponent *icomp_vcal,
125 						 gboolean do_copy,
126 						 GCancellable *cancellable,
127 						 GAsyncReadyCallback callback,
128 						 gpointer user_data);
129 gboolean	cal_comp_transfer_item_to_finish(ECalClient *client,
130 						 GAsyncResult *result,
131 						 GError **error);
132 gboolean	cal_comp_transfer_item_to_sync	(ECalClient *src_client,
133 						 ECalClient *dest_client,
134 						 ICalComponent *icomp_event,
135 						 gboolean do_copy,
136 						 GCancellable *cancellable,
137 						 GError **error);
138 void		cal_comp_util_update_tzid_parameter
139 						(ICalProperty *prop,
140 						 const ICalTime *tt);
141 gint		cal_comp_util_compare_time_with_today
142 						(const ICalTime *time_tt);
143 gboolean	cal_comp_util_have_in_new_attendees
144 						(const GSList *new_attendees_mails,
145 						 const gchar *eml);
146 void		cal_comp_util_copy_new_attendees
147 						(ECalComponent *des,
148 						 ECalComponent *src);
149 void		cal_comp_util_set_added_attendees_mails
150 						(ECalComponent *comp,
151 						 GSList *emails);
152 gchar *		cal_comp_util_dup_parameter_xvalue
153 						(ICalProperty *prop,
154 						 const gchar *name);
155 gchar *		cal_comp_util_get_attendee_comments
156 						(ICalComponent *icomp);
157 const gchar *	cal_comp_util_status_to_localized_string
158 						(ICalComponentKind kind,
159 						 ICalPropertyStatus status);
160 ICalPropertyStatus
161 		cal_comp_util_localized_string_to_status
162 						(ICalComponentKind kind,
163 						 const gchar *localized_string,
164 						 GCompareDataFunc cmp_func,
165 						 gpointer user_data);
166 GList *		cal_comp_util_get_status_list_for_kind /* const gchar * */
167 						(ICalComponentKind kind);
168 gboolean	cal_comp_util_ensure_allday_timezone
169 						(ICalTime *itime,
170 						 ICalTimezone *zone);
171 void		cal_comp_util_maybe_ensure_allday_timezone_properties
172 						(ECalClient *client,
173 						 ICalComponent *icomp,
174 						 ICalTimezone *zone);
175 void		cal_comp_util_format_itt	(ICalTime *itt,
176 						 gchar *buffer,
177 						 gint buffer_size);
178 
179 #endif
180