View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000253 | SOGo | Web Preferences | public | 2009-11-19 05:25 | 2009-12-22 17:12 |
Reporter | ayearout | Assigned To | ludovic | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Product Version | 1.1.0 | ||||
Fixed in Version | 1.2.0 | ||||
Summary | 0000253: Specify default categories for preferences and calendar module | ||||
Description | I needed a way to specify a default set of categories and category colors using the defaults tool. Attached is my patch that alleviates this problem. This patch references two new available preferences, SOGoCalendarCategories and SOGoCalendarCategoriesColors. In the future, sanity checking to insure that the number of colors matches the number of categories would probably be good. | ||||
Tags | No tags attached. | ||||
2009-11-19 05:25
|
sogo-default-categories.diff (2,037 bytes)
--- SOGo-1.1.0.orig/UI/PreferencesUI/UIxPreferences.m 2009-11-18 19:30:17.000000000 -0800 +++ SOGo-1.1.0/UI/PreferencesUI/UIxPreferences.m 2009-11-18 21:03:54.000000000 -0800 @@ -984,17 +984,28 @@ NSDictionary *element; NSArray *k, *v, *names; NSMutableArray *rc, *colors; + NSUserDefaults *standardDefaults; + int i, count; + standardDefaults = [NSUserDefaults standardUserDefaults]; + names = [userDefaults arrayForKey: @"CalendarCategories"]; - if (names) - colors = [NSMutableArray arrayWithArray: - [userDefaults arrayForKey: @"CalendarCategoriesColors"]]; - else + colors = [NSMutableArray arrayWithArray: + [userDefaults arrayForKey: @"CalendarCategoriesColors"]]; + if (!names) { + names = [standardDefaults arrayForKey: @"SOGoCalendarCategories"]; + colors = [NSMutableArray arrayWithArray: + [standardDefaults arrayForKey: @"SOGoCalendarCategoriesColors"]]; + } + + if (!names) names = [[self labelForKey: @"category_labels"] componentsSeparatedByString: @","]; + if (!colors) + { count = [names count]; colors = [NSMutableArray arrayWithCapacity: count]; for (i = 0; i < count; i++) --- SOGo-1.1.0.orig/UI/Scheduler/UIxComponentEditor.m 2009-11-18 19:30:17.000000000 -0800 +++ SOGo-1.1.0/UI/Scheduler/UIxComponentEditor.m 2009-11-18 20:33:48.000000000 -0800 @@ -825,11 +825,14 @@ { NSMutableArray *categoryList; NSArray *categoryLabels; - NSUserDefaults *defaults; + NSUserDefaults *defaults, *standardDefaults; defaults = [[context activeUser] userDefaults]; + standardDefaults = [NSUserDefaults standardUserDefaults]; categoryLabels = [defaults arrayForKey: @"CalendarCategories"]; if (!categoryLabels) + categoryLabels = [standardDefaults arrayForKey: @"SOGoCalendarCategories"]; + if (!categoryLabels) categoryLabels = [[self labelForKey: @"category_labels"] componentsSeparatedByString: @","]; categoryList |
This is now supported with the recent refactorings (for preferences handling). |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2009-11-19 05:25 | ayearout | New Issue | |
2009-11-19 05:25 | ayearout | File Added: sogo-default-categories.diff | |
2009-12-22 17:12 | ludovic | Note Added: 0000368 | |
2009-12-22 17:12 | ludovic | Status | new => resolved |
2009-12-22 17:12 | ludovic | Fixed in Version | => 1.2.0 |
2009-12-22 17:12 | ludovic | Resolution | open => fixed |
2009-12-22 17:12 | ludovic | Assigned To | => ludovic |