Monotone-Parent: bdfc1c269ab737136bc8baf0281b23d80921f8b7
Monotone-Revision: 7c15766f188357a9b9016c2300c2a4a7d2b95404 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-09-19T21:03:12 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
8745c0ce33
commit
2e4d9d2d6d
|
@ -1,5 +1,9 @@
|
|||
2006-09-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/Contacts/UIxContactEditor.m ([UIxContactEditor
|
||||
-initSnapshot]): retrieve "contactEmail" and "contactFN" from the
|
||||
query parameters and put their values (if any) into the snapshot.
|
||||
|
||||
* UI/Contacts/UIxContactView.m ([UIxContactView -note]): convert
|
||||
carriage-returns to "<br />".
|
||||
([UIxContactView -workCompany]): explicitly initialize company to
|
||||
|
|
|
@ -30,44 +30,39 @@
|
|||
|
||||
@implementation UIxContactEditor
|
||||
|
||||
- (id)init {
|
||||
if ((self = [super init])) {
|
||||
self->snapshot = [[NSMutableDictionary alloc] initWithCapacity:16];
|
||||
preferredEmail = nil;
|
||||
}
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
snapshot = [[NSMutableDictionary alloc] initWithCapacity:16];
|
||||
preferredEmail = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self->snapshot release];
|
||||
[self->errorText release];
|
||||
- (void) dealloc
|
||||
{
|
||||
[snapshot release];
|
||||
[errorText release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (NSMutableDictionary *) snapshot
|
||||
- (void) setErrorText: (NSString *) _txt
|
||||
{
|
||||
NSString *email;
|
||||
|
||||
email = [self queryParameterForKey:@"contactEmail"];
|
||||
|
||||
if ([email length] > 0
|
||||
&& ![[self->snapshot objectForKey: @"mail"] length])
|
||||
[self->snapshot setObject: email forKey: @"mail"];
|
||||
|
||||
return self->snapshot;
|
||||
ASSIGNCOPY(errorText, _txt);
|
||||
}
|
||||
|
||||
- (void)setErrorText:(NSString *)_txt {
|
||||
ASSIGNCOPY(self->errorText, _txt);
|
||||
}
|
||||
- (NSString *)errorText {
|
||||
return self->errorText;
|
||||
- (NSString *) errorText
|
||||
{
|
||||
return errorText;
|
||||
}
|
||||
|
||||
- (BOOL)hasErrorText {
|
||||
return [self->errorText length] > 0 ? YES : NO;
|
||||
- (BOOL) hasErrorText
|
||||
{
|
||||
return [errorText length] > 0 ? YES : NO;
|
||||
}
|
||||
|
||||
/* load/store content format */
|
||||
|
@ -76,9 +71,9 @@
|
|||
// TODO: perform sanity checking, eg build CN on demand
|
||||
NSString *cn, *gn, *sn;
|
||||
|
||||
cn = [self->snapshot objectForKey:@"cn"];
|
||||
gn = [self->snapshot objectForKey:@"givenName"];
|
||||
sn = [self->snapshot objectForKey:@"sn"];
|
||||
cn = [snapshot objectForKey:@"cn"];
|
||||
gn = [snapshot objectForKey:@"givenName"];
|
||||
sn = [snapshot objectForKey:@"sn"];
|
||||
|
||||
if (![sn isNotNull] || [sn length] == 0)
|
||||
sn = nil;
|
||||
|
@ -97,7 +92,7 @@
|
|||
? [cn substringFromIndex:(r.location + r.length)]
|
||||
: cn;
|
||||
}
|
||||
[self->snapshot setObject:sn forKey:@"sn"];
|
||||
[snapshot setObject:sn forKey:@"sn"];
|
||||
}
|
||||
if (sn == nil && gn == nil)
|
||||
cn = @"[noname]";
|
||||
|
@ -107,7 +102,7 @@
|
|||
cn = sn;
|
||||
else
|
||||
cn = [[gn stringByAppendingString:@" "] stringByAppendingString:sn];
|
||||
[self->snapshot setObject:cn forKey:@"cn"];
|
||||
[snapshot setObject:cn forKey:@"cn"];
|
||||
}
|
||||
|
||||
/* helper */
|
||||
|
@ -152,6 +147,11 @@
|
|||
[snapshot setObject: aValue forKey: key];
|
||||
}
|
||||
|
||||
- (NSMutableDictionary *) snapshot
|
||||
{
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
- (NSString *) _simpleValueForType: (NSString *) aType
|
||||
inArray: (NSArray *) anArray
|
||||
{
|
||||
|
@ -193,15 +193,10 @@
|
|||
else
|
||||
workMail = potential;
|
||||
}
|
||||
if (!homeMail)
|
||||
if (!homeMail && max > 1)
|
||||
{
|
||||
if (workMail && max > 1)
|
||||
{
|
||||
if (workMail == potential)
|
||||
homeMail = [[elements objectAtIndex: 1] value: 0];
|
||||
else
|
||||
homeMail = potential;
|
||||
}
|
||||
if (workMail && workMail == potential)
|
||||
homeMail = [[elements objectAtIndex: 1] value: 0];
|
||||
else
|
||||
homeMail = potential;
|
||||
}
|
||||
|
@ -250,6 +245,16 @@
|
|||
preferredEmail = aString;
|
||||
}
|
||||
|
||||
- (void) _retrieveQueryParameter: (NSString *) queryKey
|
||||
intoSnapshotValue: (NSString *) snapshotKey
|
||||
{
|
||||
NSString *queryValue;
|
||||
|
||||
queryValue = [self queryParameterForKey: queryKey];
|
||||
if (queryValue && [queryValue length] > 0)
|
||||
[self _setSnapshotValue: snapshotKey to: queryValue];
|
||||
}
|
||||
|
||||
- (void) initSnapshot
|
||||
{
|
||||
NSArray *n, *elements;
|
||||
|
@ -322,6 +327,11 @@
|
|||
[self _setSnapshotValue: @"bday" to: [card bday]];
|
||||
[self _setSnapshotValue: @"tz" to: [card tz]];
|
||||
[self _setSnapshotValue: @"note" to: [card note]];
|
||||
|
||||
[self _retrieveQueryParameter: @"contactEmail"
|
||||
intoSnapshotValue: @"workMail"];
|
||||
[self _retrieveQueryParameter: @"contactFN"
|
||||
intoSnapshotValue: @"fn"];
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) defaultAction
|
||||
|
|
Loading…
Reference in New Issue