Monotone-Parent: 9ae32cf8559ea63dc0055f1841da04821ed5e5ee

Monotone-Revision: dd288587ff94f2fc40c82dd8e32cf52f45b50841

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-10-04T23:12:08
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2006-10-04 23:12:08 +00:00
parent c7e92ce2d7
commit 198ca8e76e
5 changed files with 94 additions and 7 deletions

View File

@@ -1,5 +1,17 @@
2006-10-04 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/NSCalendarDate+SOGo.m: module replacing and
extending UI/Scheduler/NSCalendarDate+Scheduler.m.
([NSCalendarDate
+dateFromShortDateString:dateStringandShortTimeString:timeStringinTimeZone:timeZone]): new method that generates a date from two short string formatted as follow: "yyyymmdd" and "hhmm". Thismethod replaces a similar method from UIxComponent (noted below).
([NSCalendarDate -adjustedDate]): this method returns another
instance set to the correct hour after the original date was set
from a non-GMT timezone. This date can be used for storage.
([NSCalendarDate -driftedDate]): this method does exactly the
opposite of -adjutedDate, that is, it enables the method
hourOfDay, minuteOfHour etc... to return the values according to
the original date's timezone. This date CANNOT be used for storage.
* UI/Scheduler/NSCalendarDate+Scheduler.m ([NSCalendarDate
-shortDateString]): new method that will return a "short date
string" (yyyymmdd) from a calendar date object.

View File

@@ -34,6 +34,7 @@ libSOGo_HEADER_FILES = \
WOContext+Agenor.h \
NSString+URL.h \
NSDictionary+URL.h \
NSCalendarDate+SOGo.h \
\
SOGoAuthenticator.h \
SOGoUser.h \
@@ -54,7 +55,7 @@ libSOGo_OBJC_FILES = \
AgenorUserDefaults.m \
NSDictionary+URL.m \
NSString+URL.m \
\
NSCalendarDate+SOGo.m \
\
SOGoAuthenticator.m \
SOGoUser.m \

View File

@@ -1,4 +1,4 @@
/* NSCalendarDate+Scheduler.h - this file is part of SOGo
/* NSCalendarDate+SOGo.h - this file is part of SOGo
Copyright (C) 2000-2004 SKYRIX Software AG
This file is part of OGo
@@ -24,7 +24,18 @@
#import <Foundation/NSCalendarDate.h>
@interface NSCalendarDate (SchedulerExtensions)
@class NSString;
@class NSTimeZone;
@interface NSCalendarDate (SOGoExtensions)
+ (id) dateFromShortDateString: (NSString *) dateString
andShortTimeString: (NSString *) timeString
inTimeZone: (NSTimeZone *) timeZone;
/* a date tuned to its timezone when initialized with local values */
- (NSCalendarDate *) adjustedDate;
- (NSCalendarDate *) driftedDate;
- (BOOL) isDateInSameMonth: (NSCalendarDate *) _other;
- (NSCalendarDate *) dayOfWeeK: (unsigned) _day

View File

@@ -1,4 +1,4 @@
/* NSCalendarDate+Scheduler.m - this file is part of SOGo
/* NSCalendarDate+SOGo.m - this file is part of SOGo
Copyright (C) 2000-2004 SKYRIX Software AG
This file is part of OGo
@@ -21,9 +21,73 @@
#import <NGExtensions/NSCalendarDate+misc.h>
#import "NSCalendarDate+Scheduler.h"
#import "NSCalendarDate+SOGo.h"
@implementation NSCalendarDate (SchedulerExtensions)
@implementation NSCalendarDate (SOGoExtensions)
+ (id) dateFromShortDateString: (NSString *) dateString
andShortTimeString: (NSString *) timeString
inTimeZone: (NSTimeZone *) timeZone
{
unsigned int year, month, day, hour, minute, total;
NSCalendarDate *cDate, *tmpDate;
if (dateString && [dateString length] == 8)
{
total = [dateString intValue];
year = total / 10000;
total -= year * 10000;
month = total / 100;
day = total - (month * 100);
}
else
{
tmpDate = [NSCalendarDate calendarDate];
tmpDate = [tmpDate addYear: 0 month: 0 day: 0 hour: 0 minute: 0
second: [timeZone secondsFromGMT]];
year = [tmpDate yearOfCommonEra];
month = [tmpDate monthOfYear];
day = [tmpDate dayOfMonth];
}
if (timeString && [timeString length] == 4)
{
total = [timeString intValue];
hour = total / 100;
minute = total - (hour * 100);
}
else
{
hour = 12;
minute = 0;
}
cDate = [self dateWithYear: year month: month day: day
hour: hour minute: minute second: 0
timeZone: timeZone];
return [cDate adjustedDate];
}
- (NSCalendarDate *) adjustedDate
{
NSTimeZone *dTZ;
dTZ = [self timeZone];
return [self addYear: 0 month: 0 day: 0 hour: 0 minute: 0
second: -[dTZ secondsFromGMT]];
}
- (NSCalendarDate *) driftedDate
{
NSTimeZone *dTZ;
dTZ = [self timeZone];
return [self addYear: 0 month: 0 day: 0 hour: 0 minute: 0
second: [dTZ secondsFromGMT]];
}
- (BOOL) isDateInSameMonth: (NSCalendarDate *) _other
{

View File

@@ -10,7 +10,6 @@ SchedulerUI_LANGUAGES = English French German
SchedulerUI_OBJC_FILES = \
SchedulerUIProduct.m \
NSCalendarDate+Scheduler.m \
\
UIxCalMainView.m \
\