From 57a41a18afce07f3d600b00e6130917e983974fd Mon Sep 17 00:00:00 2001 From: helge Date: Thu, 26 Aug 2004 14:46:16 +0000 Subject: [PATCH] code cleanups git-svn-id: http://svn.opengroupware.org/SOGo/trunk@275 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/SOGoUI/ChangeLog | 10 ++++ SOGo/UI/SOGoUI/SOGoDateFormatter.h | 10 ++-- SOGo/UI/SOGoUI/SOGoDateFormatter.m | 88 ++++++++++++++---------------- SOGo/UI/SOGoUI/UIxComponent.m | 7 +-- SOGo/UI/SOGoUI/Version | 2 +- SOGo/UI/SOGoUI/common.h | 26 +++++++++ 6 files changed, 86 insertions(+), 57 deletions(-) create mode 100644 SOGo/UI/SOGoUI/common.h diff --git a/SOGo/UI/SOGoUI/ChangeLog b/SOGo/UI/SOGoUI/ChangeLog index 653e6009..d61fb7e4 100644 --- a/SOGo/UI/SOGoUI/ChangeLog +++ b/SOGo/UI/SOGoUI/ChangeLog @@ -1,3 +1,13 @@ +2004-08-26 Helge Hess + + * v0.9.11 + + * SOGoDateFormatter.m: minor cleanups + + * UIxComponent.m: fixed includes to fix warnings + + * added common.h + 2004-08-24 Marcus Mueller * UIxComponent.m: new date related methods moved here from UIxCalView diff --git a/SOGo/UI/SOGoUI/SOGoDateFormatter.h b/SOGo/UI/SOGoUI/SOGoDateFormatter.h index 9ec86c32..89f038c6 100644 --- a/SOGo/UI/SOGoUI/SOGoDateFormatter.h +++ b/SOGo/UI/SOGoUI/SOGoDateFormatter.h @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2004 SKYRIX Software AG - This file is part of OGo + 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 @@ -18,15 +18,13 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ - #ifndef __SOGoDateFormatter_H_ #define __SOGoDateFormatter_H_ +#import -#import - +@class NSString, NSDictionary; @interface SOGoDateFormatter : NSFormatter { diff --git a/SOGo/UI/SOGoUI/SOGoDateFormatter.m b/SOGo/UI/SOGoUI/SOGoDateFormatter.m index ef1fe972..cf955455 100644 --- a/SOGo/UI/SOGoUI/SOGoDateFormatter.m +++ b/SOGo/UI/SOGoUI/SOGoDateFormatter.m @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2004 SKYRIX Software AG - This file is part of OGo + 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 @@ -18,12 +18,9 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ - - -#import "SOGoDateFormatter.h" -#import +#include "SOGoDateFormatter.h" +#include "common.h" @interface SOGoDateFormatter (PrivateAPI) - (NSString *)shortDayOfWeek:(int)_day; @@ -35,82 +32,81 @@ - (NSString *)fullWeekdayNameAndDetailsForDate:(NSCalendarDate *)_date; @end - @implementation SOGoDateFormatter - (id)initWithLocale:(NSDictionary *)_locale { - self = [super init]; - if(self) { - ASSIGN(self->locale, _locale); - [self setISODateFormat]; - } - return self; + if ((self = [super init])) { + self->locale = [_locale retain]; + [self setISODateFormat]; + } + return self; } - (void)dealloc { - [self->locale release]; - [super dealloc]; + [self->locale release]; + [super dealloc]; } +/* accessors */ + - (void)setISODateFormat { - self->formatAction = @selector(isoDateFormatForDate:); + self->formatAction = @selector(isoDateFormatForDate:); } - (void)setFullWeekdayNameAndDetails { - self->formatAction = @selector(fullWeekdayNameAndDetailsForDate:); + self->formatAction = @selector(fullWeekdayNameAndDetailsForDate:); } +/* operation */ + - (NSString *)stringForObjectValue:(id)_obj { - return [self performSelector:self->formatAction - withObject:_obj]; + return [self performSelector:self->formatAction + withObject:_obj]; } - /* Helpers */ - (NSString *)shortDayOfWeek:(int)_day { - return [[self->locale objectForKey:@"NSShortWeekDayNameArray"] - objectAtIndex:_day]; + return [[self->locale objectForKey:@"NSShortWeekDayNameArray"] + objectAtIndex:_day]; } - (NSString *)fullDayOfWeek:(int)_day { - return [[self->locale objectForKey:@"NSWeekDayNameArray"] - objectAtIndex:_day]; + return [[self->locale objectForKey:@"NSWeekDayNameArray"] + objectAtIndex:_day]; } - (NSString *)shortMonthOfYear:(int)_month { - return [[self->locale objectForKey:@"NSShortMonthNameArray"] - objectAtIndex:_month - 1]; + return [[self->locale objectForKey:@"NSShortMonthNameArray"] + objectAtIndex:_month - 1]; } - (NSString *)fullMonthOfYear:(int)_month { - return [[self->locale objectForKey:@"NSMonthNameArray"] - objectAtIndex:_month - 1]; + return [[self->locale objectForKey:@"NSMonthNameArray"] + objectAtIndex:_month - 1]; } /* Private API */ - (NSString *)isoDateFormatForDate:(NSCalendarDate *)_date { - return [NSString stringWithFormat:@"%d-%02d-%02d", - [_date yearOfCommonEra], - [_date monthOfYear], - [_date dayOfMonth]]; + return [NSString stringWithFormat:@"%04d-%02d-%02d", + [_date yearOfCommonEra], + [_date monthOfYear], + [_date dayOfMonth]]; } - (NSString *)fullWeekdayNameAndDetailsForDate:(NSCalendarDate *)_date { - NSMutableString *desc; - - desc = [[NSMutableString alloc] init]; - [desc appendString:[self fullDayOfWeek:[_date dayOfWeek]]]; - [desc appendString:@", "]; - [desc appendString:[self isoDateFormatForDate:_date]]; - [desc appendString:@" "]; - [desc appendFormat:@"%02d:%02d ", - [_date hourOfDay], - [_date minuteOfHour]]; - [desc appendString:[[_date timeZone] name]]; - return [desc autorelease]; + NSMutableString *desc; + + desc = [NSMutableString stringWithCapacity:24]; + [desc appendString:[self fullDayOfWeek:[_date dayOfWeek]]]; + [desc appendString:@", "]; + [desc appendString:[self isoDateFormatForDate:_date]]; + [desc appendString:@" "]; + [desc appendFormat:@"%02d:%02d ", [_date hourOfDay], [_date minuteOfHour]]; + [desc appendString:[[_date timeZone] abbreviation]]; + return desc; } -@end +@end /* SOGoDateFormatter */ diff --git a/SOGo/UI/SOGoUI/UIxComponent.m b/SOGo/UI/SOGoUI/UIxComponent.m index 8d60b810..d9b6abff 100644 --- a/SOGo/UI/SOGoUI/UIxComponent.m +++ b/SOGo/UI/SOGoUI/UIxComponent.m @@ -22,9 +22,8 @@ #include "UIxComponent.h" -#include -#include -#include +#include "common.h" +#include @interface UIxComponent (PrivateAPI) @@ -282,7 +281,7 @@ static BOOL uixDebugEnabled = NO; ctx = [self context]; return [[[self clientObject] authenticatorInContext:ctx] - userInContext:ctx]; + userInContext:ctx]; } - (NSString *)shortUserNameForDisplay { diff --git a/SOGo/UI/SOGoUI/Version b/SOGo/UI/SOGoUI/Version index 317960a7..c351558f 100644 --- a/SOGo/UI/SOGoUI/Version +++ b/SOGo/UI/SOGoUI/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=10 +SUBMINOR_VERSION:=11 diff --git a/SOGo/UI/SOGoUI/common.h b/SOGo/UI/SOGoUI/common.h new file mode 100644 index 00000000..4a433df2 --- /dev/null +++ b/SOGo/UI/SOGoUI/common.h @@ -0,0 +1,26 @@ +/* + 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. +*/ + +#import +#include + +#include +#include -- 2.39.5