See ChangeLog

Monotone-Parent: 75bbc0ad243d66dd412883811d759ca8dabf6776
Monotone-Revision: 11c0941cac8926d96e43efabe282a5d3d549d0c9

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-03-23T19:18:27
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Francis Lachapelle 2011-03-23 19:18:27 +00:00
parent d7d8c7a7f5
commit 3d53407a73
5 changed files with 73 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2011-03-23 Francis Lachapelle <flachapelle@inverse.ca>
* UI/PreferencesUI/UIxPreferences.m (-timeZonesList): we make use
of the new method [iCalTimeZone knownTimeZoneNames] instead of
[NSTimeZone knownTimeZoneNames] to avoid listing tons of useless timezones.
2011-03-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreCalendarMessage.m (-init): new method to

View File

@ -1,9 +1,15 @@
2011-03-23 francis <flachapelle@inverse.ca>
2011-03-23 Francis Lachapelle <flachapelle@inverse.ca>
* iCalRepeatableEntityObject.m (-removeAllExceptionDates): don't
use the method "exceptionDates" since it returns an array of
strings and not CardElement instances.
* iCalTimeZone.m (+knownTimeZoneNames): new class method to
retrieve the timezone names. Used in replacement of the same
method in NSTimeZone.
2011-03-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalEvent.m (-firstRecurrenceStartDate): new method that makes

View File

@ -33,6 +33,7 @@
@interface iCalTimeZone : CardGroup
+ (iCalTimeZone *) timeZoneForName: (NSString *) theName;
+ (NSArray *) knownTimeZoneNames;
- (NSString *) tzId;
- (iCalTimeZonePeriod *) periodForDate: (NSCalendarDate *) date;
- (NSCalendarDate *) computedDateForDate: (NSCalendarDate *) theDate;

View File

@ -41,6 +41,7 @@
#import "iCalTimeZone.h"
static NSMutableDictionary *cache;
static NSArray *knownTimeZones;
@implementation iCalTimeZone
@ -106,6 +107,62 @@ static NSMutableDictionary *cache;
return o;
}
/**
* Fetch the names of the available timezones for which we have a
* vTimeZone definition (.ics).
* @return an array of timezones names.
* @see [NSTimeZone knownTimeZoneNames]
*/
+ (NSArray *) knownTimeZoneNames
{
NSFileManager *fm;
NSEnumerator *e;
NSDirectoryEnumerator *zones;
NSArray *paths;
NSMutableArray *timeZoneNames;
NSString *path, *zone, *zonePath;
NSRange ext;
BOOL b;
timeZoneNames = knownTimeZones;
if (!timeZoneNames)
{
timeZoneNames = [NSMutableArray new];
paths = NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory,
NSAllDomainsMask,
YES);
fm = [NSFileManager defaultManager];
if ([paths count] > 0)
{
e = [paths objectEnumerator];
while ((path = [e nextObject]))
{
path = [NSString stringWithFormat: @"%@/Libraries/Resources/NGCards/TimeZones", path];
if ([fm fileExistsAtPath: path isDirectory: &b] && b)
{
zones = [fm enumeratorAtPath: path];
while ((zone = [zones nextObject])) {
zonePath = [NSString stringWithFormat: @"%@/%@", path, zone];
if ([fm fileExistsAtPath: zonePath isDirectory: &b] && !b)
{
ext = [zone rangeOfString: @".ics"];
zone = [zone substringToIndex: ext.location];
[timeZoneNames addObject: zone];
}
}
}
}
}
knownTimeZones = [timeZoneNames sortedArrayUsingSelector: @selector (localizedCaseInsensitiveCompare:)];
[knownTimeZones retain];
}
return timeZoneNames;
}
- (Class) classForTag: (NSString *) classTag
{
Class tagClass;

View File

@ -32,6 +32,8 @@
#import <NGExtensions/NSObject+Logs.h>
#import <NGCards/iCalTimeZone.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSDictionary+Utilities.h>
#import <SOGo/NSString+Utilities.h>
@ -149,8 +151,7 @@
- (NSArray *) timeZonesList
{
return [[NSTimeZone knownTimeZoneNames]
sortedArrayUsingSelector: @selector (localizedCaseInsensitiveCompare:)];
return [iCalTimeZone knownTimeZoneNames];
}
- (NSString *) userTimeZone