mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-11 23:07:12 +00:00
Monotone-Parent: c36e4dbaaa40c95b58d682bbbe6f0a563275afa1
Monotone-Revision: a0ddb6969a3af4885bc30844a5dc0bcda95a8212 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-03-12T20:24:59 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
1 parent
c3f943b7a7
commit
d7bca94299
3 files changed
+41
-36
No files matched your search
@@ -23,6 +23,7 @@
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
|
||||
#import <NGObjWeb/NSException+HTTP.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
@@ -79,14 +80,33 @@
|
||||
|
||||
- (iCalRepeatableEntityObject *) newOccurenceWithID: (NSString *) recID
|
||||
{
|
||||
iCalEvent *newOccurence;
|
||||
NSCalendarDate *date;
|
||||
iCalEvent *newOccurence, *master;
|
||||
NSCalendarDate *date, *firstDate;
|
||||
unsigned int interval, nbrDays;
|
||||
SOGoUserDefaults *ud;
|
||||
NSTimeZone *timeZone;
|
||||
int daylightOffset;
|
||||
|
||||
ud = [[SOGoUser userWithLogin: owner] userDefaults];
|
||||
timeZone = [ud timeZone];
|
||||
|
||||
newOccurence = (iCalEvent *) [super newOccurenceWithID: recID];
|
||||
date = [newOccurence recurrenceId];
|
||||
interval = [[newOccurence endDate]
|
||||
timeIntervalSinceDate: [newOccurence startDate]];
|
||||
|
||||
master = [self component: NO secure: NO];
|
||||
firstDate = [master startDate];
|
||||
|
||||
// We are creating a new exception in a recurrent event -- compute the daylight
|
||||
// saving time with respect to the first occurrence of the recurrent event.
|
||||
daylightOffset = (int) ([timeZone secondsFromGMTForDate: firstDate]
|
||||
- [timeZone secondsFromGMTForDate: date]);
|
||||
if (daylightOffset)
|
||||
date = [date dateByAddingYears: 0 months: 0 days: 0
|
||||
hours:0 minutes: 0 seconds: daylightOffset];
|
||||
[date setTimeZone: timeZone];
|
||||
|
||||
interval = [[master endDate]
|
||||
timeIntervalSinceDate: firstDate];
|
||||
if ([newOccurence isAllDay])
|
||||
{
|
||||
nbrDays = ((float) abs (interval) / 86400) + 1;
|
||||
@@ -94,14 +114,15 @@
|
||||
duration: nbrDays];
|
||||
}
|
||||
else
|
||||
[newOccurence setStartDate: date];
|
||||
|
||||
[newOccurence setEndDate: [date addYear: 0
|
||||
month: 0
|
||||
day: 0
|
||||
hour: 0
|
||||
minute: 0
|
||||
second: interval]];
|
||||
{
|
||||
[newOccurence setStartDate: date];
|
||||
[newOccurence setEndDate: [date addYear: 0
|
||||
month: 0
|
||||
day: 0
|
||||
hour: 0
|
||||
minute: 0
|
||||
second: interval]];
|
||||
}
|
||||
|
||||
return newOccurence;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user