From ca0fc0476eadf7b2b7fc2363852a4c726133aff4 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Mon, 10 Mar 2008 05:02:26 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1387 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOPE/NGCards/ChangeLog | 11 +++++++++++ SOPE/NGCards/iCalRecurrenceRule.h | 14 +++++++------- SOPE/NGCards/iCalRecurrenceRule.m | 8 ++++---- SOPE/NGCards/iCalTimeZonePeriod.m | 10 ++++------ 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index a3644f07..7abe74ab 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,14 @@ +2008-03-10 Wolfgang Sourdeau + + * iCalTimeZonePeriod.m ([iCalTimeZonePeriod + -dayOfWeekFromRruleDay:day]): the algorithm would never work if + the day was monday. After it was changed for sunday (see below), + it would return 1 instead of 0. + + * iCalRecurrenceRule.m ([iCalRecurrenceRule -setByDayMask:_mask]): + the first day of the week is always sunday, following Apple's + documentation. + 2008-03-03 Wolfgang Sourdeau * NGVCardReference.[hm]: new class module that implements the base diff --git a/SOPE/NGCards/iCalRecurrenceRule.h b/SOPE/NGCards/iCalRecurrenceRule.h index 478f507f..54542229 100644 --- a/SOPE/NGCards/iCalRecurrenceRule.h +++ b/SOPE/NGCards/iCalRecurrenceRule.h @@ -46,13 +46,13 @@ typedef enum { } iCalRecurrenceFrequency; typedef enum { - iCalWeekDayMonday = 1, - iCalWeekDayTuesday = 2, - iCalWeekDayWednesday = 4, - iCalWeekDayThursday = 8, - iCalWeekDayFriday = 16, - iCalWeekDaySaturday = 32, - iCalWeekDaySunday = 64, + iCalWeekDaySunday = 1, + iCalWeekDayMonday = 2, + iCalWeekDayTuesday = 4, + iCalWeekDayWednesday = 8, + iCalWeekDayThursday = 16, + iCalWeekDayFriday = 32, + iCalWeekDaySaturday = 64, } iCalWeekDay; @class NSString, NSCalendarDate, NGCalendarDateRange, NSArray; diff --git a/SOPE/NGCards/iCalRecurrenceRule.m b/SOPE/NGCards/iCalRecurrenceRule.m index f53f7988..3ce38f1a 100644 --- a/SOPE/NGCards/iCalRecurrenceRule.m +++ b/SOPE/NGCards/iCalRecurrenceRule.m @@ -277,10 +277,10 @@ { NSMutableArray *days; unsigned int count; - unsigned char maskDays[] = { iCalWeekDayMonday, iCalWeekDayTuesday, - iCalWeekDayWednesday, iCalWeekDayThursday, - iCalWeekDayFriday, iCalWeekDaySaturday, - iCalWeekDaySunday }; + unsigned char maskDays[] = { iCalWeekDaySunday, iCalWeekDayMonday, + iCalWeekDayTuesday, iCalWeekDayWednesday, + iCalWeekDayThursday, iCalWeekDayFriday, + iCalWeekDaySaturday }; days = [NSMutableArray arrayWithCapacity: 7]; if (_mask) { diff --git a/SOPE/NGCards/iCalTimeZonePeriod.m b/SOPE/NGCards/iCalTimeZonePeriod.m index dc1f611f..b5380f11 100644 --- a/SOPE/NGCards/iCalTimeZonePeriod.m +++ b/SOPE/NGCards/iCalTimeZonePeriod.m @@ -92,8 +92,8 @@ { unsigned int dayOfWeek; - dayOfWeek = 1; - while (day >> dayOfWeek) + dayOfWeek = 0; + while (day >> (dayOfWeek + 1)) dayOfWeek++; return dayOfWeek; @@ -120,10 +120,8 @@ day: 0 hour: 0 minute: 0 second: -[self _secondsOfOffset: @"tzoffsetfrom"]]; dateDayOfWeek = [tmpDate dayOfWeek]; - offset = (dayOfWeek - dateDayOfWeek); - if (pos > 0 && offset < 0) - offset += 7; - offset += (pos * 7); +// #warning FIXME + offset = (dayOfWeek - dateDayOfWeek) + ((pos -1 ) * 7); tmpDate = [tmpDate addYear: 0 month: 0 day: offset hour: 0 minute: 0 second: 0]; -- 2.39.5