Monotone-Parent: 21e396c8605b155acfec0b2ce58b23eb13319cf3

Monotone-Revision: 2ef2c3374f2dd549c494c4faf0429f5fe6e13f6d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-11-07T23:35:56
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-11-07 23:35:56 +00:00
parent d66e63d3de
commit 738fb6d3d4
5 changed files with 78 additions and 74 deletions
-71
View File
@@ -635,77 +635,6 @@ static NSString *defaultUserID = @"<default>";
return defaultUserID;
}
- (NSComparisonResult) _compareByOrigin: (SOGoFolder *) otherFolder
{
NSArray *thisElements, *otherElements;
unsigned thisCount, otherCount;
NSComparisonResult comparison;
thisElements = [nameInContainer componentsSeparatedByString: @"_"];
otherElements = [[otherFolder nameInContainer]
componentsSeparatedByString: @"_"];
thisCount = [thisElements count];
otherCount = [otherElements count];
if (thisCount == otherCount)
{
if (thisCount == 1)
comparison = NSOrderedSame;
else
comparison = [[thisElements objectAtIndex: 0]
compare: [otherElements objectAtIndex: 0]];
}
else
{
if (thisCount > otherCount)
comparison = NSOrderedDescending;
else
comparison = NSOrderedAscending;
}
return comparison;
}
- (NSComparisonResult) _compareByNameInContainer: (SOGoFolder *) otherFolder
{
NSString *otherName;
NSComparisonResult comparison;
otherName = [otherFolder nameInContainer];
if ([nameInContainer hasSuffix: @"personal"])
{
if ([otherName hasSuffix: @"personal"])
comparison = [nameInContainer compare: otherName];
else
comparison = NSOrderedAscending;
}
else
{
if ([otherName hasSuffix: @"personal"])
comparison = NSOrderedDescending;
else
comparison = NSOrderedSame;
}
return comparison;
}
- (NSComparisonResult) compare: (SOGoGCSFolder *) otherFolder
{
NSComparisonResult comparison;
comparison = [self _compareByOrigin: otherFolder];
if (comparison == NSOrderedSame)
{
comparison = [self _compareByNameInContainer: otherFolder];
if (comparison == NSOrderedSame)
comparison
= [[self displayName]
localizedCaseInsensitiveCompare: [otherFolder displayName]];
}
return comparison;
}
/* description */
- (void) appendAttributesToDescription: (NSMutableString *) _ms