mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-16 02:38:51 +00:00
rollback
Monotone-Parent: 2d120d90819b42e21a50956a14c0c5d130cfdf09 Monotone-Revision: 376221b991f7b0bee18cfede79614398e85e5b99 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-31T18:52:52 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,28 +1,13 @@
|
||||
// $Id: UIxCalMonthView.m 191 2004-08-12 16:28:32Z helge $
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSKeyValueCoding.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <EOControl/EOQualifier.h>
|
||||
#import <NGExtensions/NSCalendarDate+misc.h>
|
||||
|
||||
#import <SOGo/NSCalendarDate+SOGo.h>
|
||||
|
||||
#import <SOGoUI/SOGoAptFormatter.h>
|
||||
|
||||
#import "UIxCalMonthView.h"
|
||||
#include <SOGo/NSCalendarDate+SOGo.h>
|
||||
#include "UIxCalMonthView.h"
|
||||
#include "common.h"
|
||||
|
||||
@implementation UIxCalMonthView
|
||||
|
||||
- (void)dealloc {
|
||||
[self->currentWeekStart release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSCalendarDate *)startOfMonth {
|
||||
return [[[self selectedDate] firstDayOfMonth] beginOfDay];
|
||||
return [[[super startDate] firstDayOfMonth] beginOfDay];
|
||||
}
|
||||
|
||||
- (NSCalendarDate *)startDate {
|
||||
@@ -41,158 +26,20 @@
|
||||
|
||||
/* URLs */
|
||||
|
||||
- (NSDictionary *) _monthQueryParametersWithOffset: (int) monthsOffset
|
||||
{
|
||||
- (NSDictionary *)prevMonthQueryParameters {
|
||||
NSCalendarDate *date;
|
||||
|
||||
date = [[self startOfMonth] dateByAddingYears: 0 months: monthsOffset days: 0
|
||||
hours:0 minutes:0 seconds:0];
|
||||
|
||||
date = [[self startOfMonth] dateByAddingYears:0 months:-1 days:0
|
||||
hours:0 minutes:0 seconds:0];
|
||||
return [self queryParametersBySettingSelectedDate:date];
|
||||
}
|
||||
|
||||
- (NSDictionary *) monthBeforePrevMonthQueryParameters
|
||||
{
|
||||
return [self _monthQueryParametersWithOffset: -14];
|
||||
}
|
||||
|
||||
- (NSDictionary *) prevMonthQueryParameters
|
||||
{
|
||||
return [self _monthQueryParametersWithOffset: -7];
|
||||
}
|
||||
|
||||
- (NSDictionary *) nextMonthQueryParameters
|
||||
{
|
||||
return [self _monthQueryParametersWithOffset: 7];
|
||||
}
|
||||
|
||||
- (NSDictionary *) monthAfterNextMonthQueryParameters
|
||||
{
|
||||
return [self _monthQueryParametersWithOffset: 14];
|
||||
}
|
||||
|
||||
- (NSString *) _monthNameWithOffsetFromThisMonth: (int) offset
|
||||
{
|
||||
- (NSDictionary *)nextMonthQueryParameters {
|
||||
NSCalendarDate *date;
|
||||
|
||||
date = [[self startOfMonth] dateByAddingYears: 0 months: offset days: 0
|
||||
hours:0 minutes:0 seconds:0];
|
||||
|
||||
return [self localizedNameForMonthOfYear: [date monthOfYear]];
|
||||
}
|
||||
|
||||
- (NSString *) monthBeforeLastMonthName
|
||||
{
|
||||
return [self _monthNameWithOffsetFromThisMonth: -2];
|
||||
}
|
||||
|
||||
- (NSString *) lastMonthName
|
||||
{
|
||||
return [self _monthNameWithOffsetFromThisMonth: -1];
|
||||
}
|
||||
|
||||
- (NSString *) currentMonthName
|
||||
{
|
||||
return [self _monthNameWithOffsetFromThisMonth: 0];
|
||||
}
|
||||
|
||||
- (NSString *) nextMonthName
|
||||
{
|
||||
return [self _monthNameWithOffsetFromThisMonth: 1];
|
||||
}
|
||||
|
||||
- (NSString *) monthAfterNextMonthName
|
||||
{
|
||||
return [self _monthNameWithOffsetFromThisMonth: 2];
|
||||
}
|
||||
|
||||
- (void)configureFormatters {
|
||||
[super configureFormatters];
|
||||
|
||||
[self->aptFormatter setShortTitleOnly];
|
||||
[self->privateAptFormatter setPrivateTitleOnly];
|
||||
}
|
||||
|
||||
- (void)setDayIndex:(int)_idx {
|
||||
self->dayIndex = _idx;
|
||||
}
|
||||
|
||||
- (int)dayIndex {
|
||||
return self->dayIndex;
|
||||
}
|
||||
|
||||
- (void)setDayOfWeek:(int)_day {
|
||||
self->dayOfWeek = _day;
|
||||
}
|
||||
|
||||
- (int)dayOfWeek {
|
||||
return self->dayOfWeek;
|
||||
}
|
||||
|
||||
- (void)setCurrentWeekStartDate:(NSCalendarDate *)_date {
|
||||
ASSIGN(self->currentWeekStart, _date);
|
||||
}
|
||||
|
||||
- (NSCalendarDate *)currentWeekStartDate {
|
||||
return self->currentWeekStart;
|
||||
}
|
||||
|
||||
- (void)setWeekOfYear:(int)_week {
|
||||
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];
|
||||
}
|
||||
|
||||
- (int)weekOfYear {
|
||||
return self->weekOfYear;
|
||||
}
|
||||
|
||||
- (int)year {
|
||||
return [[self startOfMonth] yearOfCommonEra];
|
||||
}
|
||||
|
||||
- (int)month {
|
||||
return [[self startOfMonth] monthOfYear];
|
||||
}
|
||||
|
||||
- (NSString *)localizedDayOfWeekName {
|
||||
return [self localizedNameForDayOfWeek:self->dayOfWeek];
|
||||
}
|
||||
|
||||
- (NSDictionary *)currentWeekQueryParameters {
|
||||
return [self queryParametersBySettingSelectedDate:self->currentWeekStart];
|
||||
}
|
||||
|
||||
|
||||
/* style sheet */
|
||||
|
||||
|
||||
- (NSString *)weekStyle {
|
||||
if([self->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";
|
||||
}
|
||||
|
||||
|
||||
/* appointments */
|
||||
|
||||
|
||||
- (NSArray *)appointments {
|
||||
return [self fetchCoreAppointmentsInfos];
|
||||
date = [[self startOfMonth] dateByAddingYears:0 months:1 days:0
|
||||
hours:0 minutes:0 seconds:0];
|
||||
return [self queryParametersBySettingSelectedDate:date];
|
||||
}
|
||||
|
||||
@end /* UIxCalMonthView */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user