From c2dec4f1cb8038145c77101218cb9ac1c179b9a4 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 11 Apr 2012 17:57:54 +0000 Subject: [PATCH] See SOPE/NGCards/ChangeLog. Monotone-Parent: d03d201f9e10ea4b211b8adbb66f692be8661797 Monotone-Revision: 8084a82ca1ab7dad7f78c35f529f9e3db7d02314 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2012-04-11T17:57:54 --- NEWS | 4 ++- SOPE/NGCards/ChangeLog | 8 ++++++ SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m | 27 +++++++++---------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index 2a4b56934..daab2a228 100644 --- a/NEWS +++ b/NEWS @@ -3,12 +3,14 @@ New Features - Sources address books are now exposed in Apple and iOS AddressBook app using the "directory gateway" extension of CardDAV + - sogo-tool: new "expire-sessions" command Enhancements - - + - Updated Spanish (Argentina) translation Bug Fixes - fixed wrong date validation in preferences module affecting French users + - fixed bugs in weekly recurrence calculator 1.3.14 (2012-03-23) ------------------- diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index db2b2b1b0..359a14592 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,11 @@ +2012-04-11 Francis Lachapelle + + * iCalWeeklyRecurrenceCalculator.m + (-recurrenceRangesWithinCalendarDateRange): we now return + occurrences that intersects with the period (not only occurrences + within the period). We no longer rely on NSCalendarDate to compute + the number of days since the master event start date (it is bugged). + 2012-03-26 Wolfgang Sourdeau * iCalDateTime.m (_setDateTime:forAllDayEntity:): set or unset the diff --git a/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m b/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m index 41ed0dc0f..f49536646 100644 --- a/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m +++ b/SOPE/NGCards/iCalWeeklyRecurrenceCalculator.m @@ -1,6 +1,6 @@ /* Copyright (C) 2004-2005 SKYRIX Software AG - Copyright (C) 2006-2010 Inverse inc. + Copyright (C) 2006-2012 Inverse inc. This file is part of SOPE. @@ -85,7 +85,7 @@ dayMask = [rrule byDayMask]; // If rule is bound, check the bounds - if (![rrule isInfinite]) + if (![rrule isInfinite]) { NSCalendarDate *until, *lastDate; @@ -118,7 +118,7 @@ currentStartDate = [firStart copy]; [currentStartDate autorelease]; ranges = [NSMutableArray array]; - i = 1; + i = 0; count = 0; if (dayMask == nil) @@ -137,10 +137,10 @@ if ([_r containsDateRange: r]) [ranges addObject: r]; } + i++; currentStartDate = [firStart dateByAddingYears: 0 months: 0 days: (interval * i * 7)]; - i++; } } else @@ -151,28 +151,25 @@ [currentStartDate compare: endDate] == NSOrderedSame) { BOOL isRecurrence = NO; - NSInteger days, week; + NSInteger week; if (repeatCount > 0 || [startDate compare: currentStartDate] == NSOrderedAscending || [startDate compare: currentStartDate] == NSOrderedSame) { // If the rule count is defined, stop once the count is reached. - if (i == 1) + if (i == 0) { - // Always add the start date the recurring event if within + // Always add the start date of the recurring event if within // the lookup range. isRecurrence = YES; } else { - [currentStartDate years:NULL months:NULL days:&days hours:NULL - minutes:NULL seconds:NULL sinceDate: firStart]; - - // The following adjustment always set the first day of the - // week to Sunday, ie WKST is ignored. - week = (days + [firStart dayOfWeek]) / 7; - + // The following always set the first day of the week as the day + // of the master event start date, ie WKST is ignored. + week = i / 7; + if ((week % interval) == 0 && [dayMask occursOnDay: [currentStartDate dayOfWeek]]) isRecurrence = YES; @@ -187,7 +184,7 @@ r = [NGCalendarDateRange calendarDateRangeWithStartDate: currentStartDate endDate: currentEndDate]; - if ([_r containsDateRange: r]) + if ([_r doesIntersectWithDateRange: r]) [ranges addObject: r]; } }