Monotone-Parent: 3153e42cfafdd9f2a07623a78af07f4b4e837945
Monotone-Revision: 94cd3c2d69b764a47aa3032dde40735f50a696c9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-01-06T19:21:15 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
1169e642e7
commit
62433faf35
10
ChangeLog
10
ChangeLog
|
@ -1,5 +1,15 @@
|
|||
2010-01-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/Scheduler/UIxDatePicker.m
|
||||
(-takeValuesFromRequest:inContext:): we set the new date to the
|
||||
user's timezone and recompute the proper offset compare to the
|
||||
system timezone, which may differ from it.
|
||||
|
||||
* SoObjects/Appointments/iCalEntityObject+SOGo.m
|
||||
(-quickRecordDateAsNumber:withOffset:forAllDay:): we only need to
|
||||
compute the delta between the user's timezone and UTC rather than
|
||||
the system timezone.
|
||||
|
||||
* SoObjects/Mailer/SOGoMailNamespace.m
|
||||
(-lookupName:inContext:acquire:): overriden method because the
|
||||
namespace "folders" cannot be created and cannot contain messages.
|
||||
|
|
|
@ -34,40 +34,16 @@
|
|||
#import <NGObjWeb/WOApplication.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
|
||||
#import <SoObjects/SOGo/NSArray+Utilities.h>
|
||||
#import <SoObjects/SOGo/SOGoUser.h>
|
||||
#import <SoObjects/SOGo/SOGoUserDefaults.h>
|
||||
#import <SOGo/NSArray+Utilities.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
|
||||
#import "iCalPerson+SOGo.h"
|
||||
|
||||
#import "iCalEntityObject+SOGo.h"
|
||||
|
||||
static int utcOffset = -1;
|
||||
|
||||
@implementation iCalEntityObject (SOGoExtensions)
|
||||
|
||||
static inline int
|
||||
_computeAllDayOffset()
|
||||
{
|
||||
NSTimeZone *tz;
|
||||
SOGoUser *user;
|
||||
WOApplication *application;
|
||||
int offset;
|
||||
|
||||
if (utcOffset == -1)
|
||||
{
|
||||
tz = [[NSCalendarDate date] timeZone];
|
||||
utcOffset = [tz secondsFromGMT];
|
||||
}
|
||||
|
||||
application = [WOApplication application];
|
||||
user = [[application context] activeUser];
|
||||
tz = [[user userDefaults] timeZone];
|
||||
offset = utcOffset - [tz secondsFromGMT];
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
+ (void) initializeSOGoExtensions;
|
||||
{
|
||||
if (!iCalDistantFuture)
|
||||
|
@ -228,7 +204,7 @@ _computeAllDayOffset()
|
|||
{
|
||||
seconds = [_date timeIntervalSince1970] + offset;
|
||||
if (allDay)
|
||||
seconds += _computeAllDayOffset ();
|
||||
seconds += [[_date timeZone] secondsFromGMT];
|
||||
|
||||
dateNumber = [NSNumber numberWithInt: seconds];
|
||||
}
|
||||
|
|
|
@ -21,11 +21,15 @@
|
|||
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
|
||||
#import <NGObjWeb/WOContext.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
|
||||
#import "UIxDatePicker.h"
|
||||
|
||||
@implementation UIxDatePicker
|
||||
|
@ -144,6 +148,9 @@
|
|||
{
|
||||
NSString *dateString;
|
||||
NSCalendarDate *d;
|
||||
NSInteger dateTZOffset, userTZOffset;
|
||||
NSTimeZone *userTZ;
|
||||
SOGoUserDefaults *ud;
|
||||
|
||||
dateString = [_rq formValueForKey:[self dateID]];
|
||||
if (dateString == nil) {
|
||||
|
@ -158,6 +165,18 @@
|
|||
dateString];
|
||||
}
|
||||
|
||||
/* we must adjust the date timezone because "dateWithString:..." uses the
|
||||
system timezone, which can be different from the user's. */
|
||||
ud = [[_ctx activeUser] userDefaults];
|
||||
dateTZOffset = [[d timeZone] secondsFromGMT];
|
||||
userTZ = [ud timeZone];
|
||||
userTZOffset = [userTZ secondsFromGMT];
|
||||
if (dateTZOffset != userTZOffset)
|
||||
d = [d dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: (dateTZOffset - userTZOffset)];
|
||||
[d setTimeZone: userTZ];
|
||||
|
||||
[self setDay: [NSNumber numberWithInt:[d dayOfMonth]]];
|
||||
[self setMonth:[NSNumber numberWithInt:[d monthOfYear]]];
|
||||
[self setYear: [NSNumber numberWithInt:[d yearOfCommonEra]]];
|
||||
|
|
Loading…
Reference in New Issue