Monotone-Parent: 8a5f1ab2b6e48cb383ec88a048e8b1985640a5ec

Monotone-Revision: 1beab6f7161f1ff90581edaf85291cb4aa19c519

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-11-07T16:27:46
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2006-11-07 16:27:46 +00:00
parent b66e0e0115
commit 2b8e4fe9af
3 changed files with 35 additions and 22 deletions

View File

@ -113,18 +113,16 @@
unsigned minutes; unsigned minutes;
s = [self queryParameterForKey:@"dur"]; s = [self queryParameterForKey:@"dur"];
if(s && [s length] > 0) { if ([s length] > 0)
minutes = [s intValue]; minutes = [s intValue];
} else
else {
minutes = 60; minutes = 60;
}
utc = [NSTimeZone timeZoneWithName: @"GMT"]; utc = [NSTimeZone timeZoneWithName: @"GMT"];
lStartDate = [self selectedDate]; lStartDate = [self newStartDate];
[lStartDate setTimeZone: utc]; [lStartDate setTimeZone: utc];
lEndDate = [lStartDate dateByAddingYears: 0 months: 0 days: 0 lEndDate = [lStartDate dateByAddingYears: 0 months: 0 days: 0
hours: 0 minutes: minutes seconds: 0]; hours: 0 minutes: minutes seconds: 0];
stamp = [NSCalendarDate calendarDate]; stamp = [NSCalendarDate calendarDate];
[stamp setTimeZone: utc]; [stamp setTimeZone: utc];
@ -348,10 +346,10 @@
ical = [[self clientObject] contentAsString]; ical = [[self clientObject] contentAsString];
if ([ical length] == 0) /* a new appointment */ if ([ical length] == 0) /* a new appointment */
ical = [self iCalStringTemplate]; ical = [self iCalStringTemplate];
[self setICalString:ical]; [self setICalString:ical];
[self loadValuesFromAppointment: [self appointmentFromString: ical]]; [self loadValuesFromAppointment: [self appointmentFromString: ical]];
if (![self canEditComponent]) { if (![self canEditComponent]) {
/* TODO: we need proper ACLs */ /* TODO: we need proper ACLs */
return [self redirectToLocation: [self completeURIForMethod: @"../view"]]; return [self redirectToLocation: [self completeURIForMethod: @"../view"]];

View File

@ -35,6 +35,7 @@
NSCalendarDate *dueDate; NSCalendarDate *dueDate;
BOOL hasStartDate; BOOL hasStartDate;
BOOL hasDueDate; BOOL hasDueDate;
BOOL newTask;
} }
- (void) setTaskStartDate: (NSCalendarDate *) _date; - (void) setTaskStartDate: (NSCalendarDate *) _date;

View File

@ -76,6 +76,8 @@
@"CLASS:PUBLIC\r\n" @"CLASS:PUBLIC\r\n"
@"STATUS:NEEDS-ACTION\r\n" /* confirmed by default */ @"STATUS:NEEDS-ACTION\r\n" /* confirmed by default */
@"PERCENT-COMPLETE:0\r\n" @"PERCENT-COMPLETE:0\r\n"
@"DTSTART:%@Z\r\n"
@"DUE:%@Z\r\n"
@"DTSTAMP:%@Z\r\n" @"DTSTAMP:%@Z\r\n"
@"SEQUENCE:1\r\n" @"SEQUENCE:1\r\n"
@"PRIORITY:5\r\n" @"PRIORITY:5\r\n"
@ -84,23 +86,30 @@
@"END:VTODO\r\n" @"END:VTODO\r\n"
@"END:VCALENDAR"; @"END:VCALENDAR";
NSCalendarDate *stamp; NSCalendarDate *stamp, *lStartDate, *lDueDate;
NSString *template, *s; NSString *template, *s;
NSTimeZone *utc;
unsigned minutes; unsigned minutes;
s = [self queryParameterForKey:@"dur"]; s = [self queryParameterForKey:@"dur"];
if(s && [s length] > 0) { if ([s length] > 0)
minutes = [s intValue]; minutes = [s intValue];
} else
else {
minutes = 60; minutes = 60;
}
utc = [NSTimeZone timeZoneWithName: @"GMT"];
lStartDate = [self newStartDate];
[lStartDate setTimeZone: utc];
lDueDate = [lStartDate dateByAddingYears: 0 months: 0 days: 0
hours: 0 minutes: minutes seconds: 0];
stamp = [NSCalendarDate calendarDate]; stamp = [NSCalendarDate calendarDate];
[stamp setTimeZone: [NSTimeZone timeZoneWithName: @"GMT"]]; [stamp setTimeZone: utc];
s = [self iCalParticipantsAndResourcesStringFromQueryParameters]; s = [self iCalParticipantsAndResourcesStringFromQueryParameters];
template = [NSString stringWithFormat:iCalStringTemplate, template = [NSString stringWithFormat:iCalStringTemplate,
[[self clientObject] nameInContainer], [[self clientObject] nameInContainer],
[lStartDate iCalFormattedDateTimeString],
[lDueDate iCalFormattedDateTimeString],
[stamp iCalFormattedDateTimeString], [stamp iCalFormattedDateTimeString],
[self iCalOrganizerString], [self iCalOrganizerString],
s]; s];
@ -301,9 +310,14 @@
// TODO: can't we use [clientObject contentAsString]? // TODO: can't we use [clientObject contentAsString]?
// ical = [[self clientObject] valueForKey:@"iCalString"]; // ical = [[self clientObject] valueForKey:@"iCalString"];
ical = [[self clientObject] contentAsString]; ical = [[self clientObject] contentAsString];
if ([ical length] == 0) /* a new task */ if ([ical length] == 0)
ical = [self iCalStringTemplate]; {
newTask = YES;
ical = [self iCalStringTemplate];
}
else
newTask = NO;
[self setICalString:ical]; [self setICalString:ical];
[self loadValuesFromTask: [self taskFromString: ical]]; [self loadValuesFromTask: [self taskFromString: ical]];
@ -456,12 +470,12 @@
- (BOOL) hasStartDate - (BOOL) hasStartDate
{ {
return ([self taskStartDate] != nil); return (!newTask && [self taskStartDate] != nil);
} }
- (BOOL) startDateDisabled - (BOOL) startDateDisabled
{ {
return ![self hasStartDate]; return (![self hasStartDate]);
} }
- (void) setHasDueDate: (BOOL) aBool - (void) setHasDueDate: (BOOL) aBool
@ -471,12 +485,12 @@
- (BOOL) hasDueDate - (BOOL) hasDueDate
{ {
return ([self taskDueDate] != nil); return (!newTask && [self taskDueDate] != nil);
} }
- (BOOL) dueDateDisabled - (BOOL) dueDateDisabled
{ {
return ![self hasDueDate]; return (![self hasDueDate]);
} }
- (void) setDueDateDisabled: (BOOL) aBool - (void) setDueDateDisabled: (BOOL) aBool