From 37ff088b7812eaad766ba1f68ae45f07f910bf84 Mon Sep 17 00:00:00 2001 From: rfc2822 Date: Fri, 22 Nov 2013 15:11:39 +0100 Subject: [PATCH] version bump to 0.4.2 * imports calendar default time zone on account creation --- AndroidManifest.xml | 4 ++-- src/at/bitfire/davdroid/Constants.java | 2 +- src/at/bitfire/davdroid/resource/Event.java | 15 +++++++++++++++ .../bitfire/davdroid/resource/LocalCalendar.java | 4 ++++ .../syncadapter/QueryServerDialogFragment.java | 1 + .../bitfire/davdroid/syncadapter/ServerInfo.java | 2 ++ src/at/bitfire/davdroid/webdav/DavProp.java | 9 +++++++++ src/at/bitfire/davdroid/webdav/HttpPropfind.java | 1 + .../bitfire/davdroid/webdav/WebDavResource.java | 9 +++++++++ 9 files changed, 44 insertions(+), 3 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index c4ea55e2..2212661e 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="15" + android:versionName="0.4.2-alpha" > { values.put(Calendars.OWNER_ACCOUNT, account.name); values.put(Calendars.SYNC_EVENTS, 1); values.put(Calendars.VISIBLE, 1); + + if (info.getTimezone() != null) + values.put(Calendars.CALENDAR_TIME_ZONE, info.getTimezone()); + Log.i(TAG, "Inserting calendar: " + values.toString() + " -> " + calendarsURI(account).toString()); client.insert(calendarsURI(account), values); } diff --git a/src/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java b/src/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java index 9d911b31..96fe7fe1 100644 --- a/src/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java +++ b/src/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java @@ -188,6 +188,7 @@ public class QueryServerDialogFragment extends DialogFragment implements LoaderC resource.getDisplayName(), resource.getDescription(), resource.getColor() ); + info.setTimezone(resource.getTimezone()); calendars.add(info); } diff --git a/src/at/bitfire/davdroid/syncadapter/ServerInfo.java b/src/at/bitfire/davdroid/syncadapter/ServerInfo.java index 845dee61..e530e341 100644 --- a/src/at/bitfire/davdroid/syncadapter/ServerInfo.java +++ b/src/at/bitfire/davdroid/syncadapter/ServerInfo.java @@ -39,5 +39,7 @@ public class ServerInfo implements Serializable { final Type type; final String path, title, description, color; + + String timezone; } } diff --git a/src/at/bitfire/davdroid/webdav/DavProp.java b/src/at/bitfire/davdroid/webdav/DavProp.java index 9bb6eaee..12c9d3c6 100644 --- a/src/at/bitfire/davdroid/webdav/DavProp.java +++ b/src/at/bitfire/davdroid/webdav/DavProp.java @@ -41,6 +41,9 @@ public class DavProp { @Element(required=false,name="calendar-color") DavPropCalendarColor calendarColor; + @Element(required=false,name="calendar-timezone") + DavPropCalendarTimezone calendarTimezone; + @Element(required=false) DavPropGetCTag getctag; @@ -108,6 +111,12 @@ public class DavProp { @Getter private String color; } + @Namespace(prefix="C",reference="urn:ietf:params:xml:ns:caldav") + public static class DavPropCalendarTimezone { + @Text(required=false) + @Getter private String timezone; + } + @Namespace(prefix="CS",reference="http://calendarserver.org/ns/") public static class DavPropGetCTag { @Text(required=false) diff --git a/src/at/bitfire/davdroid/webdav/HttpPropfind.java b/src/at/bitfire/davdroid/webdav/HttpPropfind.java index 6537507a..2c86863b 100644 --- a/src/at/bitfire/davdroid/webdav/HttpPropfind.java +++ b/src/at/bitfire/davdroid/webdav/HttpPropfind.java @@ -54,6 +54,7 @@ public class HttpPropfind extends HttpEntityEnclosingRequestBase { propfind.prop.addressbookDescription = new DavProp.DavPropAddressbookDescription(); propfind.prop.calendarDescription = new DavProp.DavPropCalendarDescription(); propfind.prop.calendarColor = new DavProp.DavPropCalendarColor(); + propfind.prop.calendarTimezone = new DavProp.DavPropCalendarTimezone(); break; case COLLECTION_CTAG: depth = 0; diff --git a/src/at/bitfire/davdroid/webdav/WebDavResource.java b/src/at/bitfire/davdroid/webdav/WebDavResource.java index 00810d4a..9568734f 100644 --- a/src/at/bitfire/davdroid/webdav/WebDavResource.java +++ b/src/at/bitfire/davdroid/webdav/WebDavResource.java @@ -47,6 +47,7 @@ import org.simpleframework.xml.core.Persister; import android.util.Log; import at.bitfire.davdroid.URIUtils; +import at.bitfire.davdroid.resource.Event; @ToString @@ -56,6 +57,7 @@ public class WebDavResource { public enum Property { CURRENT_USER_PRINCIPAL, DISPLAY_NAME, DESCRIPTION, COLOR, + TIMEZONE, ADDRESSBOOK_HOMESET, CALENDAR_HOMESET, IS_ADDRESSBOOK, IS_CALENDAR, CTAG, ETAG, @@ -206,6 +208,10 @@ public class WebDavResource { return properties.get(Property.COLOR); } + public String getTimezone() { + return properties.get(Property.TIMEZONE); + } + public String getAddressbookHomeSet() { return properties.get(Property.ADDRESSBOOK_HOMESET); } @@ -438,6 +444,9 @@ public class WebDavResource { if (prop.calendarColor != null) referenced.properties.put(Property.COLOR, prop.calendarColor.getColor()); + + if (prop.calendarTimezone != null) + referenced.properties.put(Property.TIMEZONE, Event.TimezoneDefToTzId(prop.calendarTimezone.getTimezone())); } else referenced.properties.remove(Property.IS_CALENDAR); }