+2008-03-10 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * UI/Scheduler/UIxCalMonthViewOld.m ([UIxCalMonthViewOld
+ -endDate]): removed useless method.
+
+ * SoObjects/SOGo/NSCalendarDate+SOGo.m
+ ([-dayOfWeeK:_dayoffsetFromSunday:_offset]): removed useless
+ method.
+ ([-sundayOfWeek]): removed useless method.
+
2008-03-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OGoContentStore/OCSContactFieldExtractor.m
inTimeZone: (NSTimeZone *) timeZone;
- (BOOL) isDateInSameMonth: (NSCalendarDate *) _other;
-- (NSCalendarDate *) dayOfWeeK: (unsigned) _day
- offsetFromSunday: (unsigned) _off;
-- (NSCalendarDate *) sundayOfWeek;
-- (NSString *) shortDateString;
+- (NSString *) shortDateString;
- (NSString *) rfc822DateString;
+ (id) distantFuture;
([_other monthOfYear] == [self monthOfYear]));
}
-- (NSCalendarDate *) dayOfWeeK: (unsigned) _day
- offsetFromSunday: (unsigned) _offset
-{
- unsigned dayOfWeek, distance;
-
- /* perform "locale" correction */
- dayOfWeek = (7 + [self dayOfWeek] - _offset) % 7;
-
- _day = (_day % 7);
- if(_day == dayOfWeek)
- return self;
-
- distance = _day - dayOfWeek;
- return [self dateByAddingYears:0 months:0 days:distance];
-}
-
-/* this implies that monday is the start of week! */
-
-- (NSCalendarDate *) sundayOfWeek
-{
- return [self dayOfWeeK:6 offsetFromSunday:1];
-}
-
- (NSString *) shortDateString
{
NSString *str;
if ((self = [super init]))
{
locale = nil;
-// locale = [_locale retain];
-
-// if ([[locale objectForKey:@"NSLocaleCode"] isEqualToString: @"fr"])
-// shortDateFormat = SOGoDateDMYFormat;
-// else
-// shortDateFormat = SOGoDateISOFormat;
shortDateFormat = nil;
longDateFormat = nil;
timeFormat = nil;
ASSIGN (timeFormat, newFormat);
}
-// - (void) setFullWeekdayNameAndDetails
-// {
-// auxFormatAction = formatAction;
-// formatAction = @selector(fullWeekdayNameAndDetailsForDate:);
-// }
-
/* operation */
- (NSString *) _date: (NSCalendarDate *) date
return formattedString;
}
-// /* Helpers */
-
-// - (NSString *)shortDayOfWeek:(int)_day {
-// return [[locale objectForKey:@"NSShortWeekDayNameArray"]
-// objectAtIndex:_day];
-// }
-
-// - (NSString *)fullDayOfWeek:(int)_day {
-// return [[locale objectForKey:@"NSWeekDayNameArray"]
-// objectAtIndex:_day];
-// }
-
-// - (NSString *)shortMonthOfYear:(int)_month {
-// return [[locale objectForKey:@"NSShortMonthNameArray"]
-// objectAtIndex:_month - 1];
-// }
-
-// - (NSString *)fullMonthOfYear:(int)_month {
-// return [[locale objectForKey:@"NSMonthNameArray"]
-// objectAtIndex:_month - 1];
-// }
-
-
-/* Private API */
-
-// - (NSString *) fullWeekdayNameAndDetailsForDate: (NSCalendarDate *) _date
-// {
-// NSMutableString *desc;
-
-// if (_date)
-// {
-// desc = [NSMutableString stringWithCapacity:24];
-// [desc appendString:[self fullDayOfWeek:[_date dayOfWeek]]];
-// [desc appendString:@", "];
-// [desc appendString:[self performSelector:auxFormatAction
-// withObject:_date]];
-// [desc appendString:@" "];
-// [desc appendFormat:@"%02d:%02d ", [_date hourOfDay], [_date minuteOfHour]];
-// [desc appendString:[[_date timeZone] abbreviation]];
-// }
-// else
-// desc = nil;
-
-// return desc;
-// }
-
-// - (NSString *) _separatorForFormat: (unsigned int) format
-// {
-// NSString *separator;
-
-// switch (format & (3))
-// {
-// case SOGoDateDotFormat:
-// separator = @".";
-// break;
-// case SOGoDateDashFormat:
-// separator = @".";
-// break;
-// default:
-// separator = @"/";
-// }
-
-// return separator;
-// }
-
-// - (NSString *) _dateFormatForDate: (NSCalendarDate *) date
-// withFormat: (unsigned int) format
-// andSeparator: (NSString *) separator
-// {
-// NSString *day, *month, *year;
-// NSString *formattedDate;
-
-// day = [NSString stringWithFormat: @"%.2d", [date dayOfMonth]];
-// month = [NSString stringWithFormat: @"%.2d", [date monthOfYear]];
-// if (format & SOGoDateTwoDigitsYearFormat)
-// year = [NSString stringWithFormat: @"%.2d", [date yearOfCommonEra] % 100];
-// else
-// year = [NSString stringWithFormat: @"%.4d", [date yearOfCommonEra]];
-
-// if (format & SOGoDateDMYFormat)
-// formattedDate = [NSString stringWithFormat: @"%@%@%@%@%@",
-// day, separator, month, separator, year];
-// else if (format & SOGoDateMDYFormat)
-// formattedDate = [NSString stringWithFormat: @"%@%@%@%@%@",
-// month, separator, day, separator, year];
-// else
-// formattedDate = [NSString stringWithFormat: @"%@%@%@%@%@",
-// year, separator, month, separator, day];
-
-// return formattedDate;
-// }
-
-// - (NSString *) date: (NSCalendarDate *) date
-// withFormat: (unsigned int) format
-// {
-// NSString *separator;
-
-// separator = [self _separatorForFormat: format];
-
-// return [self _dateFormatForDate: date
-// withFormat: format
-// andSeparator: separator];
-// }
-
-// - (NSString *) date: (NSCalendarDate *) date
-// withNSFormat: (NSNumber *) format
-// {
-// return [self date: date withFormat: [format unsignedIntValue]];
-// }
-
@end /* SOGoDateFormatter */
languages: languages];
}
-- (NSString *) localizedNameForDayOfWeek:(unsigned)_dayOfWeek {
- NSString *key = [dayLabelKeys objectAtIndex:_dayOfWeek % 7];
- return [self labelForKey:key];
+- (NSString *) localizedNameForDayOfWeek: (unsigned) dayOfWeek
+{
+ return [self labelForKey: [dayLabelKeys objectAtIndex: dayOfWeek % 7]];
}
-- (NSString *)localizedAbbreviatedNameForDayOfWeek:(unsigned)_dayOfWeek {
- NSString *key = [abbrDayLabelKeys objectAtIndex:_dayOfWeek % 7];
- return [self labelForKey:key];
+- (NSString *) localizedAbbreviatedNameForDayOfWeek: (unsigned) dayOfWeek
+{
+ return [self labelForKey: [abbrDayLabelKeys objectAtIndex: dayOfWeek % 7]];
}
-- (NSString *)localizedNameForMonthOfYear:(unsigned)_monthOfYear {
- NSString *key = [monthLabelKeys objectAtIndex:(_monthOfYear - 1) % 12];
- return [self labelForKey:key];
+- (NSString *) localizedNameForMonthOfYear: (unsigned) monthOfYear
+{
+ return [self labelForKey: [monthLabelKeys objectAtIndex: (monthOfYear - 1) % 12]];
}
-- (NSString *)localizedAbbreviatedNameForMonthOfYear:(unsigned)_monthOfYear {
- NSString *key = [abbrMonthLabelKeys objectAtIndex:(_monthOfYear - 1) % 12];
- return [self labelForKey:key];
+- (NSString *) localizedAbbreviatedNameForMonthOfYear: (unsigned) monthOfYear
+{
+ return [self labelForKey: [abbrMonthLabelKeys objectAtIndex: (monthOfYear - 1) % 12]];
}
/* HTTP method safety */
@implementation UIxCalMonthOverview
- (void)dealloc {
- [self->currentWeekStart release];
+ [currentWeekStart release];
[super dealloc];
}
- (void)configureFormatters {
[super configureFormatters];
- [self->aptFormatter setShortTitleOnly];
- [self->privateAptFormatter setPrivateTitleOnly];
+ [aptFormatter setShortTitleOnly];
+ [privateAptFormatter setPrivateTitleOnly];
}
- (void)setDayIndex:(int)_idx {
- self->dayIndex = _idx;
+ dayIndex = _idx;
}
- (int)dayIndex {
- return self->dayIndex;
+ return dayIndex;
}
- (void)setDayOfWeek:(int)_day {
- self->dayOfWeek = _day;
+ dayOfWeek = _day;
}
- (int)dayOfWeek {
- return self->dayOfWeek;
+ return dayOfWeek;
}
- (void)setCurrentWeekStartDate:(NSCalendarDate *)_date {
- ASSIGN(self->currentWeekStart, _date);
+ ASSIGN(currentWeekStart, _date);
}
- (NSCalendarDate *)currentWeekStartDate {
- return self->currentWeekStart;
+ return currentWeekStart;
}
- (void)setWeekOfYear:(int)_week {
- NSCalendarDate *date;
+ NSCalendarDate *date;
- self->weekOfYear = _week;
- if(_week == 52 || _week == 53)
- date = [[self startOfMonth] mondayOfWeek];
- else
- date = [self startOfMonth];
- date = [date mondayOfWeek:_week];
- [self setCurrentWeekStartDate:date];
+ weekOfYear = _week;
+ if(_week == 52 || _week == 53)
+ date = [[self startOfMonth] mondayOfWeek];
+ else
+ date = [self startOfMonth];
+ date = [date mondayOfWeek:_week];
+ [self setCurrentWeekStartDate:date];
}
- (int)weekOfYear {
- return self->weekOfYear;
+ return weekOfYear;
}
- (int)year {
- return [[self startOfMonth] yearOfCommonEra];
+ return [[self startOfMonth] yearOfCommonEra];
}
- (int)month {
- return [[self startOfMonth] monthOfYear];
+ return [[self startOfMonth] monthOfYear];
}
- (NSString *)localizedDayOfWeekName {
- return [self localizedNameForDayOfWeek:self->dayOfWeek];
+ return [self localizedNameForDayOfWeek:dayOfWeek];
}
- (NSDictionary *)currentWeekQueryParameters {
- return [self queryParametersBySettingSelectedDate:self->currentWeekStart];
+ return [self queryParametersBySettingSelectedDate:currentWeekStart];
}
- (NSString *)weekStyle {
- if([self->currentWeekStart isDateInSameWeek:[NSCalendarDate date]])
- return @"monthoverview_week_hilite";
- return @"monthoverview_week";
+ if([currentWeekStart isDateInSameWeek:[NSCalendarDate date]])
+ return @"monthoverview_week_hilite";
+ return @"monthoverview_week";
}
- (NSString *)contentStyle {
- if([self->currentDay isToday])
- return @"monthoverview_content_hilite";
- else if([self->currentDay monthOfYear] != [[self startOfMonth] monthOfYear])
- return @"monthoverview_content_dimmed";
- return @"monthoverview_content";
+ if([currentDay isToday])
+ return @"monthoverview_content_hilite";
+ else if([currentDay monthOfYear] != [[self startOfMonth] monthOfYear])
+ return @"monthoverview_content_dimmed";
+ return @"monthoverview_content";
}
@implementation UIxCalMonthViewOld
-- (NSCalendarDate *)startOfMonth {
+- (NSCalendarDate *) startOfMonth
+{
return [[[super startDate] firstDayOfMonth] beginOfDay];
}
-- (NSCalendarDate *)startDate {
+- (NSCalendarDate *) startDate
+{
return [[self startOfMonth] mondayOfWeek];
}
-- (NSCalendarDate *)endDate {
- NSCalendarDate *date;
-
- date = [self startOfMonth];
- date = [date dateByAddingYears:0 months:0 days:[date numberOfDaysInMonth]
- hours:0 minutes:0 seconds:0];
- date = [[date sundayOfWeek] endOfDay];
- return date;
-}
-
/* URLs */
-- (NSDictionary *)prevMonthQueryParameters {
+- (NSDictionary *) prevMonthQueryParameters
+{
NSCalendarDate *date;
date = [[self startOfMonth] dateByAddingYears:0 months:-1 days:0
return [self queryParametersBySettingSelectedDate:date];
}
-- (NSDictionary *)nextMonthQueryParameters {
+- (NSDictionary *)nextMonthQueryParameters
+{
NSCalendarDate *date;
date = [[self startOfMonth] dateByAddingYears:0 months:1 days:0