Loading core/java/android/provider/Calendar.java +0 −117 Original line number Diff line number Diff line Loading @@ -806,123 +806,6 @@ public final class Calendar { return null; } public static final Uri insertVEvent(ContentResolver cr, ICalendar.Component event, long calendarId, int status, ContentValues values) { // TODO: define VEVENT component names as constants in some // appropriate class (ICalendar.Component?). values.clear(); // title String title = extractValue(event, "SUMMARY"); if (TextUtils.isEmpty(title)) { if (Config.LOGD) { Log.d(TAG, "No SUMMARY provided for event. " + "Cannot import."); } return null; } values.put(TITLE, title); // status values.put(STATUS, status); // description String description = extractValue(event, "DESCRIPTION"); if (!TextUtils.isEmpty(description)) { values.put(DESCRIPTION, description); } // where String where = extractValue(event, "LOCATION"); if (!TextUtils.isEmpty(where)) { values.put(EVENT_LOCATION, where); } // Calendar ID values.put(CALENDAR_ID, calendarId); boolean timesSet = false; // TODO: deal with VALARMs // dtstart & dtend Time time = new Time(Time.TIMEZONE_UTC); String dtstart = null; String dtend = null; String duration = null; ICalendar.Property dtstartProp = event.getFirstProperty("DTSTART"); // TODO: handle "floating" timezone (no timezone specified). if (dtstartProp != null) { dtstart = dtstartProp.getValue(); if (!TextUtils.isEmpty(dtstart)) { ICalendar.Parameter tzidParam = dtstartProp.getFirstParameter("TZID"); if (tzidParam != null && tzidParam.value != null) { time.clear(tzidParam.value); } try { time.parse(dtstart); } catch (Exception e) { if (Config.LOGD) { Log.d(TAG, "Cannot parse dtstart " + dtstart, e); } return null; } if (time.allDay) { values.put(ALL_DAY, 1); } values.put(DTSTART, time.toMillis(false /* use isDst */)); values.put(EVENT_TIMEZONE, time.timezone); } ICalendar.Property dtendProp = event.getFirstProperty("DTEND"); if (dtendProp != null) { dtend = dtendProp.getValue(); if (!TextUtils.isEmpty(dtend)) { // TODO: make sure the timezones are the same for // start, end. try { time.parse(dtend); } catch (Exception e) { if (Config.LOGD) { Log.d(TAG, "Cannot parse dtend " + dtend, e); } return null; } values.put(DTEND, time.toMillis(false /* use isDst */)); } } else { // look for a duration ICalendar.Property durationProp = event.getFirstProperty("DURATION"); if (durationProp != null) { duration = durationProp.getValue(); if (!TextUtils.isEmpty(duration)) { // TODO: check that it is valid? values.put(DURATION, duration); } } } } if (TextUtils.isEmpty(dtstart) || (TextUtils.isEmpty(dtend) && TextUtils.isEmpty(duration))) { if (Config.LOGD) { Log.d(TAG, "No DTSTART or DTEND/DURATION defined."); } return null; } // rrule if (!RecurrenceSet.populateContentValues(event, values)) { return null; } return cr.insert(CONTENT_URI, values); } /** * The content:// style URL for this table */ Loading Loading
core/java/android/provider/Calendar.java +0 −117 Original line number Diff line number Diff line Loading @@ -806,123 +806,6 @@ public final class Calendar { return null; } public static final Uri insertVEvent(ContentResolver cr, ICalendar.Component event, long calendarId, int status, ContentValues values) { // TODO: define VEVENT component names as constants in some // appropriate class (ICalendar.Component?). values.clear(); // title String title = extractValue(event, "SUMMARY"); if (TextUtils.isEmpty(title)) { if (Config.LOGD) { Log.d(TAG, "No SUMMARY provided for event. " + "Cannot import."); } return null; } values.put(TITLE, title); // status values.put(STATUS, status); // description String description = extractValue(event, "DESCRIPTION"); if (!TextUtils.isEmpty(description)) { values.put(DESCRIPTION, description); } // where String where = extractValue(event, "LOCATION"); if (!TextUtils.isEmpty(where)) { values.put(EVENT_LOCATION, where); } // Calendar ID values.put(CALENDAR_ID, calendarId); boolean timesSet = false; // TODO: deal with VALARMs // dtstart & dtend Time time = new Time(Time.TIMEZONE_UTC); String dtstart = null; String dtend = null; String duration = null; ICalendar.Property dtstartProp = event.getFirstProperty("DTSTART"); // TODO: handle "floating" timezone (no timezone specified). if (dtstartProp != null) { dtstart = dtstartProp.getValue(); if (!TextUtils.isEmpty(dtstart)) { ICalendar.Parameter tzidParam = dtstartProp.getFirstParameter("TZID"); if (tzidParam != null && tzidParam.value != null) { time.clear(tzidParam.value); } try { time.parse(dtstart); } catch (Exception e) { if (Config.LOGD) { Log.d(TAG, "Cannot parse dtstart " + dtstart, e); } return null; } if (time.allDay) { values.put(ALL_DAY, 1); } values.put(DTSTART, time.toMillis(false /* use isDst */)); values.put(EVENT_TIMEZONE, time.timezone); } ICalendar.Property dtendProp = event.getFirstProperty("DTEND"); if (dtendProp != null) { dtend = dtendProp.getValue(); if (!TextUtils.isEmpty(dtend)) { // TODO: make sure the timezones are the same for // start, end. try { time.parse(dtend); } catch (Exception e) { if (Config.LOGD) { Log.d(TAG, "Cannot parse dtend " + dtend, e); } return null; } values.put(DTEND, time.toMillis(false /* use isDst */)); } } else { // look for a duration ICalendar.Property durationProp = event.getFirstProperty("DURATION"); if (durationProp != null) { duration = durationProp.getValue(); if (!TextUtils.isEmpty(duration)) { // TODO: check that it is valid? values.put(DURATION, duration); } } } } if (TextUtils.isEmpty(dtstart) || (TextUtils.isEmpty(dtend) && TextUtils.isEmpty(duration))) { if (Config.LOGD) { Log.d(TAG, "No DTSTART or DTEND/DURATION defined."); } return null; } // rrule if (!RecurrenceSet.populateContentValues(event, values)) { return null; } return cr.insert(CONTENT_URI, values); } /** * The content:// style URL for this table */ Loading