From d7fff8a760332fd3a5601b26df39e592f2b92cb6 Mon Sep 17 00:00:00 2001 From: Ricki Hirner Date: Mon, 10 Aug 2015 11:54:05 +0200 Subject: [PATCH] Handle attendees and reminders for exceptions of recurring events --- .../at/bitfire/davdroid/resource/Contact.java | 1 - .../at/bitfire/davdroid/resource/Event.java | 2 -- .../davdroid/resource/LocalCalendar.java | 17 ++++++++--------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/at/bitfire/davdroid/resource/Contact.java b/app/src/main/java/at/bitfire/davdroid/resource/Contact.java index 05e7452c..e9aa592a 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/Contact.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/Contact.java @@ -58,7 +58,6 @@ import ezvcard.property.Uid; import ezvcard.property.Url; import lombok.Cleanup; import lombok.Getter; -import lombok.Setter; import lombok.ToString; diff --git a/app/src/main/java/at/bitfire/davdroid/resource/Event.java b/app/src/main/java/at/bitfire/davdroid/resource/Event.java index 126203e1..b982973c 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/Event.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/Event.java @@ -30,7 +30,6 @@ import net.fortuna.ical4j.model.property.DtStart; import net.fortuna.ical4j.model.property.Duration; import net.fortuna.ical4j.model.property.ExDate; import net.fortuna.ical4j.model.property.ExRule; -import net.fortuna.ical4j.model.property.LastModified; import net.fortuna.ical4j.model.property.Location; import net.fortuna.ical4j.model.property.Organizer; import net.fortuna.ical4j.model.property.RDate; @@ -60,7 +59,6 @@ import at.bitfire.davdroid.DateUtils; import lombok.Cleanup; import lombok.Getter; import lombok.NonNull; -import lombok.Setter; public class Event extends iCalendar { diff --git a/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java b/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java index 13245c8f..57fb4f12 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java @@ -603,7 +603,6 @@ public class LocalCalendar extends LocalCollection { if (event.organizer != null) { final URI uri = event.organizer.getCalAddress(); - String email = null; if (uri != null && "mailto".equalsIgnoreCase(uri.getScheme())) email = uri.getSchemeSpecificPart(); @@ -611,10 +610,11 @@ public class LocalCalendar extends LocalCollection { iCalendar.Email emailParam = (iCalendar.Email)event.organizer.getParameter(iCalendar.Email.PARAMETER_NAME); if (emailParam != null) email = emailParam.getValue(); - else - Log.w(TAG, "Got ORGANIZER without email address, using given URI instead (may cause Android to behave unexpectedly)"); } - builder.withValue(Events.ORGANIZER, email != null ? email : uri.toString()); + if (email != null) + builder.withValue(Events.ORGANIZER, email); + else + Log.w(TAG, "Got ORGANIZER without email address which is not supported by Android, ignoring"); } if (event.status!= null) { @@ -646,8 +646,11 @@ public class LocalCalendar extends LocalCollection { for (VAlarm alarm : event.getAlarms()) pendingOperations.add(buildReminder(newDataInsertBuilder(Reminders.CONTENT_URI, Reminders.EVENT_ID, localID, backrefIdx), alarm).build()); // add exceptions - for (Event exception : event.getExceptions()) + for (Event exception : event.getExceptions()) { + final int backrefIdxEx = pendingOperations.size(); // save exception ID as backref value pendingOperations.add(buildException(newDataInsertBuilder(Events.CONTENT_URI, Events.ORIGINAL_ID, localID, backrefIdx), event, exception).build()); + addDataRows(exception, -1, backrefIdxEx); // build attendees and reminders for exception + } } @Override @@ -684,10 +687,6 @@ public class LocalCalendar extends LocalCollection { builder.withValue(Events.ORIGINAL_INSTANCE_TIME, date.getTime()); builder.withValue(Events.ORIGINAL_ALL_DAY, originalAllDay ? 1 : 0); - - /* TODO reminders and attendees for exceptions are currently not built because - * there's no backref index available */ - return builder; }