From 6b70e8480dac6815a4624c063d3caceb6ae44b1a Mon Sep 17 00:00:00 2001 From: C Robert Date: Tue, 21 Jul 2009 18:06:55 +0000 Subject: [PATCH] Mantis 22 Monotone-Parent: 5105aa2c752693060f4e82dcab091d78516d579f Monotone-Revision: 002cfad9d108ff7c2b34603852b074ecd764cf96 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-07-21T18:06:55 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 12 +++ .../Appointments/SOGoAppointmentFolder.h | 6 ++ .../Appointments/SOGoAppointmentFolder.m | 86 +++++++++++++++++++ SoObjects/SOGo/SOGoGCSFolder.m | 8 ++ .../Localizable.strings | 3 + UI/Scheduler/Czech.lproj/Localizable.strings | 3 + UI/Scheduler/Dutch.lproj/Localizable.strings | 3 + .../English.lproj/Localizable.strings | 3 + UI/Scheduler/French.lproj/Localizable.strings | 3 + UI/Scheduler/German.lproj/Localizable.strings | 3 + .../Italian.lproj/Localizable.strings | 3 + .../Russian.lproj/Localizable.strings | 3 + .../Spanish.lproj/Localizable.strings | 3 + UI/Scheduler/UIxCalListingActions.m | 5 +- UI/Scheduler/UIxCalendarProperties.h | 3 + UI/Scheduler/UIxCalendarProperties.m | 26 +++++- UI/Scheduler/Welsh.lproj/Localizable.strings | 3 + .../SchedulerUI/UIxCalendarProperties.wox | 10 ++- UI/WebServerResources/SchedulerUI.js | 4 +- .../UIxCalendarProperties.css | 2 +- 20 files changed, 187 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index bae537113..6c5d3fe89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-07-21 Cyril Robert + + * UI/Scheduler/UIxCalendarProperties.m: Prevent doing anything when not + executing @"saveProperties". + * SoObjects/Appointments/SOGoAppointmentFolder.m: Added + (set/showCalendarTasks), (set/showCalendarAlarms) + * SoObjects/SOGo/SOGoGCSFolder.m: Added dicts to cleanup on unsubscribe. + * UI/Scheduler/UIxCalListingActions.m: Added support for + showCalendarAlarms/Tasks. + * UI/Scheduler/UIxCalendarProperties.m: Added wrapper methods for + showCalendarTasks/Alarms + 2009-07-21 Francis Lachapelle * SoObjects/Mailer/SOGoMailBodyPart.m ([SOGoMailBodyPart diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.h b/SoObjects/Appointments/SOGoAppointmentFolder.h index a5cad1562..dd4e69243 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoAppointmentFolder.h @@ -131,6 +131,12 @@ - (NSString *) roleForComponentsWithAccessClass: (iCalAccessClass) accessClass forUser: (NSString *) uid; +- (BOOL) showCalendarAlarms; +- (void) setShowCalendarAlarms: (BOOL) new; + +- (BOOL) showCalendarTasks; +- (void) setShowCalendarTasks: (BOOL) new; + @end #endif /* __Appointments_SOGoAppointmentFolder_H__ */ diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index f00d1dfe0..786cbc296 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -319,6 +319,92 @@ static int davCalendarStartTimeLimit = 0; [settings synchronize]; } +- (BOOL) showCalendarAlarms +{ + NSUserDefaults *settings; + NSDictionary *values; + id test; + BOOL show = YES; + + settings = [[context activeUser] userSettings]; + values = [[settings objectForKey: @"Calendar"] + objectForKey: @"FolderShowAlarms"]; + test = [values objectForKey: [self folderReference]]; + if (test) + show = [test boolValue]; + + return show; +} + +- (void) setShowCalendarAlarms: (BOOL) new +{ + NSUserDefaults *settings; + NSMutableDictionary *calendarSettings; + NSMutableDictionary *values; + + settings = [[context activeUser] userSettings]; + calendarSettings = [settings objectForKey: @"Calendar"]; + + if (!calendarSettings) + { + calendarSettings = [NSMutableDictionary dictionary]; + [settings setObject: calendarSettings + forKey: @"Calendar"]; + } + values = [calendarSettings objectForKey: @"FolderShowAlarms"]; + if (!values) + { + values = [NSMutableDictionary dictionary]; + [calendarSettings setObject: values forKey: @"FolderShowAlarms"]; + } + [values setObject: [NSNumber numberWithBool: new] forKey: [self folderReference]]; + [settings synchronize]; +} + +- (BOOL) showCalendarTasks +{ + NSUserDefaults *settings; + NSDictionary *values; + id test; + BOOL show = YES; + + settings = [[context activeUser] userSettings]; + values = [[settings objectForKey: @"Calendar"] + objectForKey: @"FolderShowTasks"]; + test = [values objectForKey: [self folderReference]]; + if (test) + show = [test boolValue]; + + return show; +} + +- (void) setShowCalendarTasks: (BOOL) new +{ + NSUserDefaults *settings; + NSMutableDictionary *calendarSettings; + NSMutableDictionary *values; + + settings = [[context activeUser] userSettings]; + calendarSettings = [settings objectForKey: @"Calendar"]; + + if (!calendarSettings) + { + calendarSettings = [NSMutableDictionary dictionary]; + [settings setObject: calendarSettings + forKey: @"Calendar"]; + } + values = [calendarSettings objectForKey: @"FolderShowTasks"]; + if (!values) + { + values = [NSMutableDictionary dictionary]; + [calendarSettings setObject: values forKey: @"FolderShowTasks"]; + } + [values setObject: [NSNumber numberWithBool: new] forKey: [self folderReference]]; + [settings synchronize]; +} + + + - (NSString *) syncTag { NSUserDefaults *settings; diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 5150dc6ef..a9d3e8d15 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -696,6 +696,14 @@ static NSArray *childRecordFields = nil; if (tmpD) [tmpD removeObjectForKey: subscriptionPointer]; + tmpD = [moduleSettings objectForKey: @"FolderShowAlarms"]; + if (tmpD) + [tmpD removeObjectForKey: subscriptionPointer]; + + tmpD = [moduleSettings objectForKey: @"FolderShowTasks"]; + if (tmpD) + [tmpD removeObjectForKey: subscriptionPointer]; + tmpA = [moduleSettings objectForKey: @"InactiveFolders"]; if (tmpA) [tmpA removeObject: nameInContainer]; diff --git a/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings b/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings index 914ba80e2..de0399ff1 100755 --- a/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings +++ b/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings @@ -497,3 +497,6 @@ vtodo_class2 = "(Tarefa Confidencial)"; "Name:" = "Nome:"; "Color:" = "Cor:"; "Tag:" = "Marca:"; + +"Show alarms" = "Show alarms"; +"Show tasks" = "Show tasks"; diff --git a/UI/Scheduler/Czech.lproj/Localizable.strings b/UI/Scheduler/Czech.lproj/Localizable.strings index fa7e66bf3..88f769876 100755 --- a/UI/Scheduler/Czech.lproj/Localizable.strings +++ b/UI/Scheduler/Czech.lproj/Localizable.strings @@ -497,3 +497,6 @@ vtodo_class2 = "(Důvěrný úkol)"; "Name:" = "Název:"; "Color:" = "Barva:"; "Tag:" = "Štítek:"; + +"Show alarms" = "Show alarms"; +"Show tasks" = "Show tasks"; diff --git a/UI/Scheduler/Dutch.lproj/Localizable.strings b/UI/Scheduler/Dutch.lproj/Localizable.strings index 2ae966a6e..d64ae80aa 100644 --- a/UI/Scheduler/Dutch.lproj/Localizable.strings +++ b/UI/Scheduler/Dutch.lproj/Localizable.strings @@ -492,3 +492,6 @@ vtodo_class2 = "(Vertrouwelijke taak)"; "Name:" = "Naam:"; "Color:" = "Kleur:"; "Tag:" = "Markering:"; + +"Show alarms" = "Show alarms"; +"Show tasks" = "Show tasks"; diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index 93000761d..79d5d0274 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -497,3 +497,6 @@ vtodo_class2 = "(Confidential task)"; "Name:" = "Name:"; "Color:" = "Color:"; "Tag:" = "Tag:"; + +"Show alarms" = "Show alarms"; +"Show tasks" = "Show tasks"; diff --git a/UI/Scheduler/French.lproj/Localizable.strings b/UI/Scheduler/French.lproj/Localizable.strings index 3b7e3de63..be9d8abc8 100644 --- a/UI/Scheduler/French.lproj/Localizable.strings +++ b/UI/Scheduler/French.lproj/Localizable.strings @@ -494,3 +494,6 @@ vtodo_class2 = "(Tâche confidentielle)"; "Name:" = "Nom :"; "Color:" = "Couleur :"; "Tag:" = "Label :"; + +"Show alarms" = "Afficher les alarmes"; +"Show tasks" = "Afficher les tâches"; diff --git a/UI/Scheduler/German.lproj/Localizable.strings b/UI/Scheduler/German.lproj/Localizable.strings index c2f321611..048e4e4c1 100644 --- a/UI/Scheduler/German.lproj/Localizable.strings +++ b/UI/Scheduler/German.lproj/Localizable.strings @@ -495,3 +495,6 @@ vtodo_class2 = "(Vertrauliche Aufgabe)"; "Name:" = "Name:"; "Color:" = "Farbe:"; "Tag:" = "Tag:"; + +"Show alarms" = "Show alarms"; +"Show tasks" = "Show tasks"; diff --git a/UI/Scheduler/Italian.lproj/Localizable.strings b/UI/Scheduler/Italian.lproj/Localizable.strings index 8bc278d29..d18b3187a 100644 --- a/UI/Scheduler/Italian.lproj/Localizable.strings +++ b/UI/Scheduler/Italian.lproj/Localizable.strings @@ -498,3 +498,6 @@ vtodo_class2 = "(Attività confidenziale)"; "Name:" = "Nome:"; "Color:" = "Colore:"; "Tag:" = "Etichetta:"; + +"Show alarms" = "Show alarms"; +"Show tasks" = "Show tasks"; diff --git a/UI/Scheduler/Russian.lproj/Localizable.strings b/UI/Scheduler/Russian.lproj/Localizable.strings index b8a2275fc..4aa3389f2 100644 --- a/UI/Scheduler/Russian.lproj/Localizable.strings +++ b/UI/Scheduler/Russian.lproj/Localizable.strings @@ -496,3 +496,6 @@ vtodo_class2 = "(Confidential task)"; "Name:" = "Название:"; "Color:" = "Цвет:"; "Tag:" = "Tag:"; + +"Show alarms" = "Show alarms"; +"Show tasks" = "Show tasks"; diff --git a/UI/Scheduler/Spanish.lproj/Localizable.strings b/UI/Scheduler/Spanish.lproj/Localizable.strings index 89e16b7f4..23c5b1bf2 100644 --- a/UI/Scheduler/Spanish.lproj/Localizable.strings +++ b/UI/Scheduler/Spanish.lproj/Localizable.strings @@ -501,3 +501,6 @@ vtodo_class2 = "(Tarea confidencial)"; "Name:" = "Nombre:"; "Color:" = "Color:"; "Tag:" = "Redacción:"; + +"Show alarms" = "Show alarms"; +"Show tasks" = "Show tasks"; diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index 5ab6d1cf5..cf486c342 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -321,6 +321,8 @@ static NSArray *tasksFields = nil; folders = [[clientObject subFolders] objectEnumerator]; while ((currentFolder = [folders nextObject])) { + if (![component isEqualToString: @"vtodo"] || [currentFolder showCalendarTasks]) + { if ([currentFolder isActive]) { currentInfos @@ -344,6 +346,7 @@ static NSArray *tasksFields = nil; notFoundMarker: marker]]; } } + } } return infos; @@ -409,7 +412,7 @@ static NSArray *tasksFields = nil; folders = [[clientObject subFolders] objectEnumerator]; while ((currentFolder = [folders nextObject])) { - if ([currentFolder isActive]) + if ([currentFolder isActive] && [currentFolder showCalendarAlarms]) { NSDictionary *entry; NSArray *alarms; diff --git a/UI/Scheduler/UIxCalendarProperties.h b/UI/Scheduler/UIxCalendarProperties.h index e3bcbe047..91696ba87 100644 --- a/UI/Scheduler/UIxCalendarProperties.h +++ b/UI/Scheduler/UIxCalendarProperties.h @@ -38,5 +38,8 @@ - (NSString *) calendarColor; - (void) setCalendarColor: (NSString *) newColor; +- (BOOL) showCalendarAlarms; +- (void) setShowCalendarAlarms: (BOOL) new; + @end diff --git a/UI/Scheduler/UIxCalendarProperties.m b/UI/Scheduler/UIxCalendarProperties.m index 83d9684d8..14a54bcfb 100644 --- a/UI/Scheduler/UIxCalendarProperties.m +++ b/UI/Scheduler/UIxCalendarProperties.m @@ -87,10 +87,34 @@ [calendar setSyncTag: newTag]; } +- (BOOL) showCalendarAlarms +{ + return [calendar showCalendarAlarms]; +} + +- (void) setShowCalendarAlarms: (BOOL) new +{ + [calendar setShowCalendarAlarms: new]; +} + +- (BOOL) showCalendarTasks +{ + return [calendar showCalendarTasks]; +} + +- (void) setShowCalendarTasks: (BOOL) new +{ + [calendar setShowCalendarTasks: new]; +} + - (BOOL) shouldTakeValuesFromRequest: (WORequest *) request inContext: (WOContext*) context { - return YES; + NSString *method; + + method = [[request uri] lastPathComponent]; + + return [method isEqualToString: @"saveProperties"]; } - (id ) savePropertiesAction diff --git a/UI/Scheduler/Welsh.lproj/Localizable.strings b/UI/Scheduler/Welsh.lproj/Localizable.strings index 7e0e25832..13f751449 100644 --- a/UI/Scheduler/Welsh.lproj/Localizable.strings +++ b/UI/Scheduler/Welsh.lproj/Localizable.strings @@ -486,3 +486,6 @@ vtodo_class2 = "(Tasg gyhoeddus)"; "Name:" = "Enw:"; "Color:" = "Lliw:"; "Tag:" = "Tag:"; + +"Show alarms" = "Show alarms"; +"Show tasks" = "Show tasks"; diff --git a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox index e819f832a..0932316bb 100644 --- a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox +++ b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox @@ -36,7 +36,15 @@ id="calendarSyncTag" class="textField" var:value="calendarSyncTag" - /> + /> +
+