From 5409cb292789f6ff01a469dcc73f1ba63ee97953 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 25 Sep 2015 15:18:22 -0400 Subject: [PATCH] (feat) moved FolderSynchronize code to GCS --- .../Appointments/SOGoAppointmentFolder.h | 3 - .../Appointments/SOGoAppointmentFolder.m | 55 ------------------- SoObjects/SOGo/SOGoGCSFolder.h | 3 + SoObjects/SOGo/SOGoGCSFolder.m | 23 ++++++++ 4 files changed, 26 insertions(+), 58 deletions(-) diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.h b/SoObjects/Appointments/SOGoAppointmentFolder.h index d535806b4..7139b53ea 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.h +++ b/SoObjects/Appointments/SOGoAppointmentFolder.h @@ -160,9 +160,6 @@ typedef enum { - (NSString *) syncTag; - (void) setSyncTag: (NSString *) newSyncTag; -- (BOOL) synchronizeCalendar; -- (void) setSynchronizeCalendar: (BOOL) new; - - (BOOL) includeInFreeBusy; - (void) setIncludeInFreeBusy: (BOOL) newInclude; diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 3ff2b26ec..81c57d0e7 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -432,61 +432,6 @@ static Class iCalEventK = nil; inCategory: @"FolderShowTasks"]; } -- (NSString *) syncTag -{ - NSString *syncTag; - - syncTag = [self folderPropertyValueInCategory: @"FolderSyncTags"]; - if (!syncTag) - syncTag = @""; - - return syncTag; -} - -- (void) setSyncTag: (NSString *) newSyncTag -{ - // Check for duplicated tags - SOGoUserSettings *settings; - NSDictionary *syncTags; - NSArray *values; - - if ([newSyncTag length]) - { - settings = [[context activeUser] userSettings]; - syncTags = [[settings objectForKey: @"Calendar"] - objectForKey: @"FolderSyncTags"]; - values = [syncTags allValues]; - if (![values containsObject: newSyncTag]) - [self setFolderPropertyValue: newSyncTag - inCategory: @"FolderSyncTags"]; - } - else - [self setFolderPropertyValue: nil - inCategory: @"FolderSyncTags"]; -} - -- (BOOL) synchronizeCalendar -{ - NSNumber *synchronize; - - synchronize = [self folderPropertyValueInCategory: @"FolderSynchronize"]; - - return [synchronize boolValue]; -} - -- (void) setSynchronizeCalendar: (BOOL) new -{ - NSNumber *synchronize; - - if (new) - synchronize = [NSNumber numberWithBool: YES]; - else - synchronize = nil; - - [self setFolderPropertyValue: synchronize - inCategory: @"FolderSynchronize"]; -} - // // If the user is the owner of the calendar, by default we include the freebusy information. // diff --git a/SoObjects/SOGo/SOGoGCSFolder.h b/SoObjects/SOGo/SOGoGCSFolder.h index 578bb7157..6a3f56fa7 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.h +++ b/SoObjects/SOGo/SOGoGCSFolder.h @@ -77,6 +77,9 @@ - (id) folderPropertyValueInCategory: (NSString *) theKey forUser: (SOGoUser *) theUser; +- (BOOL) synchronize; +- (void) setSynchronize: (BOOL) new; + /* lower level fetches */ - (void) deleteEntriesWithIds: (NSArray *) ids; diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 703030fd7..8e245bd9a 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -301,6 +301,29 @@ static NSArray *childRecordFields = nil; return name; } +- (BOOL) synchronize +{ + NSNumber *synchronize; + + synchronize = [self folderPropertyValueInCategory: @"FolderSynchronize"]; + + return [synchronize boolValue]; +} + +- (void) setSynchronize: (BOOL) new +{ + NSNumber *synchronize; + + if (new) + synchronize = [NSNumber numberWithBool: YES]; + else + synchronize = nil; + + [self setFolderPropertyValue: synchronize + inCategory: @"FolderSynchronize"]; +} + + /* This method fetches the display name defined by the owner, but is also the fallback when a subscriber has not redefined the display name yet in their environment. */