From a0548561b6a815a3bb7725d64813aebc1255b90f Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 13 Aug 2010 21:28:15 +0000 Subject: [PATCH] Monotone-Parent: 9bb74304731864ba16d9eddd716cd890df9d5af6 Monotone-Revision: b718c48057e1fd4a0cc8a43b5d71809846232ca6 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-08-13T21:28:15 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 +++++ SoObjects/Appointments/iCalEvent+SOGo.m | 43 ++++++++----------------- SoObjects/Appointments/iCalToDo+SOGo.m | 32 +++++++----------- 3 files changed, 32 insertions(+), 51 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3be02f72c..1fa5f6024 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-08-13 Wolfgang Sourdeau + + * 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 * UI/WebServerResources/MailerUIdTree.js: (getMailboxNode): fixed diff --git a/SoObjects/Appointments/iCalEvent+SOGo.m b/SoObjects/Appointments/iCalEvent+SOGo.m index 29f691c15..df1e1059b 100644 --- a/SoObjects/Appointments/iCalEvent+SOGo.m +++ b/SoObjects/Appointments/iCalEvent+SOGo.m @@ -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]] diff --git a/SoObjects/Appointments/iCalToDo+SOGo.m b/SoObjects/Appointments/iCalToDo+SOGo.m index 00945c2fc..7d03d8c2d 100644 --- a/SoObjects/Appointments/iCalToDo+SOGo.m +++ b/SoObjects/Appointments/iCalToDo+SOGo.m @@ -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]]