From 79629a99417ad969ca91d358690d1aef2559e9ea Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 10 Mar 2011 22:21:53 +0000 Subject: [PATCH] See Changelog. Monotone-Parent: 8871093b60112022ab57314a530ebc53dabf0d75 Monotone-Revision: a15dbfb88dbe373949a0883880ab6b6e0175e72b Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-03-10T22:21:53 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 +++ SoObjects/Appointments/SOGoAppointmentFolder.m | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a469fb996..b9e97fd42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-03-10 Francis Lachapelle + * SoObjects/Appointments/SOGoAppointmentFolder.m (-fixupRecord): + the time of all-day events must be adjusted for the user's timezone. + * UI/WebServerResources/UIxContactEditor.js (initEditorForm): the input category field doesn't appear if the card is read-only. Adjusted the code accordingly. diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index ea3d7123e..eb6ced14b 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -579,7 +579,7 @@ static NSNumber *sharedYes = nil; /** * Set the timezone of the event start and end dates to the user's timezone. - * @param theRecord an dictionnary with the attributes of the event. + * @param theRecord a dictionnary with the attributes of the event. * @return a copy of theRecord with adjusted dates. */ - (NSMutableDictionary *) fixupRecord: (NSDictionary *) theRecord @@ -590,6 +590,7 @@ static NSNumber *sharedYes = nil; unsigned int count; NSCalendarDate *date; NSNumber *dateValue; + unsigned int offset; record = [[theRecord mutableCopy] autorelease]; for (count = 0; count < 2; count++) @@ -601,6 +602,15 @@ static NSNumber *sharedYes = nil; if (date) { [date setTimeZone: timeZone]; + if ([[theRecord objectForKey: @"c_isallday"] boolValue]) + { + // Since there's no timezone associated to all-day events, + // their time must be adjusted for the user's timezone. + offset = [timeZone secondsFromGMTForDate: date]; + date = (NSCalendarDate*)[date dateByAddingYears:0 months:0 days:0 hours:0 minutes:0 + seconds:-offset]; + [record setObject: [NSNumber numberWithInt: [dateValue intValue] - offset] forKey: fields[count * 2]]; + } [record setObject: date forKey: fields[count * 2 + 1]]; } }