mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-04 02:55:26 +00:00
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:
@@ -1,5 +1,8 @@
|
||||
2007-11-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoGCSFolder.m ([-compare:otherFolder]): method
|
||||
moved into the SOGoFolder class.
|
||||
|
||||
* SoObjects/Appointments/SOGoAppointmentObject.m
|
||||
([SOGoAppointmentObject -saveContentString:_iCalinUIDs:_uids]):
|
||||
simplified method by directly building a similar appointment
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
|
||||
- (NSString *) folderType;
|
||||
|
||||
/* sorting */
|
||||
- (NSComparisonResult) compare: (id) otherFolder;
|
||||
|
||||
/* dav */
|
||||
- (NSArray *) davNamespaces;
|
||||
|
||||
|
||||
@@ -113,6 +113,78 @@
|
||||
return [[self davURL] absoluteString];
|
||||
}
|
||||
|
||||
/* sorting */
|
||||
- (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: (id) 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;
|
||||
}
|
||||
|
||||
/* WebDAV */
|
||||
|
||||
- (NSArray *) davNamespaces
|
||||
|
||||
@@ -71,9 +71,6 @@
|
||||
|
||||
- (BOOL) folderIsMandatory;
|
||||
|
||||
/* sorting */
|
||||
- (NSComparisonResult) compare: (SOGoGCSFolder *) otherFolder;
|
||||
|
||||
- (BOOL) create;
|
||||
- (NSException *) delete;
|
||||
- (void) renameTo: (NSString *) newName;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user