From 44b0bf58aa92308f3f6011ac6d136970a1722b8f Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 30 Aug 2006 22:45:19 +0000 Subject: [PATCH] Monotone-Parent: a336ee635278e6e84b9ccbf7290474e132c9c0a2 Monotone-Revision: 3e32e33bcda13cac968969da6e841bd9e5f639d1 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-08-30T22:45:19 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 3 ++ UI/Scheduler/NSCalendarDate+Scheduler.h | 5 ++- UI/Scheduler/NSCalendarDate+Scheduler.m | 32 +++++++++++++--- UI/Scheduler/NSCalendarDate+UIx.h | 35 ----------------- UI/Scheduler/NSCalendarDate+UIx.m | 50 ------------------------- 5 files changed, 34 insertions(+), 91 deletions(-) delete mode 100644 UI/Scheduler/NSCalendarDate+UIx.h delete mode 100644 UI/Scheduler/NSCalendarDate+UIx.m diff --git a/ChangeLog b/ChangeLog index 48da56814..2a9f40806 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-08-30 Wolfgang Sourdeau + * UI/Scheduler/NSCalendarDate+UIx.[hm]: category removed, code + moved into NSCalendarDate+Scheduler instead. + * SoObjects/Appointments/SOGoAppointmentFolder.m ([SOGoAppointmentFolder -setTimeZone:newTZ]): new method to configure the timezone from SOGoUserFolder when the instance is diff --git a/UI/Scheduler/NSCalendarDate+Scheduler.h b/UI/Scheduler/NSCalendarDate+Scheduler.h index 46d9cd66e..48029e38c 100644 --- a/UI/Scheduler/NSCalendarDate+Scheduler.h +++ b/UI/Scheduler/NSCalendarDate+Scheduler.h @@ -24,9 +24,12 @@ #import -@interface NSCalendarDate (UIxCalMonthOverviewExtensions) +@interface NSCalendarDate (SchedulerExtensions) - (BOOL) isDateInSameMonth: (NSCalendarDate *) _other; +- (NSCalendarDate *) dayOfWeeK: (unsigned) _day + offsetFromSunday: (unsigned) _off; +- (NSCalendarDate *) sundayOfWeek; @end diff --git a/UI/Scheduler/NSCalendarDate+Scheduler.m b/UI/Scheduler/NSCalendarDate+Scheduler.m index fe1a77a69..87c0169ab 100644 --- a/UI/Scheduler/NSCalendarDate+Scheduler.m +++ b/UI/Scheduler/NSCalendarDate+Scheduler.m @@ -19,17 +19,39 @@ 02111-1307, USA. */ +#import + #import "NSCalendarDate+Scheduler.h" -@implementation NSCalendarDate (UIxCalMonthOverviewExtensions) +@implementation NSCalendarDate (SchedulerExtensions) -- (BOOL) isDateInSameMonth: (NSCalendarDate *)_other +- (BOOL) isDateInSameMonth: (NSCalendarDate *) _other { return (([_other yearOfCommonEra] == [self yearOfCommonEra]) && ([_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]; +} + @end - - - diff --git a/UI/Scheduler/NSCalendarDate+UIx.h b/UI/Scheduler/NSCalendarDate+UIx.h deleted file mode 100644 index 83e228ebb..000000000 --- a/UI/Scheduler/NSCalendarDate+UIx.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2004 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ -// $Id: UIxAppointmentEditor.m 181 2004-08-11 15:13:25Z helge $ - -#ifndef __NSCalendarDate_UIx_H__ -#define __NSCalendarDate_UIx_H__ - -#import - -@interface NSCalendarDate(UIx) - -- (NSCalendarDate *)dayOfWeeK:(unsigned)_day offsetFromSunday:(unsigned)_off; -- (NSCalendarDate *)sundayOfWeek; - -@end - -#endif /* __NSCalendarDate_UIx_H__ */ diff --git a/UI/Scheduler/NSCalendarDate+UIx.m b/UI/Scheduler/NSCalendarDate+UIx.m deleted file mode 100644 index 079de1d6b..000000000 --- a/UI/Scheduler/NSCalendarDate+UIx.m +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2004 SKYRIX Software AG - - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - OGo is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with OGo; see the file COPYING. If not, write to the - Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. -*/ -// $Id: UIxAppointmentEditor.m 181 2004-08-11 15:13:25Z helge $ - -#include "NSCalendarDate+UIx.h" -#include "common.h" - -@implementation NSCalendarDate(UIx) - -- (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]; -} - -@end /* NSCalendarDate(UIx) */