|
|
9b6c077 |
diff -up syncevolution-1.5.3/src/backends/evolution/configure-sub.in.eds-libecal-2.0 syncevolution-1.5.3/src/backends/evolution/configure-sub.in
|
|
|
9b6c077 |
--- syncevolution-1.5.3/src/backends/evolution/configure-sub.in.eds-libecal-2.0 2014-04-25 09:55:47.000000000 +0200
|
|
|
9b6c077 |
+++ syncevolution-1.5.3/src/backends/evolution/configure-sub.in 2019-05-21 13:54:38.676855604 +0200
|
|
|
9b6c077 |
@@ -15,13 +15,23 @@ $anymissing"
|
|
|
9b6c077 |
|
|
|
9b6c077 |
dnl check for Evolution packages
|
|
|
9b6c077 |
PKG_CHECK_MODULES(EPACKAGE, libedataserver-1.2, EDSFOUND=yes, [EDSFOUND=no])
|
|
|
9b6c077 |
-PKG_CHECK_MODULES(ECAL, libecal-1.2, ECALFOUND=yes, [ECALFOUND=no])
|
|
|
9b6c077 |
+PKG_CHECK_MODULES(ECAL, libecal-2.0, ECALFOUND=yes, [ECALFOUND=no])
|
|
|
9b6c077 |
PKG_CHECK_MODULES(EBOOK, libebook-1.2, EBOOKFOUND=yes, [EBOOKFOUND=no])
|
|
|
9b6c077 |
|
|
|
9b6c077 |
+if test "$ECALFOUND" = "yes"; then
|
|
|
9b6c077 |
+ AC_DEFINE(HAVE_LIBECAL_2_0, 1, [libecal 2.0])
|
|
|
9b6c077 |
+else
|
|
|
9b6c077 |
+ PKG_CHECK_MODULES(ECAL, libecal-1.2, ECALFOUND=yes, [ECALFOUND=no])
|
|
|
9b6c077 |
+fi
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
PKG_CHECK_MODULES(EBOOK_VERSION, [libebook-1.2 >= 3.3],
|
|
|
9b6c077 |
[AC_DEFINE(HAVE_E_CONTACT_INLINE_LOCAL_PHOTOS, 1, [have e_contact_inline_local_photos()])],
|
|
|
9b6c077 |
[true])
|
|
|
9b6c077 |
|
|
|
9b6c077 |
+PKG_CHECK_MODULES(EBOOK_VERSION_3_33, [libebook-1.2 >= 3.33.2],
|
|
|
9b6c077 |
+ [AC_DEFINE(HAVE_E_BOOK_OPERATION_FLAGS, 1, [have EBookOperationFlags])],
|
|
|
9b6c077 |
+ [true])
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
SE_ARG_ENABLE_BACKEND(ebook, evolution,
|
|
|
9b6c077 |
[AS_HELP_STRING([--disable-ebook],
|
|
|
9b6c077 |
[disable access to Evolution addressbooks (must be used to compile without it)])],
|
|
|
9b6c077 |
diff -up syncevolution-1.5.3/src/backends/evolution/e-cal-check-timezones.c.eds-libecal-2.0 syncevolution-1.5.3/src/backends/evolution/e-cal-check-timezones.c
|
|
|
9b6c077 |
--- syncevolution-1.5.3/src/backends/evolution/e-cal-check-timezones.c.eds-libecal-2.0 2014-04-25 09:55:47.000000000 +0200
|
|
|
9b6c077 |
+++ syncevolution-1.5.3/src/backends/evolution/e-cal-check-timezones.c 2019-05-21 13:54:38.676855604 +0200
|
|
|
9b6c077 |
@@ -414,7 +414,11 @@ gboolean e_cal_check_timezones(icalcompo
|
|
|
9b6c077 |
goto done;
|
|
|
9b6c077 |
nomem:
|
|
|
9b6c077 |
/* set gerror for "out of memory" if possible, otherwise abort via g_error() */
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ *error = g_error_new(E_CLIENT_ERROR, E_CLIENT_ERROR_OTHER_ERROR, "out of memory");
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
*error = g_error_new(E_CALENDAR_ERROR, E_CALENDAR_STATUS_OTHER_ERROR, "out of memory");
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (!*error) {
|
|
|
9b6c077 |
g_error("e_cal_check_timezones(): out of memory, cannot proceed - sorry!");
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
@@ -451,6 +455,10 @@ icaltimezone *e_cal_tzlookup_ecal(const
|
|
|
9b6c077 |
const void *custom,
|
|
|
9b6c077 |
GError **error)
|
|
|
9b6c077 |
{
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ g_propagate_error(error, e_client_error_create(E_CLIENT_ERROR_NOT_SUPPORTED, NULL));
|
|
|
9b6c077 |
+ return NULL;
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
ECal *ecal = (ECal *)custom;
|
|
|
9b6c077 |
icaltimezone *zone = NULL;
|
|
|
9b6c077 |
|
|
|
9b6c077 |
@@ -470,6 +478,7 @@ icaltimezone *e_cal_tzlookup_ecal(const
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
return NULL;
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
/**
|
|
|
9b6c077 |
diff -up syncevolution-1.5.3/src/backends/evolution/EvolutionCalendarSource.cpp.eds-libecal-2.0 syncevolution-1.5.3/src/backends/evolution/EvolutionCalendarSource.cpp
|
|
|
9b6c077 |
--- syncevolution-1.5.3/src/backends/evolution/EvolutionCalendarSource.cpp.eds-libecal-2.0 2014-10-10 11:43:09.000000000 +0200
|
|
|
9b6c077 |
+++ syncevolution-1.5.3/src/backends/evolution/EvolutionCalendarSource.cpp 2019-05-21 13:54:38.678855604 +0200
|
|
|
9b6c077 |
@@ -189,7 +189,7 @@ static EClient *newECalClient(ESource *s
|
|
|
9b6c077 |
ECalClientSourceType ecalSourceType,
|
|
|
9b6c077 |
GError **gerror)
|
|
|
9b6c077 |
{
|
|
|
9b6c077 |
- return E_CLIENT(e_cal_client_new(source, ecalSourceType, gerror));
|
|
|
9b6c077 |
+ return E_CLIENT(e_cal_client_connect_sync(source, ecalSourceType, -1, NULL, gerror));
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
char *EvolutionCalendarSource::authenticate(const char *prompt,
|
|
|
9b6c077 |
@@ -440,13 +440,25 @@ void EvolutionCalendarSource::readItem(c
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ICalTimezone *
|
|
|
9b6c077 |
+#else /* HAVE_LIBECAL_2_0 */
|
|
|
9b6c077 |
icaltimezone *
|
|
|
9b6c077 |
+#endif /* HAVE_LIBECAL_2_0 */
|
|
|
9b6c077 |
my_tzlookup(const gchar *tzid,
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ gpointer ecalclient,
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
gconstpointer ecalclient,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
GCancellable *cancellable,
|
|
|
9b6c077 |
GError **error)
|
|
|
9b6c077 |
{
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalTimezone *zone = NULL;
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icaltimezone *zone = NULL;
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
GError *local_error = NULL;
|
|
|
9b6c077 |
|
|
|
9b6c077 |
if (e_cal_client_get_timezone_sync((ECalClient *)ecalclient, tzid, &zone, cancellable, &local_error)) {
|
|
|
9b6c077 |
@@ -503,8 +515,12 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
if (modified) {
|
|
|
9b6c077 |
SE_LOG_DEBUG(getDisplayName(), "after replacing , with \\, in CATEGORIES:\n%s", data.c_str());
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
-
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ eptr<ICalComponent> icomp(i_cal_component_new_from_string((char *)data.c_str()));
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
eptr<icalcomponent> icomp(icalcomponent_new_from_string((char *)data.c_str()));
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
|
|
|
9b6c077 |
if( !icomp ) {
|
|
|
9b6c077 |
throwError(SE_HERE, string("failure parsing ical") + data);
|
|
|
9b6c077 |
@@ -515,10 +531,19 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
// fix up TZIDs
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
- !e_cal_client_check_timezones(icomp,
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ !e_cal_client_check_timezones_sync(
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
+ !e_cal_client_check_timezones(
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ icomp,
|
|
|
9b6c077 |
NULL,
|
|
|
9b6c077 |
my_tzlookup,
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ (gpointer)m_calendar.get(),
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
(const void *)m_calendar.get(),
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
NULL,
|
|
|
9b6c077 |
gerror)
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
@@ -535,14 +560,28 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
|
|
|
9b6c077 |
// insert before adding/updating the event so that the new VTIMEZONE is
|
|
|
9b6c077 |
// immediately available should anyone want it
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ for (ICalComponent *tcomp = i_cal_component_get_first_component(icomp, I_CAL_VTIMEZONE_COMPONENT);
|
|
|
9b6c077 |
+ tcomp;
|
|
|
9b6c077 |
+ g_object_unref (tcomp), tcomp = i_cal_component_get_next_component(icomp, I_CAL_VTIMEZONE_COMPONENT)) {
|
|
|
9b6c077 |
+ eptr<ICalTimezone> zone(i_cal_timezone_new(), "icaltimezone");
|
|
|
9b6c077 |
+ i_cal_timezone_set_component(zone, tcomp);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
for (icalcomponent *tcomp = icalcomponent_get_first_component(icomp, ICAL_VTIMEZONE_COMPONENT);
|
|
|
9b6c077 |
tcomp;
|
|
|
9b6c077 |
tcomp = icalcomponent_get_next_component(icomp, ICAL_VTIMEZONE_COMPONENT)) {
|
|
|
9b6c077 |
eptr<icaltimezone> zone(icaltimezone_new(), "icaltimezone");
|
|
|
9b6c077 |
icaltimezone_set_component(zone, tcomp);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
GErrorCXX gerror;
|
|
|
9b6c077 |
- const char *tzid = icaltimezone_get_tzid(zone);
|
|
|
9b6c077 |
+ const char *tzid;
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ tzid = i_cal_timezone_get_tzid(zone);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
+ tzid = icaltimezone_get_tzid(zone);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (!tzid || !tzid[0]) {
|
|
|
9b6c077 |
// cannot add a VTIMEZONE without TZID
|
|
|
9b6c077 |
SE_LOG_DEBUG(getDisplayName(), "skipping VTIMEZONE without TZID");
|
|
|
9b6c077 |
@@ -564,8 +603,14 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
// the component to update/add must be the
|
|
|
9b6c077 |
// ICAL_VEVENT/VTODO_COMPONENT of the item,
|
|
|
9b6c077 |
// e_cal_create/modify_object() fail otherwise
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalComponent *subcomp = i_cal_component_get_first_component(icomp,
|
|
|
9b6c077 |
+ getCompType());
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalcomponent *subcomp = icalcomponent_get_first_component(icomp,
|
|
|
9b6c077 |
getCompType());
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
if (!subcomp) {
|
|
|
9b6c077 |
throwError(SE_HERE, "extracting event");
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
@@ -573,12 +618,16 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
// Remove LAST-MODIFIED: the Evolution Exchange Connector does not
|
|
|
9b6c077 |
// properly update this property if it is already present in the
|
|
|
9b6c077 |
// incoming data.
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ e_cal_util_component_remove_property_by_kind(subcomp, I_CAL_LASTMODIFIED_PROPERTY, TRUE);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalproperty *modprop;
|
|
|
9b6c077 |
while ((modprop = icalcomponent_get_first_property(subcomp, ICAL_LASTMODIFIED_PROPERTY)) != NULL) {
|
|
|
9b6c077 |
icalcomponent_remove_property(subcomp, modprop);
|
|
|
9b6c077 |
icalproperty_free(modprop);
|
|
|
9b6c077 |
modprop = NULL;
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
if (!update) {
|
|
|
9b6c077 |
ItemID id = getItemID(subcomp);
|
|
|
9b6c077 |
@@ -628,8 +677,11 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
// creating new objects works for normal events and detached occurrences alike
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
- e_cal_client_create_object_sync(m_calendar, subcomp, (gchar **)&uid,
|
|
|
9b6c077 |
- NULL, gerror)
|
|
|
9b6c077 |
+ e_cal_client_create_object_sync(m_calendar, subcomp,
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ E_CAL_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ (gchar **)&uid, NULL, gerror)
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
e_cal_create_object(m_calendar, subcomp, (gchar **)&uid, gerror)
|
|
|
9b6c077 |
#endif
|
|
|
9b6c077 |
@@ -650,12 +702,20 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
|
|
|
9b6c077 |
// Recreate any children removed earlier: when we get here,
|
|
|
9b6c077 |
// the parent exists and we must update it.
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ BOOST_FOREACH(boost::shared_ptr< eptr<ICalComponent> > &icalcomp, children) {
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
!e_cal_client_modify_object_sync(m_calendar, *icalcomp,
|
|
|
9b6c077 |
- CALOBJ_MOD_THIS, NULL,
|
|
|
9b6c077 |
- gerror)
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
+ CALOBJ_MOD_THIS,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ NULL, gerror)
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
!e_cal_modify_object(m_calendar, *icalcomp,
|
|
|
9b6c077 |
CALOBJ_MOD_THIS,
|
|
|
9b6c077 |
@@ -679,13 +739,33 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
// RECURRENCE-ID
|
|
|
9b6c077 |
if (update) {
|
|
|
9b6c077 |
if (!id.m_uid.empty()) {
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ i_cal_component_set_uid(subcomp, id.m_uid.c_str());
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalcomponent_set_uid(subcomp, id.m_uid.c_str());
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
if (!id.m_rid.empty()) {
|
|
|
9b6c077 |
// Reconstructing the RECURRENCE-ID is non-trivial,
|
|
|
9b6c077 |
// because our luid only contains the date-time, but
|
|
|
9b6c077 |
// not the time zone. Only do the work if the event
|
|
|
9b6c077 |
// really doesn't have a RECURRENCE-ID.
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalTime *rid;
|
|
|
9b6c077 |
+ rid = i_cal_component_get_recurrenceid(subcomp);
|
|
|
9b6c077 |
+ if (!rid || i_cal_time_is_null_time(rid)) {
|
|
|
9b6c077 |
+ // Preserve the original RECURRENCE-ID, including
|
|
|
9b6c077 |
+ // timezone, no matter what the update contains
|
|
|
9b6c077 |
+ // (might have wrong timezone or UTC).
|
|
|
9b6c077 |
+ eptr<ICalComponent> orig(retrieveItem(id));
|
|
|
9b6c077 |
+ ICalProperty *orig_rid = i_cal_component_get_first_property(orig, I_CAL_RECURRENCEID_PROPERTY);
|
|
|
9b6c077 |
+ if (orig_rid) {
|
|
|
9b6c077 |
+ i_cal_component_take_property(subcomp, i_cal_property_clone(orig_rid));
|
|
|
9b6c077 |
+ }
|
|
|
9b6c077 |
+ g_clear_object(&orig_rid);
|
|
|
9b6c077 |
+ }
|
|
|
9b6c077 |
+ g_clear_object(&rid;;
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
struct icaltimetype rid;
|
|
|
9b6c077 |
rid = icalcomponent_get_recurrenceid(subcomp);
|
|
|
9b6c077 |
if (icaltime_is_null_time(rid)) {
|
|
|
9b6c077 |
@@ -698,6 +778,7 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
icalcomponent_add_property(subcomp, icalproperty_new_clone(orig_rid));
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
@@ -728,8 +809,11 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
const char *uid = NULL;
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
- !e_cal_client_create_object_sync(m_calendar, subcomp, (char **)&uid,
|
|
|
9b6c077 |
- NULL, gerror)
|
|
|
9b6c077 |
+ !e_cal_client_create_object_sync(m_calendar, subcomp,
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ E_CAL_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ (char **)&uid, NULL, gerror)
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
!e_cal_create_object(m_calendar, subcomp, (char **)&uid, gerror)
|
|
|
9b6c077 |
#endif
|
|
|
9b6c077 |
@@ -742,12 +826,20 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
|
|
|
9b6c077 |
// Recreate any children removed earlier: when we get here,
|
|
|
9b6c077 |
// the parent exists and we must update it.
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ BOOST_FOREACH(boost::shared_ptr< eptr<ICalComponent> > &icalcomp, children) {
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
!e_cal_client_modify_object_sync(m_calendar, *icalcomp,
|
|
|
9b6c077 |
- CALOBJ_MOD_THIS, NULL,
|
|
|
9b6c077 |
- gerror)
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
+ CALOBJ_MOD_THIS,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ NULL, gerror)
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
!e_cal_modify_object(m_calendar, *icalcomp,
|
|
|
9b6c077 |
CALOBJ_MOD_THIS,
|
|
|
9b6c077 |
@@ -762,8 +854,12 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
!e_cal_client_modify_object_sync(m_calendar, subcomp,
|
|
|
9b6c077 |
- CALOBJ_MOD_ALL, NULL,
|
|
|
9b6c077 |
- gerror)
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ E_CAL_OBJ_MOD_ALL, E_CAL_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
+ CALOBJ_MOD_ALL,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ NULL, gerror)
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
!e_cal_modify_object(m_calendar, subcomp,
|
|
|
9b6c077 |
CALOBJ_MOD_ALL,
|
|
|
9b6c077 |
@@ -778,8 +874,12 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
!e_cal_client_modify_object_sync(m_calendar, subcomp,
|
|
|
9b6c077 |
- CALOBJ_MOD_THIS, NULL,
|
|
|
9b6c077 |
- gerror)
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
+ CALOBJ_MOD_THIS,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ NULL, gerror)
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
!e_cal_modify_object(m_calendar, subcomp,
|
|
|
9b6c077 |
CALOBJ_MOD_THIS,
|
|
|
9b6c077 |
@@ -795,6 +895,8 @@ EvolutionCalendarSource::InsertItemResul
|
|
|
9b6c077 |
modTime = getItemModTime(newid);
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
+ g_clear_object (&subcomp);
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
return InsertItemResult(newluid, modTime, state);
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
@@ -806,12 +908,24 @@ EvolutionCalendarSource::ICalComps_t Evo
|
|
|
9b6c077 |
if (it != m_allLUIDs.end()) {
|
|
|
9b6c077 |
BOOST_FOREACH(const string &rid, it->second) {
|
|
|
9b6c077 |
ItemID id(uid, rid);
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalComponent *icomp = retrieveItem(id);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalcomponent *icomp = retrieveItem(id);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (icomp) {
|
|
|
9b6c077 |
if (id.m_rid.empty() && returnOnlyChildren) {
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ g_clear_object(&icomp);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalcomponent_free(icomp);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
} else {
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ events.push_back(ICalComps_t::value_type(new eptr<ICalComponent>(icomp)));
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
events.push_back(ICalComps_t::value_type(new eptr<icalcomponent>(icomp)));
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
@@ -821,8 +935,12 @@ EvolutionCalendarSource::ICalComps_t Evo
|
|
|
9b6c077 |
GErrorCXX gerror;
|
|
|
9b6c077 |
if (!uid.empty() && // e_cal_client_remove_object_sync() in EDS 3.8 aborts the process for empty UID, other versions cannot succeed, so skip the call.
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
- !e_cal_client_remove_object_sync(m_calendar,
|
|
|
9b6c077 |
- uid.c_str(), NULL, CALOBJ_MOD_ALL,
|
|
|
9b6c077 |
+ !e_cal_client_remove_object_sync(m_calendar, uid.c_str(), NULL,
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ E_CAL_OBJ_MOD_ALL, E_CAL_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
+ CALOBJ_MOD_ALL,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
NULL, gerror)
|
|
|
9b6c077 |
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
@@ -862,14 +980,21 @@ void EvolutionCalendarSource::removeItem
|
|
|
9b6c077 |
|
|
|
9b6c077 |
// recreate children
|
|
|
9b6c077 |
bool first = true;
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ BOOST_FOREACH(boost::shared_ptr< eptr<ICalComponent> > &icalcomp, children) {
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (first) {
|
|
|
9b6c077 |
char *uid;
|
|
|
9b6c077 |
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
- !e_cal_client_create_object_sync(m_calendar, *icalcomp, &uid,
|
|
|
9b6c077 |
- NULL, gerror)
|
|
|
9b6c077 |
+ !e_cal_client_create_object_sync(m_calendar, *icalcomp,
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ E_CAL_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ &uid, NULL, gerror)
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
!e_cal_create_object(m_calendar, *icalcomp, &uid, gerror)
|
|
|
9b6c077 |
#endif
|
|
|
9b6c077 |
@@ -884,8 +1009,12 @@ void EvolutionCalendarSource::removeItem
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
!e_cal_client_modify_object_sync(m_calendar, *icalcomp,
|
|
|
9b6c077 |
- CALOBJ_MOD_THIS, NULL,
|
|
|
9b6c077 |
- gerror)
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
+ CALOBJ_MOD_THIS,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ NULL, gerror)
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
!e_cal_modify_object(m_calendar, *icalcomp,
|
|
|
9b6c077 |
CALOBJ_MOD_THIS,
|
|
|
9b6c077 |
@@ -900,14 +1029,23 @@ void EvolutionCalendarSource::removeItem
|
|
|
9b6c077 |
// workaround for EDS 2.32 API semantic: succeeds even if
|
|
|
9b6c077 |
// detached recurrence doesn't exist and adds EXDATE,
|
|
|
9b6c077 |
// therefore we have to check for existence first
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ eptr<ICalComponent> item(retrieveItem(id));
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
eptr<icalcomponent> item(retrieveItem(id));
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
gboolean success = !item ? false :
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
// TODO: is this necessary?
|
|
|
9b6c077 |
e_cal_client_remove_object_sync(m_calendar,
|
|
|
9b6c077 |
id.m_uid.c_str(),
|
|
|
9b6c077 |
id.m_rid.c_str(),
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ E_CAL_OBJ_MOD_ONLY_THIS,
|
|
|
9b6c077 |
+ E_CAL_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
CALOBJ_MOD_ONLY_THIS,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
NULL,
|
|
|
9b6c077 |
gerror)
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
@@ -951,10 +1089,18 @@ void EvolutionCalendarSource::removeItem
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ICalComponent *EvolutionCalendarSource::retrieveItem(const ItemID &id)
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalcomponent *EvolutionCalendarSource::retrieveItem(const ItemID &id)
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
{
|
|
|
9b6c077 |
GErrorCXX gerror;
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalComponent *comp = NULL;
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalcomponent *comp = NULL;
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
@@ -981,7 +1127,11 @@ icalcomponent *EvolutionCalendarSource::
|
|
|
9b6c077 |
if (!comp) {
|
|
|
9b6c077 |
throwError(SE_HERE, string("retrieving item: ") + id.getLUID());
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ eptr<ICalComponent> ptr(comp);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
eptr<icalcomponent> ptr(comp);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
/*
|
|
|
9b6c077 |
* EDS bug: if a parent doesn't exist while a child does, and we ask
|
|
|
9b6c077 |
@@ -989,8 +1139,15 @@ icalcomponent *EvolutionCalendarSource::
|
|
|
9b6c077 |
* turn it into a "not found" error.
|
|
|
9b6c077 |
*/
|
|
|
9b6c077 |
if (id.m_rid.empty()) {
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalTime *rid = i_cal_component_get_recurrenceid(comp);
|
|
|
9b6c077 |
+ if (!rid || i_cal_time_is_null_time(rid)) {
|
|
|
9b6c077 |
+ g_clear_object(&rid;;
|
|
|
9b6c077 |
+ } else {
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
struct icaltimetype rid = icalcomponent_get_recurrenceid(comp);
|
|
|
9b6c077 |
if (!icaltime_is_null_time(rid)) {
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
throwError(SE_HERE, string("retrieving item: got child instead of parent: ") + id.m_uid);
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
@@ -1000,7 +1157,11 @@ icalcomponent *EvolutionCalendarSource::
|
|
|
9b6c077 |
|
|
|
9b6c077 |
string EvolutionCalendarSource::retrieveItemAsString(const ItemID &id)
|
|
|
9b6c077 |
{
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ eptr<ICalComponent> comp(retrieveItem(id));
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
eptr<icalcomponent> comp(retrieveItem(id));
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
eptr<char> icalstr;
|
|
|
9b6c077 |
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
@@ -1015,6 +1176,15 @@ string EvolutionCalendarSource::retrieve
|
|
|
9b6c077 |
// definition. Evolution GUI ignores the TZID and interprets
|
|
|
9b6c077 |
// the times as local time. Do the same when exporting the
|
|
|
9b6c077 |
// event by removing the bogus TZID.
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalProperty *prop;
|
|
|
9b6c077 |
+ for (prop = i_cal_component_get_first_property (comp, I_CAL_ANY_PROPERTY);
|
|
|
9b6c077 |
+ prop;
|
|
|
9b6c077 |
+ g_object_unref(prop), prop = i_cal_component_get_next_property (comp, I_CAL_ANY_PROPERTY)) {
|
|
|
9b6c077 |
+ // removes only the *first* TZID - but there shouldn't be more than one
|
|
|
9b6c077 |
+ i_cal_property_remove_parameter_by_kind(prop, I_CAL_TZID_PARAMETER);
|
|
|
9b6c077 |
+ }
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalproperty *prop = icalcomponent_get_first_property (comp,
|
|
|
9b6c077 |
ICAL_ANY_PROPERTY);
|
|
|
9b6c077 |
|
|
|
9b6c077 |
@@ -1024,6 +1194,7 @@ string EvolutionCalendarSource::retrieve
|
|
|
9b6c077 |
prop = icalcomponent_get_next_property (comp,
|
|
|
9b6c077 |
ICAL_ANY_PROPERTY);
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
// now try again
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
@@ -1075,16 +1246,28 @@ string EvolutionCalendarSource::retrieve
|
|
|
9b6c077 |
std::string EvolutionCalendarSource::getDescription(const string &luid)
|
|
|
9b6c077 |
{
|
|
|
9b6c077 |
try {
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ eptr<ICalComponent> comp(retrieveItem(ItemID(luid)));
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
eptr<icalcomponent> comp(retrieveItem(ItemID(luid)));
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
std::string descr;
|
|
|
9b6c077 |
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ const char *summary = i_cal_component_get_summary(comp);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
const char *summary = icalcomponent_get_summary(comp);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (summary && summary[0]) {
|
|
|
9b6c077 |
descr += summary;
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
if (m_type == EVOLUTION_CAL_SOURCE_TYPE_EVENTS) {
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ const char *location = i_cal_component_get_location(comp);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
const char *location = icalcomponent_get_location(comp);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (location && location[0]) {
|
|
|
9b6c077 |
if (!descr.empty()) {
|
|
|
9b6c077 |
descr += ", ";
|
|
|
9b6c077 |
@@ -1096,9 +1279,17 @@ std::string EvolutionCalendarSource::get
|
|
|
9b6c077 |
if (m_type == EVOLUTION_CAL_SOURCE_TYPE_MEMOS &&
|
|
|
9b6c077 |
descr.empty()) {
|
|
|
9b6c077 |
// fallback to first line of body text
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalProperty *desc = i_cal_component_get_first_property(comp, I_CAL_DESCRIPTION_PROPERTY);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalproperty *desc = icalcomponent_get_first_property(comp, ICAL_DESCRIPTION_PROPERTY);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (desc) {
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ const char *text = i_cal_property_get_description(desc);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
const char *text = icalproperty_get_description(desc);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (text) {
|
|
|
9b6c077 |
const char *eol = strchr(text, '\n');
|
|
|
9b6c077 |
if (eol) {
|
|
|
9b6c077 |
@@ -1107,6 +1298,9 @@ std::string EvolutionCalendarSource::get
|
|
|
9b6c077 |
descr = text;
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ g_object_unref(desc);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
@@ -1144,7 +1338,11 @@ EvolutionCalendarSource::ItemID::ItemID(
|
|
|
9b6c077 |
|
|
|
9b6c077 |
EvolutionCalendarSource::ItemID EvolutionCalendarSource::getItemID(ECalComponent *ecomp)
|
|
|
9b6c077 |
{
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalComponent *icomp = e_cal_component_get_icalcomponent(ecomp);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalcomponent *icomp = e_cal_component_get_icalcomponent(ecomp);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (!icomp) {
|
|
|
9b6c077 |
SE_THROW("internal error in getItemID(): ECalComponent without icalcomp");
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
@@ -1162,15 +1360,38 @@ EvolutionCalendarSource::ItemID Evolutio
|
|
|
9b6c077 |
icalTime2Str(rid));
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+EvolutionCalendarSource::ItemID EvolutionCalendarSource::getItemID(ICalComponent *icomp)
|
|
|
9b6c077 |
+{
|
|
|
9b6c077 |
+ icalcomponent *native_icomp;
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
+ native_icomp = static_cast<icalcomponent *>(i_cal_object_get_native(I_CAL_OBJECT (icomp)));
|
|
|
9b6c077 |
+ if (!native_icomp) {
|
|
|
9b6c077 |
+ SE_THROW("internal error in getItemID(): ICalComponent without native icalcomp");
|
|
|
9b6c077 |
+ }
|
|
|
9b6c077 |
+ return getItemID(native_icomp);
|
|
|
9b6c077 |
+}
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
string EvolutionCalendarSource::getItemModTime(ECalComponent *ecomp)
|
|
|
9b6c077 |
{
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalTime *modTime;
|
|
|
9b6c077 |
+ modTime = e_cal_component_get_last_modified(ecomp);
|
|
|
9b6c077 |
+ eptr<ICalTime, ICalTime, UnrefFree<ICalTime> > modTimePtr(modTime);
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
struct icaltimetype *modTime;
|
|
|
9b6c077 |
e_cal_component_get_last_modified(ecomp, &modTime);
|
|
|
9b6c077 |
eptr<struct icaltimetype, struct icaltimetype, UnrefFree<struct icaltimetype> > modTimePtr(modTime);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
if (!modTimePtr) {
|
|
|
9b6c077 |
return "";
|
|
|
9b6c077 |
} else {
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ return icalTime2Str(modTimePtr.get());
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
return icalTime2Str(*modTimePtr.get());
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
@@ -1179,7 +1400,11 @@ string EvolutionCalendarSource::getItemM
|
|
|
9b6c077 |
if (!needChanges()) {
|
|
|
9b6c077 |
return "";
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ eptr<ICalComponent> icomp(retrieveItem(id));
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
eptr<icalcomponent> icomp(retrieveItem(id));
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
return getItemModTime(icomp);
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
@@ -1194,6 +1419,15 @@ string EvolutionCalendarSource::getItemM
|
|
|
9b6c077 |
return icalTime2Str(modTime);
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+string EvolutionCalendarSource::getItemModTime(ICalComponent *icomp)
|
|
|
9b6c077 |
+{
|
|
|
9b6c077 |
+ icalcomponent *native_icomp = static_cast<icalcomponent *>(i_cal_object_get_native(I_CAL_OBJECT (icomp)));
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
+ return getItemModTime(native_icomp);
|
|
|
9b6c077 |
+}
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
string EvolutionCalendarSource::icalTime2Str(const icaltimetype &tt)
|
|
|
9b6c077 |
{
|
|
|
9b6c077 |
static const struct icaltimetype null = { 0 };
|
|
|
9b6c077 |
@@ -1208,6 +1442,21 @@ string EvolutionCalendarSource::icalTime
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+string EvolutionCalendarSource::icalTime2Str(const ICalTime *tt)
|
|
|
9b6c077 |
+{
|
|
|
9b6c077 |
+ if (tt || !i_cal_time_is_valid_time (tt) || i_cal_time_is_null_time (tt)) {
|
|
|
9b6c077 |
+ return "";
|
|
|
9b6c077 |
+ } else {
|
|
|
9b6c077 |
+ eptr<char> timestr(i_cal_time_as_ical_string(tt));
|
|
|
9b6c077 |
+ if (!timestr) {
|
|
|
9b6c077 |
+ SE_THROW("cannot convert to time string");
|
|
|
9b6c077 |
+ }
|
|
|
9b6c077 |
+ return timestr.get();
|
|
|
9b6c077 |
+ }
|
|
|
9b6c077 |
+}
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+
|
|
|
9b6c077 |
SE_END_CXX
|
|
|
9b6c077 |
|
|
|
9b6c077 |
#endif /* ENABLE_ECAL */
|
|
|
9b6c077 |
diff -up syncevolution-1.5.3/src/backends/evolution/EvolutionCalendarSource.h.eds-libecal-2.0 syncevolution-1.5.3/src/backends/evolution/EvolutionCalendarSource.h
|
|
|
9b6c077 |
--- syncevolution-1.5.3/src/backends/evolution/EvolutionCalendarSource.h.eds-libecal-2.0 2014-07-21 12:20:53.000000000 +0200
|
|
|
9b6c077 |
+++ syncevolution-1.5.3/src/backends/evolution/EvolutionCalendarSource.h 2019-05-21 13:54:38.676855604 +0200
|
|
|
9b6c077 |
@@ -134,6 +134,9 @@ class EvolutionCalendarSource : public E
|
|
|
9b6c077 |
*/
|
|
|
9b6c077 |
static ItemID getItemID(ECalComponent *ecomp);
|
|
|
9b6c077 |
static ItemID getItemID(icalcomponent *icomp);
|
|
|
9b6c077 |
+ #ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ static ItemID getItemID(ICalComponent *icomp);
|
|
|
9b6c077 |
+ #endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
/**
|
|
|
9b6c077 |
* Extract modification string from calendar item.
|
|
|
9b6c077 |
@@ -141,6 +144,9 @@ class EvolutionCalendarSource : public E
|
|
|
9b6c077 |
*/
|
|
|
9b6c077 |
static string getItemModTime(ECalComponent *ecomp);
|
|
|
9b6c077 |
static string getItemModTime(icalcomponent *icomp);
|
|
|
9b6c077 |
+ #ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ static string getItemModTime(ICalComponent *icomp);
|
|
|
9b6c077 |
+ #endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
protected:
|
|
|
9b6c077 |
//
|
|
|
9b6c077 |
@@ -196,18 +202,30 @@ class EvolutionCalendarSource : public E
|
|
|
9b6c077 |
*
|
|
|
9b6c077 |
* caller has to free result
|
|
|
9b6c077 |
*/
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalComponent *retrieveItem(const ItemID &id;;
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalcomponent *retrieveItem(const ItemID &id;;
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
/** retrieve the item with the given luid as VCALENDAR string - may throw exception */
|
|
|
9b6c077 |
string retrieveItemAsString(const ItemID &id;;
|
|
|
9b6c077 |
|
|
|
9b6c077 |
|
|
|
9b6c077 |
/** returns the type which the ical library uses for our components */
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ ICalComponentKind getCompType() {
|
|
|
9b6c077 |
+ return m_type == EVOLUTION_CAL_SOURCE_TYPE_EVENTS ? I_CAL_VEVENT_COMPONENT :
|
|
|
9b6c077 |
+ m_type == EVOLUTION_CAL_SOURCE_TYPE_MEMOS ? I_CAL_VJOURNAL_COMPONENT :
|
|
|
9b6c077 |
+ I_CAL_VTODO_COMPONENT;
|
|
|
9b6c077 |
+ }
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
icalcomponent_kind getCompType() {
|
|
|
9b6c077 |
return m_type == EVOLUTION_CAL_SOURCE_TYPE_EVENTS ? ICAL_VEVENT_COMPONENT :
|
|
|
9b6c077 |
m_type == EVOLUTION_CAL_SOURCE_TYPE_MEMOS ? ICAL_VJOURNAL_COMPONENT :
|
|
|
9b6c077 |
ICAL_VTODO_COMPONENT;
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
#ifndef USE_EDS_CLIENT
|
|
|
9b6c077 |
/** ECalAuthFunc which calls the authenticate() methods */
|
|
|
9b6c077 |
@@ -239,6 +257,9 @@ class EvolutionCalendarSource : public E
|
|
|
9b6c077 |
* Convert to string in canonical representation.
|
|
|
9b6c077 |
*/
|
|
|
9b6c077 |
static string icalTime2Str(const struct icaltimetype &tt;;
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ static string icalTime2Str(const ICalTime *tt);
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
/**
|
|
|
9b6c077 |
* A set of all existing objects. Initialized in the last call to
|
|
|
9b6c077 |
@@ -263,7 +284,11 @@ class EvolutionCalendarSource : public E
|
|
|
9b6c077 |
* will destroy the smart pointer, which then calls
|
|
|
9b6c077 |
* icalcomponent_free().
|
|
|
9b6c077 |
*/
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ typedef list< boost::shared_ptr< eptr<ICalComponent> > > ICalComps_t;
|
|
|
9b6c077 |
+#else
|
|
|
9b6c077 |
typedef list< boost::shared_ptr< eptr<icalcomponent> > > ICalComps_t;
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
|
|
|
9b6c077 |
/**
|
|
|
9b6c077 |
* Utility function which extracts all icalcomponents with
|
|
|
9b6c077 |
diff -up syncevolution-1.5.3/src/backends/evolution/EvolutionContactSource.cpp.eds-libecal-2.0 syncevolution-1.5.3/src/backends/evolution/EvolutionContactSource.cpp
|
|
|
9b6c077 |
--- syncevolution-1.5.3/src/backends/evolution/EvolutionContactSource.cpp.eds-libecal-2.0 2016-09-26 13:20:05.000000000 +0200
|
|
|
9b6c077 |
+++ syncevolution-1.5.3/src/backends/evolution/EvolutionContactSource.cpp 2019-05-21 13:54:38.676855604 +0200
|
|
|
9b6c077 |
@@ -988,7 +988,11 @@ void EvolutionContactSource::flushItemCh
|
|
|
9b6c077 |
this,
|
|
|
9b6c077 |
batched,
|
|
|
9b6c077 |
_1, _2, _3),
|
|
|
9b6c077 |
- m_addressbook, contacts, NULL);
|
|
|
9b6c077 |
+ m_addressbook, contacts,
|
|
|
9b6c077 |
+#ifdef HAVE_E_BOOK_OPERATION_FLAGS
|
|
|
9b6c077 |
+ E_BOOK_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ NULL);
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
if (!m_batchedUpdate.empty()) {
|
|
|
9b6c077 |
SE_LOG_DEBUG(getDisplayName(), "batch update of %d contacts starting", (int)m_batchedUpdate.size());
|
|
|
9b6c077 |
@@ -1004,7 +1008,11 @@ void EvolutionContactSource::flushItemCh
|
|
|
9b6c077 |
this,
|
|
|
9b6c077 |
batched,
|
|
|
9b6c077 |
_1, _2),
|
|
|
9b6c077 |
- m_addressbook, contacts, NULL);
|
|
|
9b6c077 |
+ m_addressbook, contacts,
|
|
|
9b6c077 |
+#ifdef HAVE_E_BOOK_OPERATION_FLAGS
|
|
|
9b6c077 |
+ E_BOOK_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ NULL);
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
|
|
|
9b6c077 |
@@ -1037,14 +1045,22 @@ EvolutionContactSource::insertItem(const
|
|
|
9b6c077 |
case SYNCHRONOUS:
|
|
|
9b6c077 |
if (uid.empty()) {
|
|
|
9b6c077 |
gchar* newuid;
|
|
|
9b6c077 |
- if (!e_book_client_add_contact_sync(m_addressbook, contact, &newuid, NULL, gerror)) {
|
|
|
9b6c077 |
+ if (!e_book_client_add_contact_sync(m_addressbook, contact,
|
|
|
9b6c077 |
+#ifdef HAVE_E_BOOK_OPERATION_FLAGS
|
|
|
9b6c077 |
+ E_BOOK_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ &newuid, NULL, gerror)) {
|
|
|
9b6c077 |
throwError(SE_HERE, "add new contact", gerror);
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
PlainGStr newuidPtr(newuid);
|
|
|
9b6c077 |
string newrev = getRevision(newuid);
|
|
|
9b6c077 |
return InsertItemResult(newuid, newrev, ITEM_OKAY);
|
|
|
9b6c077 |
} else {
|
|
|
9b6c077 |
- if (!e_book_client_modify_contact_sync(m_addressbook, contact, NULL, gerror)) {
|
|
|
9b6c077 |
+ if (!e_book_client_modify_contact_sync(m_addressbook, contact,
|
|
|
9b6c077 |
+#ifdef HAVE_E_BOOK_OPERATION_FLAGS
|
|
|
9b6c077 |
+ E_BOOK_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ NULL, gerror)) {
|
|
|
9b6c077 |
throwError(SE_HERE, "updating contact "+ uid, gerror);
|
|
|
9b6c077 |
}
|
|
|
9b6c077 |
string newrev = getRevision(uid);
|
|
|
9b6c077 |
@@ -1102,7 +1118,11 @@ void EvolutionContactSource::removeItem(
|
|
|
9b6c077 |
if (
|
|
|
9b6c077 |
#ifdef USE_EDS_CLIENT
|
|
|
9b6c077 |
(invalidateCachedContact(uid),
|
|
|
9b6c077 |
- !e_book_client_remove_contact_by_uid_sync(m_addressbook, uid.c_str(), NULL, gerror))
|
|
|
9b6c077 |
+ !e_book_client_remove_contact_by_uid_sync(m_addressbook, uid.c_str(),
|
|
|
9b6c077 |
+#ifdef HAVE_E_BOOK_OPERATION_FLAGS
|
|
|
9b6c077 |
+ E_BOOK_OPERATION_FLAG_NONE,
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
+ NULL, gerror))
|
|
|
9b6c077 |
#else
|
|
|
9b6c077 |
!e_book_remove_contact(m_addressbook, uid.c_str(), gerror)
|
|
|
9b6c077 |
#endif
|
|
|
9b6c077 |
diff -up syncevolution-1.5.3/src/syncevo/SmartPtr.h.eds-libecal-2.0 syncevolution-1.5.3/src/syncevo/SmartPtr.h
|
|
|
9b6c077 |
--- syncevolution-1.5.3/src/syncevo/SmartPtr.h.eds-libecal-2.0 2014-04-25 09:55:47.000000000 +0200
|
|
|
9b6c077 |
+++ syncevolution-1.5.3/src/syncevo/SmartPtr.h 2019-05-21 13:54:38.677855604 +0200
|
|
|
9b6c077 |
@@ -76,6 +76,12 @@ class Unref {
|
|
|
9b6c077 |
static void unref(icalproperty *pointer) { icalproperty_free(pointer); }
|
|
|
9b6c077 |
static void unref(icalparameter *pointer) { icalparameter_free(pointer); }
|
|
|
9b6c077 |
static void unref(icaltimezone *pointer) { icaltimezone_free(pointer, 1); }
|
|
|
9b6c077 |
+#ifdef HAVE_LIBECAL_2_0
|
|
|
9b6c077 |
+ static void unref(ICalComponent *pointer) { g_clear_object(&pointer); }
|
|
|
9b6c077 |
+ static void unref(ICalProperty *pointer) { g_clear_object(&pointer); }
|
|
|
9b6c077 |
+ static void unref(ICalParameter *pointer) { g_clear_object(&pointer); }
|
|
|
9b6c077 |
+ static void unref(ICalTimezone *pointer) { g_clear_object(&pointer); }
|
|
|
9b6c077 |
+#endif
|
|
|
9b6c077 |
#endif // ENABLE_ICAL
|
|
|
9b6c077 |
};
|
|
|
9b6c077 |
|