Monotone-Parent: 226f5c8184e0e67598bf0e0344b9b7174261fd30

Monotone-Revision: b5deb749839a9258b2e277f5efccc88fee07a073

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-06-29T22:03:30
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-06-29 22:03:30 +00:00
parent 22fd0ba08e
commit b662767a1b
2 changed files with 50 additions and 17 deletions

View File

@@ -1,5 +1,14 @@
2007-06-29 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Contacts/SOGoContactFolders.m ([SOGoContactFolders
-appendPersonalSources]): add the "personal" folder to the list of
user folders even if it doesn't exist, so that it is created when
the user accesses it.
* SoObjects/Contacts/SOGoContactGCSFolder.m ([SOGoContactGCSFolder
-folderIsMandatory]): returns YES if nameInContainer is set to
"personal", which is the default address book.
* SoObjects/Appointments/SOGoAppointmentFolder.m
([SOGoAppointmentFolder -folderIsMandatory]): returns YES since
users must have one Calendar folder (one and only one).

View File

@@ -72,15 +72,52 @@
[super dealloc];
}
- (void) _fetchPersonalFolders: (NSString *) sql
withChannel: (EOAdaptorChannel *) fc
{
NSArray *attrs;
NSDictionary *row;
SOGoContactGCSFolder *ab;
BOOL hasPersonal;
NSString *key, *path;
hasPersonal = NO;
[fc evaluateExpressionX: sql];
attrs = [fc describeResults: NO];
row = [fc fetchAttributes: attrs withZone: NULL];
while (row)
{
ab = [SOGoContactGCSFolder
contactFolderWithName: [row objectForKey: @"c_path4"]
andDisplayName: [row objectForKey: @"c_foldername"]
inContainer: self];
key = [row objectForKey: @"c_path4"];
hasPersonal = (hasPersonal || [key isEqualToString: @"personal"]);
[ab setOCSPath: [NSString stringWithFormat: @"%@/%@",
OCSPath, key]];
[contactFolders setObject: ab forKey: key];
row = [fc fetchAttributes: attrs withZone: NULL];
}
if (!hasPersonal)
{
ab = [SOGoContactGCSFolder contactFolderWithName: @"personal"
andDisplayName: @"Contacts"
inContainer: self];
path = [NSString stringWithFormat:
@"/Users/%@/Contacts/personal",
[self ownerInContext: context]];
[ab setOCSPath: path];
[contactFolders setObject: ab forKey: @"personal"];
}
}
- (void) appendPersonalSources
{
SOGoContactGCSFolder *ab;
GCSChannelManager *cm;
EOAdaptorChannel *fc;
NSURL *folderLocation;
NSString *sql;
NSArray *attrs;
NSDictionary *row;
cm = [GCSChannelManager defaultChannelManager];
folderLocation
@@ -93,20 +130,7 @@
@" WHERE c_path2 = '%@'"
@" AND c_folder_type = 'Contact'"),
[folderLocation gcsTableName], [self ownerInContext: context]];
[fc evaluateExpressionX: sql];
attrs = [fc describeResults: NO];
row = [fc fetchAttributes: attrs withZone: NULL];
while (row)
{
ab = [SOGoContactGCSFolder contactFolderWithName: [row objectForKey: @"c_path4"]
andDisplayName: [row objectForKey: @"c_foldername"]
inContainer: self];
[ab setOCSPath: [NSString stringWithFormat: @"%@/%@",
OCSPath, [row objectForKey: @"c_path4"]]];
[contactFolders setObject: ab forKey: [row objectForKey: @"c_path4"]];
row = [fc fetchAttributes: attrs withZone: NULL];
}
[self _fetchPersonalFolders: sql withChannel: fc];
[cm releaseChannel: fc];
// sql = [sql stringByAppendingFormat:@" WHERE %@ = '%@'",
// uidColumnName, [self uid]];