Monotone-Parent: a93dd2767c4f017932c6339f82394fd558ef304f

Monotone-Revision: 7e63e5fdd760a91e91ec6f1759064a5e5c2f267f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-10-23T15:35:20
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2008-10-23 15:35:20 +00:00
parent 94e1d60312
commit b6201ae20a
10 changed files with 33 additions and 20 deletions

View File

@ -1,3 +1,11 @@
2008-10-23 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/NSArray+Utilities.m ([NSArray
-objectsForKey:keynotFoundMarker:marker]): added a
"notFoundMarker:" parameter to the "objectsForKey:" method. When
the marker is nil and no match is found in the current dictionary,
the entry is ignored.
2008-10-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/Contacts/UIxContactFoldersView.m ([UIxContactFoldersView

View File

@ -47,18 +47,14 @@
accounts = [[context activeUser] mailAccounts];
return [accounts objectsForKey: @"name"];
return [accounts objectsForKey: @"name" notFoundMarker: nil];
}
/* name lookup */
- (BOOL) isValidMailAccountName: (NSString *) _key
{
NSArray *accounts;
accounts = [[context activeUser] mailAccounts];
return [[accounts objectsForKey: @"name"] containsObject: _key];
return [[self toManyRelationshipKeys] containsObject: _key];
}
// - (id) mailAccountWithName: (NSString *) _key

View File

@ -101,7 +101,7 @@
if ([keys count])
{
types = [keys objectsForKey: @"mimeType"];
types = [keys objectsForKey: @"mimeType" notFoundMarker: @""];
index = [types indexOfObject: @"text/plain"];
if (index == NSNotFound)
{

View File

@ -604,10 +604,11 @@ static BOOL debugSoParts = NO;
id result;
[self debugWithFormat: @"fetch keys: %@", _fetchKeys];
result = [self fetchParts: [_fetchKeys objectsForKey: @"key"]];
result = [self fetchParts: [_fetchKeys objectsForKey: @"key"
notFoundMarker: nil]];
result = [result valueForKey: @"RawResponse"]; // hackish
// Note: -valueForKey: doesn't work!
result = [(NSDictionary *)result objectForKey: @"fetch"];

View File

@ -35,7 +35,8 @@
- (NSArray *) stringsWithFormat: (NSString *) format;
- (NSArray *) keysWithFormat: (NSString *) format;
- (NSArray *) objectsForKey: (NSString *) key;
- (NSArray *) objectsForKey: (NSString *) key
notFoundMarker: (id) marker;
- (NSArray *) flattenedArray;
- (NSArray *) uniqueObjects;

View File

@ -85,6 +85,7 @@
}
- (NSArray *) objectsForKey: (NSString *) key
notFoundMarker: (id) marker
{
NSMutableArray *objectsForKey;
unsigned int count, max;
@ -96,7 +97,10 @@
for (count = 0; count < max; count++)
{
value = [[self objectAtIndex: count] objectForKey: key];
[objectsForKey addObject: value];
if (value)
[objectsForKey addObject: value];
else if (marker)
[objectsForKey addObject: marker];
}
return objectsForKey;

View File

@ -467,7 +467,7 @@ static NSArray *childRecordFields = nil;
return records;
[childRecords release];
names = [records objectsForKey: @"c_name"];
names = [records objectsForKey: @"c_name" notFoundMarker: nil];
childRecords = [[NSMutableDictionary alloc] initWithObjects: records
forKeys: names];

View File

@ -751,8 +751,8 @@ _timeValue (NSString *key)
{
NSArray *identities;
[self mailAccounts];
identities = [mailAccounts objectsForKey: @"identities"];
identities = [[self mailAccounts] objectsForKey: @"identities"
notFoundMarker: nil];
return [identities flattenedArray];
}

View File

@ -274,11 +274,11 @@
parts = [[message objectForKey: @"body"] objectForKey: @"parts"];
if ([parts count] > 1)
{
dispositions
= [[parts objectsForKey: @"disposition"] objectEnumerator];
dispositions = [[parts objectsForKey: @"disposition"
notFoundMarker: nil] objectEnumerator];
while (!hasAttachment
&& (currentDisp = [dispositions nextObject]))
hasAttachment = ([[currentDisp objectForKey: @"type"] length]);
hasAttachment = ([[currentDisp objectForKey: @"type"] length]);
}
return hasAttachment;

View File

@ -69,12 +69,14 @@
}
/* accessors */
#warning this method is a duplication of SOGoMailAccounts:toManyRelationShipKeys
- (NSString *) mailAccounts
{
NSArray *accounts, *accountNames;
accounts = [[context activeUser] mailAccounts];
accountNames = [accounts objectsForKey: @"name"];
accountNames = [accounts objectsForKey: @"name" notFoundMarker: nil];
return [accountNames jsonRepresentation];
}
@ -183,7 +185,8 @@
// We use the first mail account
accounts = [[context activeUser] mailAccounts];
firstAccount = [[accounts objectsForKey: @"name"] objectAtIndex: 0];
firstAccount = [[accounts objectsForKey: @"name" notFoundMarker: nil]
objectAtIndex: 0];
request = [context request];
if ((folderId = [request formValueForKey: @"folder"]) &&