mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-24 02:46:24 +00:00
Monotone-Parent: 5ce544e4196355529d09f53ee1f29a26e0df0733
Monotone-Revision: 2cf3be019f697c04a2f19de8e9693b7b7a1ddf8d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-08-09T21:37:35 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -19,11 +19,12 @@
|
||||
02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "UIxContactEditorBase.h"
|
||||
#include <Contacts/SOGoContactObject.h>
|
||||
#include <Contacts/SOGoContactFolder.h>
|
||||
#include "common.h"
|
||||
|
||||
#include "UIxContactEditorBase.h"
|
||||
|
||||
@implementation UIxContactEditorBase
|
||||
|
||||
- (id)init {
|
||||
@@ -43,9 +44,11 @@
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (void)setContentString:(NSString *)_cstr {
|
||||
- (void)setContentString:(NSString *)_cstr
|
||||
{
|
||||
ASSIGNCOPY(self->contentString, _cstr);
|
||||
}
|
||||
|
||||
- (NSString *)contentString {
|
||||
return self->contentString;
|
||||
}
|
||||
@@ -185,31 +188,36 @@
|
||||
|
||||
- (void) initSnapshot
|
||||
{
|
||||
NSString *c;
|
||||
NGVCard *vCard;
|
||||
|
||||
/* load iCalendar file */
|
||||
|
||||
c = [[self clientObject] contentAsString];
|
||||
if ([c length] == 0) /* a new contact */
|
||||
c = [self contentStringTemplate];
|
||||
|
||||
[self setContentString:c];
|
||||
[self loadValuesFromContentString:c];
|
||||
vCard = [[self clientObject] vCard];
|
||||
if (vCard)
|
||||
// if ([c length] == 0) /* a new contact */
|
||||
// c = [self contentStringTemplate];
|
||||
{
|
||||
// [self setContent: record];
|
||||
// [self loadValuesFromContentString: record];
|
||||
}
|
||||
}
|
||||
|
||||
- (id<WOActionResults>)defaultAction {
|
||||
- (id <WOActionResults>) defaultAction
|
||||
{
|
||||
// TODO: very similiar to apt-editor (apt editor would need to use std names
|
||||
[self initSnapshot];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)viewActionName {
|
||||
- (NSString *) viewActionName
|
||||
{
|
||||
/* this is overridden in the mail based contacts UI to redirect to tb.edit */
|
||||
return @"";
|
||||
}
|
||||
|
||||
- (NSString *)editActionName {
|
||||
- (NSString *) editActionName
|
||||
{
|
||||
/* this is overridden in the mail based contacts UI to redirect to tb.edit */
|
||||
return @"edit";
|
||||
}
|
||||
@@ -218,48 +226,48 @@
|
||||
{
|
||||
NSException *ex;
|
||||
NSString *uri;
|
||||
NSDictionary *record;
|
||||
// NSDictionary *record;
|
||||
NSMutableDictionary *newRecord;
|
||||
|
||||
if ([[self clientObject]
|
||||
respondsToSelector: @selector (saveContentString:)])
|
||||
{
|
||||
if (contentString)
|
||||
{
|
||||
record = [contentString propertyList];
|
||||
if (record)
|
||||
{
|
||||
newRecord = [[record mutableCopy] autorelease];
|
||||
[self saveValuesIntoRecord: newRecord];
|
||||
ex = [[self clientObject] saveRecord: newRecord];
|
||||
if (ex)
|
||||
{
|
||||
[self setErrorText: [ex reason]];
|
||||
// if ([[self clientObject]
|
||||
// respondsToSelector: @selector (saveContentString:)])
|
||||
// {
|
||||
// if (contentString)
|
||||
// {
|
||||
// record = [contentString propertyList];
|
||||
// if (record)
|
||||
// {
|
||||
// newRecord = [[record mutableCopy] autorelease];
|
||||
// [self saveValuesIntoRecord: newRecord];
|
||||
// ex = [[self clientObject] saved];
|
||||
// if (ex)
|
||||
// {
|
||||
// [self setErrorText: [ex reason]];
|
||||
|
||||
return self;
|
||||
}
|
||||
else
|
||||
{
|
||||
uri = [self viewActionName];
|
||||
if ([uri length] <= 0)
|
||||
uri = @"..";
|
||||
// return self;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// uri = [self viewActionName];
|
||||
// if ([uri length] <= 0)
|
||||
// uri = @"..";
|
||||
|
||||
return [self redirectToLocation: [self _completeURIForMethod: uri]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setErrorText: @"Invalid property list data ..."]; // localize
|
||||
return self;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setErrorText: @"Missing object content!"]; // localize
|
||||
return self;
|
||||
}
|
||||
}
|
||||
else
|
||||
// return [self redirectToLocation: [self _completeURIForMethod: uri]];
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// [self setErrorText: @"Invalid property list data ..."]; // localize
|
||||
// return self;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// [self setErrorText: @"Missing object content!"]; // localize
|
||||
// return self;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
return [NSException exceptionWithHTTPStatus: 400 /* Bad Request */
|
||||
reason: @"method cannot be invoked on "
|
||||
@"the specified object"];
|
||||
|
||||
Reference in New Issue
Block a user