version bump to 0.4.2

* imports calendar default time zone on account creation
pull/2/head
rfc2822 11 years ago
parent af698c584b
commit 37ff088b78

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.bitfire.davdroid" package="at.bitfire.davdroid"
android:versionCode="14" android:versionCode="15"
android:versionName="0.4.1-alpha" > android:versionName="0.4.2-alpha" >
<uses-sdk <uses-sdk
android:minSdkVersion="14" android:minSdkVersion="14"

@ -9,7 +9,7 @@ package at.bitfire.davdroid;
public class Constants { public class Constants {
public static final String public static final String
APP_VERSION = "0.4.1-alpha", APP_VERSION = "0.4.2-alpha",
ACCOUNT_TYPE = "bitfire.at.davdroid", ACCOUNT_TYPE = "bitfire.at.davdroid",

@ -9,6 +9,7 @@ package at.bitfire.davdroid.resource;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.StringReader;
import java.util.Calendar; import java.util.Calendar;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -30,6 +31,7 @@ import net.fortuna.ical4j.model.PropertyList;
import net.fortuna.ical4j.model.TimeZoneRegistry; import net.fortuna.ical4j.model.TimeZoneRegistry;
import net.fortuna.ical4j.model.ValidationException; import net.fortuna.ical4j.model.ValidationException;
import net.fortuna.ical4j.model.component.VEvent; import net.fortuna.ical4j.model.component.VEvent;
import net.fortuna.ical4j.model.component.VTimeZone;
import net.fortuna.ical4j.model.parameter.Value; import net.fortuna.ical4j.model.parameter.Value;
import net.fortuna.ical4j.model.property.Attendee; import net.fortuna.ical4j.model.property.Attendee;
import net.fortuna.ical4j.model.property.Clazz; import net.fortuna.ical4j.model.property.Clazz;
@ -306,4 +308,17 @@ public class Event extends Resource {
if (dtStart == null) if (dtStart == null)
throw new ValidationException("dtStart must not be empty"); throw new ValidationException("dtStart must not be empty");
} }
public static String TimezoneDefToTzId(String timezoneDef) {
try {
CalendarBuilder builder = new CalendarBuilder();
net.fortuna.ical4j.model.Calendar cal = builder.build(new StringReader(timezoneDef));
VTimeZone timezone = (VTimeZone)cal.getComponent(VTimeZone.VTIMEZONE);
return timezone.getTimeZoneId().getValue();
} catch (Exception ex) {
Log.w(TAG, "Can't understand time zone definition", ex);
}
return null;
}
} }

@ -116,6 +116,10 @@ public class LocalCalendar extends LocalCollection<Event> {
values.put(Calendars.OWNER_ACCOUNT, account.name); values.put(Calendars.OWNER_ACCOUNT, account.name);
values.put(Calendars.SYNC_EVENTS, 1); values.put(Calendars.SYNC_EVENTS, 1);
values.put(Calendars.VISIBLE, 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()); Log.i(TAG, "Inserting calendar: " + values.toString() + " -> " + calendarsURI(account).toString());
client.insert(calendarsURI(account), values); client.insert(calendarsURI(account), values);
} }

@ -188,6 +188,7 @@ public class QueryServerDialogFragment extends DialogFragment implements LoaderC
resource.getDisplayName(), resource.getDisplayName(),
resource.getDescription(), resource.getColor() resource.getDescription(), resource.getColor()
); );
info.setTimezone(resource.getTimezone());
calendars.add(info); calendars.add(info);
} }

@ -39,5 +39,7 @@ public class ServerInfo implements Serializable {
final Type type; final Type type;
final String path, title, description, color; final String path, title, description, color;
String timezone;
} }
} }

@ -41,6 +41,9 @@ public class DavProp {
@Element(required=false,name="calendar-color") @Element(required=false,name="calendar-color")
DavPropCalendarColor calendarColor; DavPropCalendarColor calendarColor;
@Element(required=false,name="calendar-timezone")
DavPropCalendarTimezone calendarTimezone;
@Element(required=false) @Element(required=false)
DavPropGetCTag getctag; DavPropGetCTag getctag;
@ -108,6 +111,12 @@ public class DavProp {
@Getter private String color; @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/") @Namespace(prefix="CS",reference="http://calendarserver.org/ns/")
public static class DavPropGetCTag { public static class DavPropGetCTag {
@Text(required=false) @Text(required=false)

@ -54,6 +54,7 @@ public class HttpPropfind extends HttpEntityEnclosingRequestBase {
propfind.prop.addressbookDescription = new DavProp.DavPropAddressbookDescription(); propfind.prop.addressbookDescription = new DavProp.DavPropAddressbookDescription();
propfind.prop.calendarDescription = new DavProp.DavPropCalendarDescription(); propfind.prop.calendarDescription = new DavProp.DavPropCalendarDescription();
propfind.prop.calendarColor = new DavProp.DavPropCalendarColor(); propfind.prop.calendarColor = new DavProp.DavPropCalendarColor();
propfind.prop.calendarTimezone = new DavProp.DavPropCalendarTimezone();
break; break;
case COLLECTION_CTAG: case COLLECTION_CTAG:
depth = 0; depth = 0;

@ -47,6 +47,7 @@ import org.simpleframework.xml.core.Persister;
import android.util.Log; import android.util.Log;
import at.bitfire.davdroid.URIUtils; import at.bitfire.davdroid.URIUtils;
import at.bitfire.davdroid.resource.Event;
@ToString @ToString
@ -56,6 +57,7 @@ public class WebDavResource {
public enum Property { public enum Property {
CURRENT_USER_PRINCIPAL, CURRENT_USER_PRINCIPAL,
DISPLAY_NAME, DESCRIPTION, COLOR, DISPLAY_NAME, DESCRIPTION, COLOR,
TIMEZONE,
ADDRESSBOOK_HOMESET, CALENDAR_HOMESET, ADDRESSBOOK_HOMESET, CALENDAR_HOMESET,
IS_ADDRESSBOOK, IS_CALENDAR, IS_ADDRESSBOOK, IS_CALENDAR,
CTAG, ETAG, CTAG, ETAG,
@ -206,6 +208,10 @@ public class WebDavResource {
return properties.get(Property.COLOR); return properties.get(Property.COLOR);
} }
public String getTimezone() {
return properties.get(Property.TIMEZONE);
}
public String getAddressbookHomeSet() { public String getAddressbookHomeSet() {
return properties.get(Property.ADDRESSBOOK_HOMESET); return properties.get(Property.ADDRESSBOOK_HOMESET);
} }
@ -438,6 +444,9 @@ public class WebDavResource {
if (prop.calendarColor != null) if (prop.calendarColor != null)
referenced.properties.put(Property.COLOR, prop.calendarColor.getColor()); referenced.properties.put(Property.COLOR, prop.calendarColor.getColor());
if (prop.calendarTimezone != null)
referenced.properties.put(Property.TIMEZONE, Event.TimezoneDefToTzId(prop.calendarTimezone.getTimezone()));
} else } else
referenced.properties.remove(Property.IS_CALENDAR); referenced.properties.remove(Property.IS_CALENDAR);
} }

Loading…
Cancel
Save