See ChangeLog

Monotone-Parent: 3931b3fc847a4504339f11bcd48a3ea417c822b0
Monotone-Revision: ddf277f21cd816fe481bf94c7ec4b59815233bf7

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-03-23T20:42:01
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Francis Lachapelle 2011-03-23 20:42:01 +00:00
parent 9197155933
commit fc2abaaf0a
2 changed files with 49 additions and 2 deletions

View File

@ -12,6 +12,11 @@
of the new method [iCalTimeZone knownTimeZoneNames] instead of
[NSTimeZone knownTimeZoneNames] to avoid listing tons of useless timezones.
* UI/PreferencesUI/UIxPreferences.m (-userTimeZone): since we now
offer a limited number of timezones, the user timezone could be
unrecognized. In this case, try to find a timezone with the same
GMT offset.
2011-03-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreCalendarMessage.m (-init): new method to

View File

@ -1,8 +1,9 @@
/* UIxPreferences.m - this file is part of SOGo
*
* Copyright (C) 2007-2010 Inverse inc.
* Copyright (C) 2007-2011 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Francis Lachapelle <flachapelle@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,6 +34,7 @@
#import <NGExtensions/NSObject+Logs.h>
#import <NGCards/iCalTimeZone.h>
#import <NGCards/iCalTimeZonePeriod.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSDictionary+Utilities.h>
@ -156,7 +158,47 @@
- (NSString *) userTimeZone
{
return [userDefaults timeZoneName];
NSString *name;
iCalTimeZone *tz;
name = [userDefaults timeZoneName];
tz = [iCalTimeZone timeZoneForName: name];
if (!tz)
{
// The specified timezone is not in our Olson database.
// Look for a known timezone with the same GMT offset.
NSString *current;
NSCalendarDate *now;
NSEnumerator *zones;
BOOL found;
unsigned int offset;
found = NO;
now = [NSCalendarDate calendarDate];
offset = [[userDefaults timeZone] secondsFromGMTForDate: now];
zones = [[iCalTimeZone knownTimeZoneNames] objectEnumerator];
while ((current = [zones nextObject]))
{
tz = [iCalTimeZone timeZoneForName: current];
if ([[tz periodForDate: now] secondsOffsetFromGMT] == offset)
{
found = YES;
break;
}
}
if (found)
{
[self warnWithFormat: @"User %@ has an unknown timezone (%@) -- replaced by %@", [user login], name, current];
name = current;
}
else
[self errorWithFormat: @"User %@ has an unknown timezone (%@)", [user login], name];
}
return name;
}
- (void) setUserTimeZone: (NSString *) newUserTimeZone