Monotone-Parent: f844c722fbaf58bf1e6166c82175c6ca3aca9074
Monotone-Revision: f463d17bed09b78de002a4dfc873a1f45b6aa7b7 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-03-22T19:02:45 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
3abf38778d
commit
520249ebb7
|
@ -31,8 +31,8 @@
|
|||
|
||||
@interface UIxContactEditor : UIxComponent
|
||||
{
|
||||
NSString *errorText;
|
||||
NSString *preferredEmail;
|
||||
NSString *item;
|
||||
NGVCard *card;
|
||||
NSMutableDictionary *snapshot; /* contains the values for editing */
|
||||
}
|
||||
|
|
|
@ -46,25 +46,39 @@
|
|||
- (void) dealloc
|
||||
{
|
||||
[snapshot release];
|
||||
[errorText release];
|
||||
[preferredEmail release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (void) setErrorText: (NSString *) _txt
|
||||
- (NSArray *) htmlMailFormatList
|
||||
{
|
||||
ASSIGNCOPY(errorText, _txt);
|
||||
static NSArray *htmlMailFormatItems = nil;
|
||||
|
||||
if (!htmlMailFormatItems)
|
||||
{
|
||||
htmlMailFormatItems = [NSArray arrayWithObjects: @"FALSE", @"TRUE", nil];
|
||||
[htmlMailFormatItems retain];
|
||||
}
|
||||
|
||||
return htmlMailFormatItems;
|
||||
}
|
||||
|
||||
- (NSString *) errorText
|
||||
- (NSString *) itemHtmlMailFormatText
|
||||
{
|
||||
return errorText;
|
||||
return [self labelForKey:
|
||||
[NSString stringWithFormat: @"htmlMailFormat_%@", item]];
|
||||
}
|
||||
|
||||
- (BOOL) hasErrorText
|
||||
- (void) setItem: (NSString *) newItem
|
||||
{
|
||||
return [errorText length] > 0 ? YES : NO;
|
||||
item = newItem;
|
||||
}
|
||||
|
||||
- (NSString *) item
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
/* load/store content format */
|
||||
|
@ -214,6 +228,9 @@
|
|||
|
||||
[self _setSnapshotValue: @"workMail" to: workMail];
|
||||
[self _setSnapshotValue: @"homeMail" to: homeMail];
|
||||
|
||||
[self _setSnapshotValue: @"mozillaUseHtmlMail"
|
||||
to: [[card uniqueChildWithTag: @"x-mozilla-html"] value: 0]];
|
||||
}
|
||||
|
||||
- (void) _setupOrgFields
|
||||
|
@ -291,6 +308,9 @@
|
|||
|
||||
[self _setupEmailFields];
|
||||
|
||||
[self _setSnapshotValue: @"screenName"
|
||||
to: [[card uniqueChildWithTag: @"x-aim"] value: 0]];
|
||||
|
||||
elements = [card childrenWithTag: @"adr"
|
||||
andAttribute: @"type" havingValue: @"work"];
|
||||
if (elements && [elements count] > 0)
|
||||
|
@ -425,6 +445,10 @@
|
|||
else
|
||||
[card setPreferred: homeMail];
|
||||
}
|
||||
|
||||
[[card uniqueChildWithTag: @"x-mozilla-html"]
|
||||
setValue: 0
|
||||
to: [snapshot objectForKey: @"mozillaUseHtmlMail"]];
|
||||
}
|
||||
|
||||
- (void) _saveSnapshot
|
||||
|
@ -463,6 +487,8 @@
|
|||
|
||||
[self _savePhoneValues];
|
||||
[self _saveEmails];
|
||||
[[card uniqueChildWithTag: @"x-aim"]
|
||||
setValue: 0 to: [snapshot objectForKey: @"screenName"]];
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) saveAction
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
if (value && [value length] > 0)
|
||||
{
|
||||
if (label)
|
||||
[cardString appendFormat: @"%@%@<br />\n",
|
||||
[cardString appendFormat: @"%@ %@<br />\n",
|
||||
[self labelForKey: label], value];
|
||||
else
|
||||
[cardString appendFormat: @"%@<br />\n", value];
|
||||
|
@ -73,35 +73,74 @@
|
|||
|
||||
- (NSString *) displayName
|
||||
{
|
||||
return [self _cardStringWithLabel: @"Display Name: "
|
||||
return [self _cardStringWithLabel: @"Display Name:"
|
||||
value: [card fn]];
|
||||
}
|
||||
|
||||
- (NSString *) nickName
|
||||
{
|
||||
return [self _cardStringWithLabel: @"Nickname: "
|
||||
return [self _cardStringWithLabel: @"Nickname:"
|
||||
value: [card nickname]];
|
||||
}
|
||||
|
||||
- (NSString *) preferredEmail
|
||||
- (NSString *) primaryEmail
|
||||
{
|
||||
NSString *email, *mailTo;
|
||||
|
||||
email = [card preferredEMail];
|
||||
if (email && [email length] > 0)
|
||||
if ([email length] > 0)
|
||||
mailTo = [NSString stringWithFormat: @"<a href=\"mailto:%@\""
|
||||
@" onclick=\"return onContactMailTo(this);\">"
|
||||
@"%@</a>", email, email];
|
||||
else
|
||||
mailTo = nil;
|
||||
|
||||
return [self _cardStringWithLabel: @"Email Address: "
|
||||
return [self _cardStringWithLabel: @"Email:"
|
||||
value: mailTo];
|
||||
}
|
||||
|
||||
- (NSString *) secondaryEmail
|
||||
{
|
||||
NSString *email, *mailTo;
|
||||
NSMutableArray *emails;
|
||||
|
||||
emails = [NSMutableArray new];
|
||||
[emails addObjectsFromArray: [card childrenWithTag: @"email"]];
|
||||
[emails removeObjectsInArray: [card childrenWithTag: @"email"
|
||||
andAttribute: @"type"
|
||||
havingValue: @"pref"]];
|
||||
|
||||
if ([emails count] > 1)
|
||||
{
|
||||
email = [[emails objectAtIndex: 0] value: 0];
|
||||
mailTo = [NSString stringWithFormat: @"<a href=\"mailto:%@\""
|
||||
@" onclick=\"return onContactMailTo(this);\">"
|
||||
@"%@</a>", email, email];
|
||||
}
|
||||
else
|
||||
mailTo = nil;
|
||||
|
||||
return [self _cardStringWithLabel: @"Additional Email:"
|
||||
value: mailTo];
|
||||
}
|
||||
|
||||
- (NSString *) screenName
|
||||
{
|
||||
NSString *screenName, *goim;
|
||||
|
||||
screenName = [[card uniqueChildWithTag: @"x-aim"] value: 0];
|
||||
if ([screenName length] > 0)
|
||||
goim = [NSString stringWithFormat: @"<a href=\"aim:goim?screenname=%@\""
|
||||
@">%@</a>", screenName, screenName];
|
||||
else
|
||||
goim = nil;
|
||||
|
||||
return [self _cardStringWithLabel: @"Screen Name:" value: goim];
|
||||
}
|
||||
|
||||
- (NSString *) preferredTel
|
||||
{
|
||||
return [self _cardStringWithLabel: @"Phone Number: "
|
||||
return [self _cardStringWithLabel: @"Phone Number:"
|
||||
value: [card preferredTel]];
|
||||
}
|
||||
|
||||
|
@ -137,27 +176,27 @@
|
|||
|
||||
- (NSString *) workPhone
|
||||
{
|
||||
return [self _phoneOfType: @"work" withLabel: @"Work: "];
|
||||
return [self _phoneOfType: @"work" withLabel: @"Work:"];
|
||||
}
|
||||
|
||||
- (NSString *) homePhone
|
||||
{
|
||||
return [self _phoneOfType: @"home" withLabel: @"Home: "];
|
||||
return [self _phoneOfType: @"home" withLabel: @"Home:"];
|
||||
}
|
||||
|
||||
- (NSString *) fax
|
||||
{
|
||||
return [self _phoneOfType: @"fax" withLabel: @"Fax: "];
|
||||
return [self _phoneOfType: @"fax" withLabel: @"Fax:"];
|
||||
}
|
||||
|
||||
- (NSString *) mobile
|
||||
{
|
||||
return [self _phoneOfType: @"cell" withLabel: @"Mobile: "];
|
||||
return [self _phoneOfType: @"cell" withLabel: @"Mobile:"];
|
||||
}
|
||||
|
||||
- (NSString *) pager
|
||||
{
|
||||
return [self _phoneOfType: @"pager" withLabel: @"Pager: "];
|
||||
return [self _phoneOfType: @"pager" withLabel: @"Pager:"];
|
||||
}
|
||||
|
||||
- (BOOL) hasHomeInfos
|
||||
|
@ -383,12 +422,12 @@
|
|||
|
||||
- (NSString *) bday
|
||||
{
|
||||
return [self _cardStringWithLabel: @"Birthday: " value: [card bday]];
|
||||
return [self _cardStringWithLabel: @"Birthday:" value: [card bday]];
|
||||
}
|
||||
|
||||
- (NSString *) tz
|
||||
{
|
||||
return [self _cardStringWithLabel: @"Timezone: " value: [card tz]];
|
||||
return [self _cardStringWithLabel: @"Timezone:" value: [card tz]];
|
||||
}
|
||||
|
||||
- (NSString *) note
|
||||
|
@ -404,7 +443,7 @@
|
|||
withString: @"<br />"];
|
||||
}
|
||||
|
||||
return [self _cardStringWithLabel: @"Note: " value: note];
|
||||
return [self _cardStringWithLabel: @"Note:" value: note];
|
||||
}
|
||||
|
||||
/* hrefs */
|
||||
|
|
Loading…
Reference in a new issue