diff options
author | JP Rosevear <jpr@ximian.com> | 2001-10-02 22:37:30 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-10-02 22:37:30 +0800 |
commit | 7e61b6213f906bf5da46dffb19a847d37710ddd3 (patch) | |
tree | cbacf64b4bf23c5b05f8510ab05066771aaeb462 /calendar | |
parent | 1f42dd58510c9ba39863242c6da2d9d8fe024c1c (diff) | |
download | gsoc2013-evolution-7e61b6213f906bf5da46dffb19a847d37710ddd3.tar.gz gsoc2013-evolution-7e61b6213f906bf5da46dffb19a847d37710ddd3.tar.zst gsoc2013-evolution-7e61b6213f906bf5da46dffb19a847d37710ddd3.zip |
handle -1 as well (comp_from_remote_record): fix monthly by day
2001-10-02 JP Rosevear <jpr@ximian.com>
* conduits/calendar/calendar-conduit.c (nth_weekday): handle -1 as
well
(comp_from_remote_record): fix monthly by day recurrences and
handle "last" day type
svn path=/trunk/; revision=13300
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 7 | ||||
-rw-r--r-- | calendar/conduits/calendar/calendar-conduit.c | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index dbb63ec191..d4644fad33 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2001-10-02 JP Rosevear <jpr@ximian.com> + + * conduits/calendar/calendar-conduit.c (nth_weekday): handle -1 as + well + (comp_from_remote_record): fix monthly by day recurrences and + handle "last" day type + 2001-10-01 Damon Chaplin <damon@ximian.com> * gui/dialogs/comp-editor.c (comp_editor_destroy): unref the page diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index 0301cbfb90..676d65462c 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -326,9 +326,9 @@ is_empty_time (struct tm time) static short nth_weekday (int pos, icalrecurrencetype_weekday weekday) { - g_assert (pos > 0 && pos <= 5); + g_assert ((pos > 0 && pos <= 5) || (pos == -1)); - return (pos << 3) | (int) weekday; + return ((abs (pos) * 8) + weekday) * (pos < 0 ? -1 : 1); } static GList * @@ -704,7 +704,11 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, case repeatMonthlyByDay: recur.freq = ICAL_MONTHLY_RECURRENCE; recur.interval = appt.repeatFrequency; - recur.by_day[0] = nth_weekday (appt.repeatDay / 5, get_ical_day (appt.repeatDay % 5 - 1)); + if (appt.repeatDay < domLastSun) + recur.by_day[0] = nth_weekday ((appt.repeatDay / 7) + 1, + get_ical_day (appt.repeatDay % 7)); + else + recur.by_day[0] = nth_weekday (-1, get_ical_day (appt.repeatDay % 7)); break; case repeatMonthlyByDate: |