diff --git a/ChangeLog b/ChangeLog index 7b40d8160..307d0b8cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2009-08-18 Francis Lachapelle + + * UI/Scheduler/UIxCalendarProperties.m ([UIxCalendarProperties + -allCalendarSyncTags]): new method that returns a concatenated + string of all the sync tags of the other calendars. + ([UIxCalendarProperties -mustSynchronize]): new method that + returns true if the calendar must be synchronized, ie if it's the + personal calendar. + ([UIxCalendarProperties -synchronizeCalendar]): new method that + returns true if the calendar must be synchronized or is set to be synchronized. + + * SoObjects/Appointments/SOGoAppointmentFolder.m + ([SOGoAppointmentFolder -_setCalendarProperty:forKey:]): new + common method for all methods that need to set a property in the + user's settings. + 2009-08-17 Cyril Robert * UI/Scheduler/UIxCalListingActions.m: Added support for new user default: diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.h b/SoObjects/Appointments/SOGoAppointmentFolder.h index dd4e69243..a5e78b6fe 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoAppointmentFolder.h @@ -66,6 +66,9 @@ - (NSString *) syncTag; - (void) setSyncTag: (NSString *) newSyncTag; +- (BOOL) synchronizeCalendar; +- (void) setSynchronizeCalendar: (BOOL) new; + /* selection */ - (NSArray *) calendarUIDs; diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 7347727e7..9d670b562 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -279,6 +279,44 @@ static int davCalendarStartTimeLimit = 0; return objectClass; } +- (void) _setCalendarProperty: (id) theValue + forKey: (NSString *) theKey +{ + 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: theKey]; + if (theValue) + { + if (!values) + { + // Create the property dictionary + values = [NSMutableDictionary dictionary]; + [calendarSettings setObject: values forKey: theKey]; + } + [values setObject: theValue forKey: [self folderReference]]; + } + else if (values) + { + // Remove the property for the calendar + [values removeObjectForKey: [self folderReference]]; + if ([values count] == 0) + // Also remove the property dictionary when empty + [calendarSettings removeObjectForKey: theKey]; + } + + [settings synchronize]; +} + - (NSString *) calendarColor { NSUserDefaults *settings; @@ -297,26 +335,12 @@ static int davCalendarStartTimeLimit = 0; - (void) setCalendarColor: (NSString *) newColor { - NSUserDefaults *settings; - NSMutableDictionary *calendarSettings; - NSMutableDictionary *colors; - - settings = [[context activeUser] userSettings]; - calendarSettings = [settings objectForKey: @"Calendar"]; - if (!calendarSettings) - { - calendarSettings = [NSMutableDictionary dictionary]; - [settings setObject: calendarSettings - forKey: @"Calendar"]; - } - colors = [calendarSettings objectForKey: @"FolderColors"]; - if (!colors) - { - colors = [NSMutableDictionary dictionary]; - [calendarSettings setObject: colors forKey: @"FolderColors"]; - } - [colors setObject: newColor forKey: [self folderReference]]; - [settings synchronize]; + if ([newColor length]) + [self _setCalendarProperty: newColor + forKey: @"FolderColors"]; + else + [self _setCalendarProperty: nil + forKey: @"FolderColors"]; } - (BOOL) showCalendarAlarms @@ -338,27 +362,12 @@ static int davCalendarStartTimeLimit = 0; - (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]; + if (new) + [self _setCalendarProperty: nil + forKey: @"FolderShowAlarms"]; + else + [self _setCalendarProperty: [NSNumber numberWithBool: new] + forKey: @"FolderShowAlarms"]; } - (BOOL) showCalendarTasks @@ -380,31 +389,14 @@ static int davCalendarStartTimeLimit = 0; - (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]; + if (new) + [self _setCalendarProperty: nil + forKey: @"FolderShowTasks"]; + else + [self _setCalendarProperty: [NSNumber numberWithBool: new] + forKey: @"FolderShowTasks"]; } - - - (NSString *) syncTag { NSUserDefaults *settings; @@ -421,29 +413,73 @@ static int davCalendarStartTimeLimit = 0; return syncTag; } -#warning this code shares a lot with the colour code - (void) setSyncTag: (NSString *) newSyncTag +{ + if ([newSyncTag length]) + { + // Check for duplicated tags + NSUserDefaults *settings; + NSMutableDictionary *calendarSettings; + NSMutableDictionary *syncTags; + NSEnumerator *keysList; + NSString *key; + BOOL hasDuplicate; + + hasDuplicate = NO; + settings = [[context activeUser] userSettings]; + calendarSettings = [settings objectForKey: @"Calendar"]; + if (calendarSettings) + { + syncTags = [calendarSettings objectForKey: @"FolderSyncTags"]; + if (syncTags) + { + keysList = [syncTags keyEnumerator]; + while ((key = (NSString*)[keysList nextObject])) { + if (![key isEqualToString: [self folderReference]] + && [(NSString*)[syncTags objectForKey: key] isEqualToString: newSyncTag]) + { + hasDuplicate = YES; + break; + } + } + } + } + if (!hasDuplicate) + [self _setCalendarProperty: newSyncTag + forKey: @"FolderSyncTags"]; + } + else + { + [self _setCalendarProperty: nil + forKey: @"FolderSyncTags"]; + } +} + +- (BOOL) synchronizeCalendar { NSUserDefaults *settings; - NSMutableDictionary *calendarSettings; - NSMutableDictionary *syncTags; + NSDictionary *values; + id test; + BOOL synchronize = NO; settings = [[context activeUser] userSettings]; - calendarSettings = [settings objectForKey: @"Calendar"]; - if (!calendarSettings) - { - calendarSettings = [NSMutableDictionary dictionary]; - [settings setObject: calendarSettings - forKey: @"Calendar"]; - } - syncTags = [calendarSettings objectForKey: @"FolderSyncTags"]; - if (!syncTags) - { - syncTags = [NSMutableDictionary dictionary]; - [calendarSettings setObject: syncTags forKey: @"FolderSyncTags"]; - } - [syncTags setObject: newSyncTag forKey: [self folderReference]]; - [settings synchronize]; + values = [[settings objectForKey: @"Calendar"] + objectForKey: @"FolderSynchronize"]; + test = [values objectForKey: [self folderReference]]; + if (test) + synchronize = [test boolValue]; + + return synchronize; +} + +- (void) setSynchronizeCalendar: (BOOL) new +{ + if (new) + [self _setCalendarProperty: [NSNumber numberWithBool: new] + forKey: @"FolderSynchronize"]; + else + [self _setCalendarProperty: nil + forKey: @"FolderSynchronize"]; } /* logging */ diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 0ad2d1f57..f1eb80da4 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -546,7 +546,7 @@ oldEvent = (iCalEvent*)[self newOccurenceWithID: recurrenceTime]; } - if ([[[oldEvent parent] firstChildWithTag: @"vevent"] userIsOrganizer: ownerUser]) + if ([[[oldEvent parent] firstChildWithTag: [self componentTag]] userIsOrganizer: ownerUser]) { // The owner is the organizer of the event; handle the modifications diff --git a/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings b/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings index dbd3bbb9d..9f78b23e6 100644 --- a/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings +++ b/UI/Scheduler/BrazilianPortuguese.lproj/Localizable.strings @@ -500,8 +500,12 @@ vtodo_class2 = "(Tarefa Confidencial)"; /* Properties dialog */ "Name:" = "Nome:"; "Color:" = "Cor:"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Marca:"; +"Display" = "Display"; "Show alarms" = "Show alarms"; "Show tasks" = "Show tasks"; @@ -513,3 +517,7 @@ vtodo_class2 = "(Tarefa Confidencial)"; "yearFieldInvalid" = "Please specify a numerical value in the Year(s) field greater or equal to 1."; "appointmentFieldInvalid" = "Please specify a numerical value in the Appointment(s) field greater or equal to 1."; "recurrenceUnsupported" = "This type of recurrence is currently unsupported."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to reload the data on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to reload the data on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Scheduler/Czech.lproj/Localizable.strings b/UI/Scheduler/Czech.lproj/Localizable.strings index 643f745ee..ad112ee46 100644 --- a/UI/Scheduler/Czech.lproj/Localizable.strings +++ b/UI/Scheduler/Czech.lproj/Localizable.strings @@ -500,8 +500,12 @@ vtodo_class2 = "(Důvěrný úkol)"; /* Properties dialog */ "Name:" = "Název:"; "Color:" = "Barva:"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Štítek:"; +"Display" = "Display"; "Show alarms" = "Show alarms"; "Show tasks" = "Show tasks"; @@ -513,3 +517,7 @@ vtodo_class2 = "(Důvěrný úkol)"; "yearFieldInvalid" = "Please specify a numerical value in the Year(s) field greater or equal to 1."; "appointmentFieldInvalid" = "Please specify a numerical value in the Appointment(s) field greater or equal to 1."; "recurrenceUnsupported" = "This type of recurrence is currently unsupported."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to reload the data on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to reload the data on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Scheduler/Dutch.lproj/Localizable.strings b/UI/Scheduler/Dutch.lproj/Localizable.strings index 203736ecd..f1a92d718 100644 --- a/UI/Scheduler/Dutch.lproj/Localizable.strings +++ b/UI/Scheduler/Dutch.lproj/Localizable.strings @@ -500,8 +500,12 @@ vtodo_class2 = "(Vertrouwelijke taak)"; /* Properties dialog */ "Name:" = "Naam:"; "Color:" = "Kleur:"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Markering:"; +"Display" = "Display"; "Show alarms" = "Show alarms"; "Show tasks" = "Show tasks"; @@ -513,3 +517,7 @@ vtodo_class2 = "(Vertrouwelijke taak)"; "yearFieldInvalid" = "Please specify a numerical value in the Year(s) field greater or equal to 1."; "appointmentFieldInvalid" = "Please specify a numerical value in the Appointment(s) field greater or equal to 1."; "recurrenceUnsupported" = "This type of recurrence is currently unsupported."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to reload the data on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to reload the data on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Scheduler/English.lproj/Localizable.strings b/UI/Scheduler/English.lproj/Localizable.strings index c1a5aac93..4c7386855 100644 --- a/UI/Scheduler/English.lproj/Localizable.strings +++ b/UI/Scheduler/English.lproj/Localizable.strings @@ -500,8 +500,12 @@ vtodo_class2 = "(Confidential task)"; /* Properties dialog */ "Name:" = "Name:"; "Color:" = "Color:"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Tag:"; +"Display" = "Display"; "Show alarms" = "Show alarms"; "Show tasks" = "Show tasks"; @@ -513,3 +517,7 @@ vtodo_class2 = "(Confidential task)"; "yearFieldInvalid" = "Please specify a numerical value in the Year(s) field greater or equal to 1."; "appointmentFieldInvalid" = "Please specify a numerical value in the Appointment(s) field greater or equal to 1."; "recurrenceUnsupported" = "This type of recurrence is currently unsupported."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to reload the data on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to reload the data on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Scheduler/French.lproj/Localizable.strings b/UI/Scheduler/French.lproj/Localizable.strings index 262b9bb1f..380130e87 100644 --- a/UI/Scheduler/French.lproj/Localizable.strings +++ b/UI/Scheduler/French.lproj/Localizable.strings @@ -500,8 +500,12 @@ vtodo_class2 = "(Tâche confidentielle)"; /* Properties dialog */ "Name:" = "Nom :"; "Color:" = "Couleur :"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Label :"; +"Display" = "Display"; "Show alarms" = "Afficher les alarmes"; "Show tasks" = "Afficher les tâches"; @@ -513,3 +517,7 @@ vtodo_class2 = "(Tâche confidentielle)"; "yearFieldInvalid" = "Veuillez spécifier un chiffre superieur ou égal à 1 dans le champ Année(s)."; "appointmentFieldInvalid" = "Veuillez spécifier un chiffre superieur ou égal à 1 dans le champ rendez-vous."; "recurrenceUnsupported" = "Ce type de récurrence n\\'est pas supporté."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to reload the data on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to reload the data on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Scheduler/German.lproj/Localizable.strings b/UI/Scheduler/German.lproj/Localizable.strings index 187418a28..516e6035c 100644 --- a/UI/Scheduler/German.lproj/Localizable.strings +++ b/UI/Scheduler/German.lproj/Localizable.strings @@ -500,8 +500,12 @@ vtodo_class2 = "(Vertrauliche Aufgabe)"; /* Properties dialog */ "Name:" = "Name:"; "Color:" = "Farbe:"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Tag:"; +"Display" = "Display"; "Show alarms" = "Show alarms"; "Show tasks" = "Show tasks"; @@ -513,3 +517,7 @@ vtodo_class2 = "(Vertrauliche Aufgabe)"; "yearFieldInvalid" = "Please specify a numerical value in the Year(s) field greater or equal to 1."; "appointmentFieldInvalid" = "Please specify a numerical value in the Appointment(s) field greater or equal to 1."; "recurrenceUnsupported" = "This type of recurrence is currently unsupported."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to reload the data on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to reload the data on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Scheduler/Hungarian.lproj/Localizable.strings b/UI/Scheduler/Hungarian.lproj/Localizable.strings index 885e2e396..568d78d58 100644 --- a/UI/Scheduler/Hungarian.lproj/Localizable.strings +++ b/UI/Scheduler/Hungarian.lproj/Localizable.strings @@ -500,8 +500,12 @@ vtodo_class2 = "(Bizalmas feladat)"; /* Properties dialog */ "Name:" = "Név:"; "Color:" = "Szín:"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Cimke:"; +"Display" = "Display"; "Show alarms" = "Show alarms"; "Show tasks" = "Show tasks"; @@ -513,3 +517,7 @@ vtodo_class2 = "(Bizalmas feladat)"; "yearFieldInvalid" = "Please specify a numerical value in the Year(s) field greater or equal to 1."; "appointmentFieldInvalid" = "Please specify a numerical value in the Appointment(s) field greater or equal to 1."; "recurrenceUnsupported" = "This type of recurrence is currently unsupported."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to reload the data on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to reload the data on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Scheduler/Italian.lproj/Localizable.strings b/UI/Scheduler/Italian.lproj/Localizable.strings index 753449a83..e025a4092 100644 --- a/UI/Scheduler/Italian.lproj/Localizable.strings +++ b/UI/Scheduler/Italian.lproj/Localizable.strings @@ -500,8 +500,12 @@ vtodo_class2 = "(Attività confidenziale)"; /* Properties dialog */ "Name:" = "Nome:"; "Color:" = "Colore:"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Etichetta:"; +"Display" = "Display"; "Show alarms" = "Show alarms"; "Show tasks" = "Show tasks"; @@ -513,3 +517,7 @@ vtodo_class2 = "(Attività confidenziale)"; "yearFieldInvalid" = "Please specify a numerical value in the Year(s) field greater or equal to 1."; "appointmentFieldInvalid" = "Please specify a numerical value in the Appointment(s) field greater or equal to 1."; "recurrenceUnsupported" = "This type of recurrence is currently unsupported."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to reload the data on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to reload the data on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Scheduler/Russian.lproj/Localizable.strings b/UI/Scheduler/Russian.lproj/Localizable.strings index 9fefc5765..586826f58 100644 --- a/UI/Scheduler/Russian.lproj/Localizable.strings +++ b/UI/Scheduler/Russian.lproj/Localizable.strings @@ -25,6 +25,7 @@ "Thursday" = "Четверг"; "Friday" = "Пятница"; "Saturday" = "Суббота"; +"DayOfTheMonth" = "DayOfTheMonth"; "Sun" = "Вск"; "Mon" = "Пон"; @@ -120,6 +121,7 @@ "Forbidden" = "Запрешено"; /* acls */ + "Default Roles" = "Роли по умолчанию"; "User rights for:" = "Права пользователя для:"; @@ -390,6 +392,7 @@ "reminder_AFTER" = "после"; "reminder_START" = "начала события"; "reminder_END" = "конца события"; +"Reminder Details" = "Reminder Details"; "zoom_400" = "400%"; "zoom_200" = "200%"; @@ -497,8 +500,12 @@ vtodo_class2 = "(Confidential task)"; /* Properties dialog */ "Name:" = "Название:"; "Color:" = "Цвет:"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Tag:"; +"Display" = "Display"; "Show alarms" = "Show alarms"; "Show tasks" = "Show tasks"; @@ -510,3 +517,7 @@ vtodo_class2 = "(Confidential task)"; "yearFieldInvalid" = "Please specify a numerical value in the Year(s) field greater or equal to 1."; "appointmentFieldInvalid" = "Please specify a numerical value in the Appointment(s) field greater or equal to 1."; "recurrenceUnsupported" = "This type of recurrence is currently unsupported."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to reload the data on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to reload the data on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Scheduler/Spanish.lproj/Localizable.strings b/UI/Scheduler/Spanish.lproj/Localizable.strings index 67480adce..0e9f684d2 100644 --- a/UI/Scheduler/Spanish.lproj/Localizable.strings +++ b/UI/Scheduler/Spanish.lproj/Localizable.strings @@ -500,8 +500,12 @@ vtodo_class2 = "(Tarea confidencial)"; /* Properties dialog */ "Name:" = "Nombre:"; "Color:" = "Color:"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Redacción:"; +"Display" = "Display"; "Show alarms" = "Show alarms"; "Show tasks" = "Show tasks"; @@ -513,3 +517,7 @@ vtodo_class2 = "(Tarea confidencial)"; "yearFieldInvalid" = "Please specify a numerical value in the Year(s) field greater or equal to 1."; "appointmentFieldInvalid" = "Please specify a numerical value in the Appointment(s) field greater or equal to 1."; "recurrenceUnsupported" = "This type of recurrence is currently unsupported."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to reload the data on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to reload the data on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Scheduler/UIxCalendarProperties.h b/UI/Scheduler/UIxCalendarProperties.h index 831f2471c..0cc80609a 100644 --- a/UI/Scheduler/UIxCalendarProperties.h +++ b/UI/Scheduler/UIxCalendarProperties.h @@ -20,7 +20,7 @@ * Boston, MA 02111-1307, USA. */ -#import "SOGoUI/UIxComponent.h" +#import @class NSString; @@ -42,5 +42,13 @@ - (BOOL) showCalendarAlarms; - (void) setShowCalendarAlarms: (BOOL) new; +- (BOOL) synchronizeCalendar; +- (void) setSynchronizeCalendar: (BOOL) new; + +- (NSString *) originalCalendarSyncTag; +- (NSString *) allCalendarSyncTags; +- (BOOL) mustSynchronize; +- (NSString *) calendarSyncTag; +- (void) setCalendarSyncTag: (NSString *) newTag; @end diff --git a/UI/Scheduler/UIxCalendarProperties.m b/UI/Scheduler/UIxCalendarProperties.m index f940087d4..fd32ef6df 100644 --- a/UI/Scheduler/UIxCalendarProperties.m +++ b/UI/Scheduler/UIxCalendarProperties.m @@ -20,6 +20,9 @@ * Boston, MA 02111-1307, USA. */ +#import +#import + #import #import @@ -78,6 +81,59 @@ [calendar setCalendarColor: newColor]; } +- (BOOL) synchronizeCalendar +{ + return [self mustSynchronize] || [calendar synchronizeCalendar]; +} + +- (void) setSynchronizeCalendar: (BOOL) new +{ + [calendar setSynchronizeCalendar: new]; +} + +- (NSString *) originalCalendarSyncTag +{ + return [calendar syncTag]; +} + +- (NSString *) allCalendarSyncTags +{ + NSUserDefaults *settings; + NSMutableDictionary *calendarSettings; + NSMutableDictionary *syncTags; + NSEnumerator *keysList; + NSMutableArray *tags; + NSString *key, *result; + + settings = [[context activeUser] userSettings]; + calendarSettings = [settings objectForKey: @"Calendar"]; + if (calendarSettings) + { + syncTags = [calendarSettings objectForKey: @"FolderSyncTags"]; + if (syncTags) + { + tags = [NSMutableArray arrayWithCapacity: [syncTags count]]; + keysList = [syncTags keyEnumerator]; + while ((key = (NSString*)[keysList nextObject])) { + if (![key isEqualToString: [calendar folderReference]]) + [tags addObject: [syncTags objectForKey: key]]; + } + } + } + + if (!tags) + result = @""; + else + result = [tags componentsJoinedByString: @","]; + + return result; +} + +- (BOOL) mustSynchronize +{ + return [[calendar nameInContainer] isEqualToString: @"personal"]; +} + - (NSString *) calendarSyncTag { return [calendar syncTag]; diff --git a/UI/Scheduler/Welsh.lproj/Localizable.strings b/UI/Scheduler/Welsh.lproj/Localizable.strings index fd83919e7..ef56ada63 100644 --- a/UI/Scheduler/Welsh.lproj/Localizable.strings +++ b/UI/Scheduler/Welsh.lproj/Localizable.strings @@ -500,8 +500,12 @@ vtodo_class2 = "(Tasg gyhoeddus)"; /* Properties dialog */ "Name:" = "Enw:"; "Color:" = "Lliw:"; + +"Synchronization" = "Synchronization"; +"Synchronize" = "Synchronize"; "Tag:" = "Tag:"; +"Display" = "Display"; "Show alarms" = "Show alarms"; "Show tasks" = "Show tasks"; @@ -513,3 +517,7 @@ vtodo_class2 = "(Tasg gyhoeddus)"; "yearFieldInvalid" = "Please specify a numerical value in the Year(s) field greater or equal to 1."; "appointmentFieldInvalid" = "Please specify a numerical value in the Appointment(s) field greater or equal to 1."; "recurrenceUnsupported" = "This type of recurrence is currently unsupported."; +"tagNotDefined" = "You must specify a tag if you want to synchronize this calendar."; +"tagAlreadyExists" = "The tag you specified is already associated to another calendar."; +"tagHasChanged" = "If you change your calendar's tag, you'll need to perform a slow sync on your mobile device.\nContinue?"; +"tagWasRemoved" = "If you remove this calendar from synchronization, you'll need to perform a slow sync on your mobile device.\nContinue?"; \ No newline at end of file diff --git a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox index 0932316bb..8e76c2c10 100644 --- a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox +++ b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox @@ -14,6 +14,8 @@
+
+
-
+
+ +
+
+ />
+
+
+
+
-1) { + alert(labels["tagAlreadyExists"]); + save = false; + } + else if (originalTag + && !originalTag.value.blank() + && tag != originalTag.value) + save = confirm(labels["tagHasChanged"]); + } + else if (originalTag + && !originalTag.value.blank()) + save = confirm(labels["tagWasRemoved"]); + + if (save) + window.opener.updateCalendarProperties(calendarID.value, + calendarName.value, + calendarColor.value); + else + Event.stop(event); } function onColorClick(event) {