See ChangeLog

Monotone-Parent: 271e652157d430b115cb6616b8813b605c897b94
Monotone-Revision: 83587b1afc04162d7191ff57c7f8a78b502a9be3

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-09-27T15:43:46
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2011-09-27 15:43:46 +00:00
parent fc873188cb
commit 76ffdc598c
7 changed files with 116 additions and 2 deletions

View File

@@ -1,3 +1,18 @@
2011-09-27 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/SOGo/SOGoUserDefaults.m (-setBusyOffHours): new setter
for the new defaults SOGoBusyOffHours, which defines if periods
outside business hours should be opaque (busy).
(-busyOffHours): getter corollary to the new method above.
* UI/PreferencesUI/UIxPreferences.m (-setBusyOffHours:): new
setter for the new defaults SOGoBusyOffHours.
(-busyOffHours): getter corollary to the new method above.
* SoObjects/Appointments/SOGoFreeBusyObject.m
(-fetchFreeBusyInfosFrom:to:): add off-hours if defaults
SOGoBusyOffHours is true.
2011-09-26 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreFolder.m

View File

@@ -244,9 +244,11 @@
to: (NSCalendarDate *) endDate
{
SOGoAppointmentFolder *calFolder;
// SoSecurityManager *sm;
SOGoUser *user;
SOGoUserDefaults *ud;
NSArray *folders;
NSMutableArray *infos;
NSString *login;
unsigned int count, max;
infos = [NSMutableArray array];
@@ -263,6 +265,75 @@
to: endDate]];
}
login = [container ownerInContext: context];
user = [SOGoUser userWithLogin: login];
ud = [user userDefaults];
if ([ud busyOffHours])
{
NSCalendarDate *currentStartDate, *currentEndDate, *weekendStartDate, *weekendEndDate;
NSTimeZone *timeZone;
unsigned int dayStartHour, dayEndHour, intervalHours;
BOOL firstRange;
dayStartHour = [ud dayStartHour];
dayEndHour = [ud dayEndHour];
intervalHours = dayStartHour + 24 - dayEndHour;
timeZone = [ud timeZone];
firstRange = YES;
currentStartDate = [NSCalendarDate dateWithYear: [startDate yearOfCommonEra]
month: [startDate monthOfYear]
day: [startDate dayOfMonth]
hour: 0
minute: 0
second: 0
timeZone: timeZone];
currentEndDate = [NSCalendarDate dateWithYear: [startDate yearOfCommonEra]
month: [startDate monthOfYear]
day: [startDate dayOfMonth]
hour: dayStartHour
minute: 0
second: 0
timeZone: timeZone];
while ([currentStartDate compare: endDate] == NSOrderedAscending ||
[currentStartDate compare: endDate] == NSOrderedSame)
{
if ([endDate compare: currentEndDate] == NSOrderedAscending)
currentEndDate = endDate;
[infos addObject: [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool: YES], @"c_isopaque",
([currentStartDate compare: startDate] == NSOrderedAscending)? startDate : currentStartDate, @"startDate",
currentEndDate, @"endDate", nil]];
if (!firstRange
&& currentEndDate != endDate
&& ([currentEndDate dayOfWeek] == 6 || [currentEndDate dayOfWeek] == 0))
{
// Fill weekend days
weekendStartDate = currentEndDate;
weekendEndDate = [weekendStartDate addYear:0 month:0 day:0 hour:(-[weekendStartDate hourOfDay] + dayEndHour) minute:0 second:0];
[infos addObject: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool: YES], @"c_isopaque",
weekendStartDate, @"startDate",
weekendEndDate, @"endDate", nil]];
}
// Compute next range
if (firstRange)
{
currentStartDate = [currentStartDate addYear:0 month:0 day:0 hour:dayEndHour minute:0 second:0];
firstRange = NO;
}
else
{
currentStartDate = [currentStartDate addYear:0 month:0 day:1 hour:0 minute:0 second:0];
}
currentEndDate = [currentStartDate addYear:0 month:0 day:0 hour:intervalHours minute:0 second:0];
}
}
return infos;
}

View File

@@ -72,6 +72,9 @@ extern NSString *SOGoWeekStartFirstFullWeek;
- (NSString *) dayEndTime;
- (unsigned int) dayEndHour;
- (void) setBusyOffHours: (BOOL) busyOffHours;
- (BOOL) busyOffHours;
- (void) setTimeZoneName: (NSString *) newValue;
- (NSString *) timeZoneName;

View File

@@ -283,6 +283,16 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
return [[self dayEndTime] timeValue];
}
- (void) setBusyOffHours: (BOOL) newValue
{
[self setBool: newValue forKey: @"SOGoBusyOffHours"];
}
- (BOOL) busyOffHours
{
return [self boolForKey: @"SOGoBusyOffHours"];
}
- (void) setTimeZoneName: (NSString *) newValue
{
[self setObject: newValue forKey: @"SOGoTimeZone"];

View File

@@ -483,6 +483,16 @@
[userDefaults setDayEndTime: newTime];
}
- (void) setBusyOffHours: (BOOL) busyOffHours
{
[userDefaults setBusyOffHours: busyOffHours];
}
- (BOOL) busyOffHours
{
return [userDefaults busyOffHours];
}
- (NSArray *) firstWeekList
{
return [NSArray arrayWithObjects:

View File

@@ -97,6 +97,11 @@
const:id="dayEndTime"
string="item" selection="userDayEndTime"
/></label><br/>
<label><input type="checkbox"
const:name="busyOffHours"
const:id="busyOffHours"
var:checked="busyOffHours" />
<var:string label:value="Show time as busy outside working hours"/></label><br/>
<label><var:string label:value="First week of year :"/>
<var:popup list="firstWeekList" item="item"
const:id="firstWeek"

View File

@@ -51,7 +51,7 @@ DIV.listWrapper
#calendarCategoriesListWrapper
{ bottom: 30px;
right: 2em;
top: 108px;
top: 128px;
left: 2em; }
#contactsCategoriesListWrapper