diff --git a/ChangeLog b/ChangeLog index 142acca3a..afa71f055 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-09-05 Wolfgang Sourdeau + + * UI/SOGoUI/UIxComponent.m ([UIxComponent -init]): new + "viewTimeZone" ivar destined to hold an instance of the user's + timezone in memory. + ([UIxComponent -viewTimeZone]): take the timezone from the user's + prefs. + 2006-08-30 Wolfgang Sourdeau * UI/Templates/SchedulerUI/UIxAppointmentEditor.wox: completely diff --git a/UI/SOGoUI/UIxComponent.h b/UI/SOGoUI/UIxComponent.h index 7dc606246..bfcf238f5 100644 --- a/UI/SOGoUI/UIxComponent.h +++ b/UI/SOGoUI/UIxComponent.h @@ -37,6 +37,7 @@ @interface UIxComponent : SoComponent { NSMutableDictionary *queryParameters; + NSTimeZone *viewTimeZone; } - (NSString *)queryParameterForKey:(NSString *)_key; diff --git a/UI/SOGoUI/UIxComponent.m b/UI/SOGoUI/UIxComponent.m index 203bdf1d6..50fc0e554 100644 --- a/UI/SOGoUI/UIxComponent.m +++ b/UI/SOGoUI/UIxComponent.m @@ -26,6 +26,8 @@ #import #import +#import + @interface UIxComponent (PrivateAPI) - (void)_parseQueryString:(NSString *)_s; - (NSMutableDictionary *)_queryParameters; @@ -33,7 +35,6 @@ @implementation UIxComponent -static NSTimeZone *MET = nil; static NSTimeZone *GMT = nil; static NSMutableArray *dayLabelKeys = nil; @@ -56,10 +57,9 @@ static BOOL uixDebugEnabled = NO; uixDebugEnabled = [ud boolForKey:@"SOGoUIxDebugEnabled"]; - if (MET == nil) { - MET = [[NSTimeZone timeZoneWithAbbreviation:@"MET"] retain]; + if (!GMT) GMT = [[NSTimeZone timeZoneWithAbbreviation:@"GMT"] retain]; - } + if (dayLabelKeys == nil) { dayLabelKeys = [[NSMutableArray alloc] initWithCapacity:7]; [dayLabelKeys addObject:@"Sunday"]; @@ -109,8 +109,21 @@ static BOOL uixDebugEnabled = NO; } } -- (void)dealloc { +- (id) init +{ + if ((self = [super init])) + { + viewTimeZone = nil; + } + + return self; +} + +- (void) dealloc +{ [self->queryParameters release]; + if (viewTimeZone) + [viewTimeZone release]; [super dealloc]; } @@ -307,9 +320,21 @@ static BOOL uixDebugEnabled = NO; /* date */ -- (NSTimeZone *)viewTimeZone { - // Note: also in the folder, should be based on a cookie? - return MET; +- (NSTimeZone *) viewTimeZone +{ + NSUserDefaults *userPrefs; + SOGoUser *currentUser; + + if (!viewTimeZone) + { + currentUser = [[self context] activeUser]; + userPrefs = [currentUser userDefaults]; + viewTimeZone = [NSTimeZone timeZoneWithName: + [userPrefs stringForKey: @"timezonename"]]; + [viewTimeZone retain]; + } + + return viewTimeZone; } - (NSTimeZone *)backendTimeZone {