Monotone-Parent: 1a0f96fd588d7f7edaa7a85a352ab39c2acbca70

Monotone-Revision: b0d54fb9b69827b08042c1be219b87648b1a9df2

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-12-01T16:53:15
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2009-12-01 16:53:15 +00:00
parent ee001b16ab
commit b9a5c1e750
8 changed files with 127 additions and 69 deletions

View File

@@ -26,7 +26,6 @@
#import <Foundation/NSTimeZone.h>
#import "NSString+Utilities.h"
#define NEEDS_DEFAULTS_SOURCE_INTERNAL 1
#import "SOGoDomainDefaults.h"
#import "SOGoSystemDefaults.h"
#import "SOGoUserProfile.h"
@@ -147,6 +146,33 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
return rc;
}
- (BOOL) _migrateCalendarCategories
{
NSArray *categories, *colors;
NSDictionary *newColors;
BOOL rc;
colors = [source objectForKey: @"SOGoCalendarCategoriesColors"];
if ([colors isKindOfClass: [NSArray class]])
{
categories = [source objectForKey: @"SOGoCalendarCategories"];
if ([categories count] == [colors count])
{
newColors = [NSDictionary dictionaryWithObjects: colors
forKeys: categories];
[source setObject: newColors
forKey: @"SOGoCalendarCategoriesColors"];
}
else
[source removeObjectForKey: @"SOGoCalendarCategoriesColors"];
rc = YES;
}
else
rc = NO;
return rc;
}
- (BOOL) migrate
{
static NSDictionary *migratedKeys = nil;
@@ -185,6 +211,7 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
not be invoked in the case where rc = YES. */
return ([self _migrateLastModule]
| [self _migrateSignature]
| [self _migrateCalendarCategories]
| [self migrateOldDefaultsWithDictionary: migratedKeys]
| [super migrate]);
}
@@ -490,14 +517,14 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
return [self stringArrayForKey: @"SOGoCalendarCategories"];
}
- (void) setCalendarCategoriesColors: (NSArray *) newValues
- (void) setCalendarCategoriesColors: (NSDictionary *) newValues
{
[self setObject: newValues forKey: @"SOGoCalendarCategoriesColors"];
}
- (NSArray *) calendarCategoriesColors
- (NSDictionary *) calendarCategoriesColors
{
return [self stringArrayForKey: @"SOGoCalendarCategoriesColors"];
return [self dictionaryForKey: @"SOGoCalendarCategoriesColors"];
}
- (void) setCalendarShouldDisplayWeekend: (BOOL) newValue