diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 21f3562423..ae04332d51 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -833,6 +833,7 @@ - (void) _appendSystemMailAccountWithDelegatedIdentities: (BOOL) appendDeletegat { // This additional identity should not appear in the identity manager of the Preferences [identity setObject: [NSNumber numberWithBool: YES] forKey: @"isReadOnly"]; + [identity setObject: [NSNumber numberWithBool: NO] forKey: @"isDefault"]; } [identities addObject: identity]; } diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index c95f15035b..020c2cdb6e 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -1348,6 +1348,7 @@ - (void) _extractMainAccountSettings: (NSDictionary *) account NSMutableArray *previousIdentities, *newIdentities; NSMutableDictionary *identity, *newIdentitiesAsDict; int i; + BOOL isDefault; if ([account isKindOfClass: [NSDictionary class]]) { @@ -1372,9 +1373,15 @@ - (void) _extractMainAccountSettings: (NSDictionary *) account // Remove existing deleted identities for (identity in [user allIdentities]) { // Identity deleted and at least one identity and not the default identity + if ([identity objectForKey:@"isDefault"]) { + isDefault = [[identity objectForKey:@"isDefault"] boolValue]; + } else { + isDefault = NO; + } + if (![newIdentitiesAsDict objectForKey: [identity objectForKey:@"email"]] && [previousIdentities count] > 1 - && ![identity boolForKey:@"isDefault"]) { + && !isDefault) { [previousIdentities removeObjectAtIndex: i]; i--; }