diff --git a/ChangeLog b/ChangeLog index d622b464a..613a3afc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2007-09-16 Wolfgang Sourdeau + * SoObjects/Contacts/SOGoContactGCSFolder.m ([SOGoContactGCSFolder + -compare:otherFolder]): new overriden method that compares two + contact foldes based on their class and then transfer the control + to the super method in SOGoFolder. + + * SoObjects/Contacts/SOGoContactLDAPFolder.m + ([SOGoContactLDAPFolder -compare:otherFolder]): new method that + compare two contact folders based on their class and then their + display name. + * SoObjects/SOGo/SOGoFolder.m ([SOGoFolder -compare:otherFolder]): new method for sorting folders. The folders are compared based on their ownership, whether they are a main folder and finally diff --git a/SoObjects/Contacts/SOGoContactGCSFolder.m b/SoObjects/Contacts/SOGoContactGCSFolder.m index e00e96749..b8856acd9 100644 --- a/SoObjects/Contacts/SOGoContactGCSFolder.m +++ b/SoObjects/Contacts/SOGoContactGCSFolder.m @@ -251,6 +251,20 @@ // return r; // } +/* sorting */ +- (NSComparisonResult) compare: (id) otherFolder +{ + NSComparisonResult comparison; + + if ([NSStringFromClass([otherFolder class]) + isEqualToString: @"SOGoContactLDAPFolder"]) + comparison = NSOrderedAscending; + else + comparison = [super compare: otherFolder]; + + return comparison; +} + /* folder type */ - (NSString *) folderType diff --git a/SoObjects/Contacts/SOGoContactLDAPFolder.m b/SoObjects/Contacts/SOGoContactLDAPFolder.m index 459f2998e..5f1ad9ecb 100644 --- a/SoObjects/Contacts/SOGoContactLDAPFolder.m +++ b/SoObjects/Contacts/SOGoContactLDAPFolder.m @@ -256,6 +256,22 @@ return YES; } +/* sorting */ +- (NSComparisonResult) compare: (id) otherFolder +{ + NSComparisonResult comparison; + + if ([NSStringFromClass([otherFolder class]) + isEqualToString: @"SOGoContactGCSFolder"]) + comparison = NSOrderedDescending; + else + comparison + = [[self displayName] + localizedCaseInsensitiveCompare: [otherFolder displayName]]; + + return comparison; +} + /* acls */ - (NSString *) ownerInContext: (WOContext *) noContext {