merge of 'acb80bff5c509e32241ffa6715083280a5bb9158'

and 'b718c48057e1fd4a0cc8a43b5d71809846232ca6'

Monotone-Parent: acb80bff5c509e32241ffa6715083280a5bb9158
Monotone-Parent: b718c48057e1fd4a0cc8a43b5d71809846232ca6
Monotone-Revision: f19a49f2c5d69679992d50a3ebb685975f47b75e

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-08-18T13:50:55
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-08-18 13:50:55 +00:00
6 changed files with 89 additions and 51 deletions
+8
View File
@@ -1,3 +1,11 @@
2010-08-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Appointments/iCalEvent+SOGo.m (-quickRecord): we now
make use of the new -[iCalAlarm nextAlarmDate] method.
* SoObjects/Appointments/iCalToDo+SOGo.m (-quickRecord): we now
make use of the new -[iCalAlarm nextAlarmDate] method.
2010-08-12 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/WebServerResources/MailerUIdTree.js: (getMailboxNode): fixed
+5
View File
@@ -1,3 +1,8 @@
2010-08-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalAlarm.m (-nextAlarmDate): new utility method split from the
SOGo quick table extractor for events.
2010-08-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* NGVCardPhoto.m (-type): returns @"JPEG" if the type is
+2
View File
@@ -41,6 +41,8 @@
- (void) setRecurrenceRule: (NSString *) _recurrenceRule;
- (NSString *) recurrenceRule;
- (NSCalendarDate *) nextAlarmDate;
@end
#endif /* __NGCards_iCalAlarm_H__ */
+50
View File
@@ -20,10 +20,15 @@
*/
#import <Foundation/NSString.h>
#import <NGExtensions/NSNull+misc.h>
#import <NGExtensions/NSObject+Logs.h>
#import "iCalAttachment.h"
#import "iCalEvent.h"
#import "iCalRecurrenceRule.h"
#import "iCalTrigger.h"
#import "iCalToDo.h"
#import "NSString+NGCards.h"
#import "iCalAlarm.h"
@@ -103,4 +108,49 @@
return [[self uniqueChildWithTag: @"rrule"] value: 0];
}
- (NSCalendarDate *) nextAlarmDate
{
Class parentClass;
iCalTrigger *aTrigger;
NSCalendarDate *relationDate, *nextAlarmDate;
NSString *relation;
NSTimeInterval anInterval;
// We currently have the following limitations for alarms:
// - the alarm's trigger value type must be DURATION;
nextAlarmDate = nil;
parentClass = [parent class];
if ([parentClass isKindOfClass: [iCalEvent class]]
|| [parentClass isKindOfClass: [iCalToDo class]])
{
aTrigger = [self trigger];
if ([[aTrigger valueType] caseInsensitiveCompare: @"DURATION"])
{
relation = [aTrigger relationType];
anInterval = [[aTrigger value] durationAsTimeInterval];
if ([relation caseInsensitiveCompare: @"END"] == NSOrderedSame)
{
if ([parentClass isKindOfClass: [iCalEvent class]])
relationDate = [(iCalEvent *) parent endDate];
else
relationDate = [(iCalToDo *) parent due];
}
else
relationDate = [(iCalEntityObject *) parent startDate];
// Compute the next alarm date with respect to the reference date
if ([relationDate isNotNull])
nextAlarmDate = [relationDate addTimeInterval: anInterval];
}
}
else
[self warnWithFormat: @"alarms not handled for elements of class '%@'",
NSStringFromClass (parentClass)];
return nextAlarmDate;
}
@end /* iCalAlarm */
+13 -30
View File
@@ -77,7 +77,6 @@
startDate = [self startDate];
endDate = [self endDate];
nextAlarmDate = nil;
uid = [self uid];
title = [self summary];
if (![title isNotNull])
@@ -203,46 +202,30 @@
[row setObject:partstates forKey: @"c_partstates"];
[partstates release];
if ([self hasAlarms])
nextAlarmDate = nil;
if (![self isRecurrent] && [self hasAlarms])
{
// We currently have the following limitations for alarms:
// - the event must not be recurrent;
// - the component must not be recurrent;
// - only the first alarm is considered;
// - the alarm's action must be of type DISPLAY;
// - the alarm's trigger value type must be DURATION;
//
// Morever, we don't update the quick table if the property X-WebStatus
// of the trigger is set to "triggered".
iCalAlarm *anAlarm;
iCalTrigger *aTrigger;
NSCalendarDate *relationDate;
NSString *relation, *webstatus;
NSTimeInterval anInterval;
NSString *webstatus;
anAlarm = [[self alarms] objectAtIndex: 0];
aTrigger = [anAlarm trigger];
relation = [aTrigger relationType];
anInterval = [[aTrigger value] durationAsTimeInterval];
if ([[anAlarm action] caseInsensitiveCompare: @"DISPLAY"] == NSOrderedSame &&
[[aTrigger valueType] caseInsensitiveCompare: @"DURATION"] == NSOrderedSame &&
![self isRecurrent])
{
webstatus = [aTrigger value: 0 ofAttribute: @"x-webstatus"];
if (!webstatus ||
[webstatus caseInsensitiveCompare: @"TRIGGERED"] != NSOrderedSame)
{
if ([relation caseInsensitiveCompare: @"END"] == NSOrderedSame)
relationDate = endDate;
else
relationDate = startDate;
// Compute the next alarm date with respect to the reference date
if ([relationDate isNotNull])
nextAlarmDate = [relationDate addTimeInterval: anInterval];
}
}
if ([[anAlarm action] caseInsensitiveCompare: @"DISPLAY"]
== NSOrderedSame)
{
webstatus = [[anAlarm trigger] value: 0 ofAttribute: @"x-webstatus"];
if (!webstatus
|| ([webstatus caseInsensitiveCompare: @"TRIGGERED"]
!= NSOrderedSame))
nextAlarmDate = [anAlarm nextAlarmDate];
}
}
if ([nextAlarmDate isNotNull])
[row setObject: [NSNumber numberWithInt: [nextAlarmDate timeIntervalSince1970]]
+11 -21
View File
@@ -171,39 +171,29 @@
[row setObject:partstates forKey: @"c_partstates"];
[partstates release];
if ([self hasAlarms])
nextAlarmDate = nil;
if (![self isRecurrent] && [self hasAlarms])
{
// We currently have the following limitations for alarms:
// - the component must not be recurrent;
// - only the first alarm is considered;
// - the alarm's action must be of type DISPLAY;
// - the alarm's trigger value type must be DURATION;
//
// Morever, we don't update the quick table if the property X-WebStatus
// of the trigger is set to "triggered".
iCalAlarm *anAlarm;
iCalTrigger *aTrigger;
NSString *webstatus;
NSTimeInterval anInterval;
anAlarm = [[self alarms] objectAtIndex: 0];
aTrigger = [anAlarm trigger];
anInterval = [[aTrigger value] durationAsTimeInterval];
if ([[anAlarm action] caseInsensitiveCompare: @"DISPLAY"] == NSOrderedSame &&
[[aTrigger valueType] caseInsensitiveCompare: @"DURATION"] == NSOrderedSame &&
![self isRecurrent])
{
webstatus = [aTrigger value: 0 ofAttribute: @"x-webstatus"];
if (!webstatus ||
[webstatus caseInsensitiveCompare: @"TRIGGERED"] != NSOrderedSame)
{
// Compute the next alarm date with respect to the due date
if ([dueDate isNotNull])
nextAlarmDate = [dueDate addTimeInterval: anInterval];
}
}
if ([[anAlarm action] caseInsensitiveCompare: @"DISPLAY"]
== NSOrderedSame)
{
webstatus = [[anAlarm trigger] value: 0 ofAttribute: @"x-webstatus"];
if (!webstatus
|| ([webstatus caseInsensitiveCompare: @"TRIGGERED"]
!= NSOrderedSame))
nextAlarmDate = [anAlarm nextAlarmDate];
}
}
if ([nextAlarmDate isNotNull])
[row setObject: [NSNumber numberWithInt: [nextAlarmDate timeIntervalSince1970]]