From: znek Date: Wed, 6 Oct 2004 10:53:34 +0000 (+0000) Subject: priority and categories for events X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4090c7a1745ca3798264ec71d8fa9867c727da9;p=scalable-opengroupware.org priority and categories for events git-svn-id: http://svn.opengroupware.org/SOGo/trunk@365 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SOGo.xcode/project.pbxproj b/SOGo/SOGo.xcode/project.pbxproj index d48109fb..5b56d6cd 100644 --- a/SOGo/SOGo.xcode/project.pbxproj +++ b/SOGo/SOGo.xcode/project.pbxproj @@ -1097,6 +1097,22 @@ refType = 4; sourceTree = ""; }; + ADA63205071330AE0058C21C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = "SOGoAppointment+UIx.h"; + refType = 4; + sourceTree = ""; + }; + ADA63206071330AE0058C21C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.objc; + path = "SOGoAppointment+UIx.m"; + refType = 4; + sourceTree = ""; + }; ADCDE53106ADA8AC00BFCE2B = { fileEncoding = 5; indentWidth = 8; @@ -3616,6 +3632,8 @@ AD73BE7E06CF90EA00226A2D, AD071B3C06CCFA2000A9EEF4, AD071B3D06CCFA2000A9EEF4, + ADA63205071330AE0058C21C, + ADA63206071330AE0058C21C, AD73BE6106CF8CC500226A2D, AD73BE6206CF8CC500226A2D, ); diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 1558699b..a7d13b0d 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,15 @@ +2004-10-05 Marcus Mueller + + * v0.9.84 + + * SOGoAppointment+UIx.[hm]: new class providing UIx convenience methods + + * UIxAppointmentView.[m|wox]: added priority and categories + + * UIxAppointmentEditor.[m|wox]: added priority and categories + + * English.lproj/default.strings: new labels + 2004-09-25 Helge Hess * UIxCalDateLabel.m: minor code cleanups, fixed compilation on MacOSX diff --git a/SOGo/UI/Scheduler/English.lproj/default.strings b/SOGo/UI/Scheduler/English.lproj/default.strings index 3645ee90..ecae51a9 100644 --- a/SOGo/UI/Scheduler/English.lproj/default.strings +++ b/SOGo/UI/Scheduler/English.lproj/default.strings @@ -97,6 +97,8 @@ "Name" = "Name"; "Email" = "Email"; "Location" = "Location"; +"Priority" = "Priority"; +"Categories" = "Categories"; "Duration" = "Duration"; "Participants" = "Participants"; "Resources" = "Resources"; @@ -120,3 +122,24 @@ "Chart" = "Chart"; "List" = "List"; "Columns" = "Columns"; + +/* Priorities */ + +"prio_0" = "Undefined"; +"prio_1" = "High"; +"prio_2" = "High"; +"prio_3" = "High"; +"prio_4" = "High"; +"prio_5" = "Normal"; +"prio_6" = "Low"; +"prio_7" = "Low"; +"prio_8" = "Low"; +"prio_9" = "Low"; + +/* Appointment categories */ + +"APPOINTMENT" = "Appointment"; +"NOT IN OFFICE" = "Outside"; +"MEETING" = "Meeting"; +"HOLIDAY" = "Holiday"; +"PHONE CALL" = "Phone"; diff --git a/SOGo/UI/Scheduler/GNUmakefile b/SOGo/UI/Scheduler/GNUmakefile index e4e1372a..796a4ca7 100644 --- a/SOGo/UI/Scheduler/GNUmakefile +++ b/SOGo/UI/Scheduler/GNUmakefile @@ -13,6 +13,7 @@ SchedulerUI_OBJC_FILES = \ UIxAppointmentFormatter.m \ iCalPerson+UIx.m \ NSCalendarDate+UIx.m \ + SOGoAppointment+UIx.m \ UIxComponent+Agenor.m \ \ UIxCalView.m \ diff --git a/SOGo/UI/Scheduler/SOGoAppointment+UIx.h b/SOGo/UI/Scheduler/SOGoAppointment+UIx.h new file mode 100644 index 00000000..d8792e72 --- /dev/null +++ b/SOGo/UI/Scheduler/SOGoAppointment+UIx.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2000-2004 SKYRIX Software AG + + This file is part of OGo + + 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$ + + +#ifndef __SOGoAppointment_UIx_H_ +#define __SOGoAppointment_UIx_H_ + + +#include + + +@interface SOGoAppointment (UIx) +- (NSString *)priorityLabelKey; +@end + +#endif /* __SOGoAppointment_UIx_H_ */ diff --git a/SOGo/UI/Scheduler/SOGoAppointment+UIx.m b/SOGo/UI/Scheduler/SOGoAppointment+UIx.m new file mode 100644 index 00000000..d0816ccd --- /dev/null +++ b/SOGo/UI/Scheduler/SOGoAppointment+UIx.m @@ -0,0 +1,47 @@ +/* + Copyright (C) 2000-2004 SKYRIX Software AG + + This file is part of OGo + + 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$ + + +#include "SOGoAppointment+UIx.h" +#include "common.h" + +@implementation SOGoAppointment (UIx) + +- (NSString *)priorityLabelKey { + NSString *prio; + + prio = [self priority]; + if(!prio) { + prio = @"0"; + } + else { + NSRange r; + + r = [prio rangeOfString:@";"]; + if(r.length > 0) { + prio = [prio substringToIndex:r.location]; + } + } + return [NSString stringWithFormat:@"prio_%@", prio]; +} + +@end diff --git a/SOGo/UI/Scheduler/UIxAppointmentEditor.m b/SOGo/UI/Scheduler/UIxAppointmentEditor.m index 016d2ebd..58ca1ff0 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentEditor.m +++ b/SOGo/UI/Scheduler/UIxAppointmentEditor.m @@ -42,6 +42,8 @@ NSString *comment; NSArray *participants; /* array of iCalPerson's */ NSArray *resources; /* array of iCalPerson's */ + NSString *priority; + NSArray *categories; } - (NSString *)iCalStringTemplate; @@ -85,6 +87,8 @@ [self->title release]; [self->location release]; [self->comment release]; + [self->priority release]; + [self->categories release]; [self->iCalString release]; [self->item release]; [super dealloc]; @@ -162,6 +166,66 @@ return self->resources; } +/* priorities */ + +- (NSArray *)priorities { + /* 0 == undefined + 5 == normal + 1 == high + */ + return [NSArray arrayWithObjects: + @"0", @"5", @"1", nil]; +} + +- (NSString *)itemPriorityText { + NSString *key; + + key = [NSString stringWithFormat:@"prio_%@", self->item]; + return [self labelForKey:key]; +} + +- (void)setPriority:(NSString *)_priority { + ASSIGN(self->priority, _priority); +} +- (NSString *)priority { + return self->priority; +} + + +/* categories */ + +- (NSArray *)categoryItems { + // TODO: make this configurable? + /* + Tasks categories will be modified as follow : + – by default (a simple logo or no logo at all), + – appointment, + – outside, + – meeting, + – holidays, + – phone. + */ + return [NSArray arrayWithObjects: + @"APPOINTMENT", + @"NOT IN OFFICE", + @"MEETING", + @"HOLIDAY", + @"PHONE CALL", + nil]; +} + +- (NSString *)itemCategoryText { + return [self labelForKey:self->item]; +} + +- (void)setCategories:(NSArray *)_categories { + ASSIGN(self->categories, _categories); +} +- (NSArray *)categories { + return self->categories; +} + + /* iCal */ - (void)setICalString:(NSString *)_s { @@ -173,7 +237,9 @@ - (NSString *)iCalStringTemplate { static NSString *iCalStringTemplate = \ - @"BEGIN:VCALENDAR\nMETHOD:REQUEST\nPRODID:OpenGroupware.org SOGo 0.9\n" + @"BEGIN:VCALENDAR\n" + @"METHOD:REQUEST\n" + @"PRODID:OpenGroupware.org SOGo 0.9\n" @"VERSION:2.0\n" @"BEGIN:VEVENT\n" @"UID:%@\n" @@ -184,6 +250,7 @@ @"DTEND:%@\n" @"TRANSP:OPAQUE\n" @"SEQUENCE:1\n" + @"PRIORITY:5\n" @"%@" @"END:VEVENT\n" @"END:VCALENDAR"; @@ -398,10 +465,11 @@ [self->startDate setTimeZone:[self viewTimeZone]]; [self->endDate setTimeZone:[self viewTimeZone]]; - self->title = [[_appointment summary] copy]; - self->location = [[_appointment location] copy]; - self->comment = [[_appointment comment] copy]; - + self->title = [[_appointment summary] copy]; + self->location = [[_appointment location] copy]; + self->comment = [[_appointment comment] copy]; + self->priority = [[_appointment priority] copy]; + self->categories = [[_appointment categories] retain]; self->participants = [[_appointment participants] retain]; self->resources = [[_appointment resources] retain]; } @@ -415,7 +483,10 @@ [_appointment setSummary:[self title]]; [_appointment setLocation:[self location]]; - + [_appointment setComment:[self comment]]; + [_appointment setPriority:[self priority]]; + [_appointment setCategories:[self categories]]; + attendees = [self participants]; lResources = [self resources]; if ([lResources count] > 0) { diff --git a/SOGo/UI/Scheduler/UIxAppointmentEditor.wox b/SOGo/UI/Scheduler/UIxAppointmentEditor.wox index 1a86a1bc..2797d6bf 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentEditor.wox +++ b/SOGo/UI/Scheduler/UIxAppointmentEditor.wox @@ -100,6 +100,38 @@ + + + + : + + + + + + + + + + + + : + + + + + + + + diff --git a/SOGo/UI/Scheduler/UIxAppointmentView.h b/SOGo/UI/Scheduler/UIxAppointmentView.h index cdb962fa..fda112b2 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentView.h +++ b/SOGo/UI/Scheduler/UIxAppointmentView.h @@ -13,6 +13,7 @@ id appointment; id attendee; SOGoDateFormatter *dateFormatter; + id item; } - (id)appointment; diff --git a/SOGo/UI/Scheduler/UIxAppointmentView.m b/SOGo/UI/Scheduler/UIxAppointmentView.m index c99cfce9..e228b3e8 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentView.m +++ b/SOGo/UI/Scheduler/UIxAppointmentView.m @@ -10,9 +10,10 @@ @implementation UIxAppointmentView - (void)dealloc { - [self->appointment release]; - [self->attendee release]; + [self->appointment release]; + [self->attendee release]; [self->dateFormatter release]; + [self->item release]; [super dealloc]; } @@ -34,6 +35,13 @@ return self->attendee; } +- (void)setItem:(id)_item { + ASSIGN(self->item, _item); +} +- (id)item { + return self->item; +} + - (SOGoDateFormatter *)dateFormatter { if (self->dateFormatter == nil) { self->dateFormatter = diff --git a/SOGo/UI/Scheduler/UIxAppointmentView.wox b/SOGo/UI/Scheduler/UIxAppointmentView.wox index f07ba56e..de15933b 100644 --- a/SOGo/UI/Scheduler/UIxAppointmentView.wox +++ b/SOGo/UI/Scheduler/UIxAppointmentView.wox @@ -86,6 +86,14 @@ + + + : + + + + + @@ -129,6 +137,21 @@ /> + + + : + + + + + + + + + * v0.9.12 + + * SOGoAppointment.[hm]: added priority and categories, also fixed bug + in setComment:. Introduced hasComment to simplify handling. + + * SOGoAppointmentICalRenderer.m: correctly render priority, categories + and comment. + 2004-09-25 Helge Hess * fixed compilation on MacOSX (v0.9.11) diff --git a/SOGoLogic/SOGoAppointment.h b/SOGoLogic/SOGoAppointment.h index 2ab0dbe0..8fcf8cfd 100644 --- a/SOGoLogic/SOGoAppointment.h +++ b/SOGoLogic/SOGoAppointment.h @@ -34,12 +34,12 @@ */ @class NSString, NSArray, NSCalendarDate; -@class iCalPerson; +@class iCalPerson, iCalEvent; @interface SOGoAppointment : NSObject { id calendar; - id event; + iCalEvent *event; id participants; } @@ -57,6 +57,15 @@ - (void)setComment:(NSString *)_value; - (NSString *)comment; +- (BOOL)hasComment; + +- (void)setPriority:(NSString *)_value; +- (NSString *)priority; +- (BOOL)hasPriority; + +- (void)setCategories:(NSArray *)_value; +- (NSArray *)categories; +- (BOOL)hasCategories; - (void)setStatus:(NSString *)_value; - (NSString *)status; diff --git a/SOGoLogic/SOGoAppointment.m b/SOGoLogic/SOGoAppointment.m index 6785ea52..15f3db7a 100644 --- a/SOGoLogic/SOGoAppointment.m +++ b/SOGoLogic/SOGoAppointment.m @@ -155,17 +155,77 @@ static SaxObjectDecoder *sax = nil; } - (void)setComment:(NSString *)_value { + if([_value length] == 0) + _value = nil; [self->event setComment:_value]; } - (NSString *)comment { return [self->event comment]; } +- (BOOL)hasComment { + NSString *s = [self comment]; + if(!s || [s length] == 0) + return NO; + return YES; +} + +- (void)setPriority:(NSString *)_value { + [self->event setPriority:_value]; +} +- (NSString *)priority { + return [self->event priority]; +} +- (BOOL)hasPriority { + NSString *prio = [self priority]; + NSRange r; + + if(!prio) + return NO; + + r = [prio rangeOfString:@";"]; + if(r.length > 0) { + prio = [prio substringToIndex:r.location]; + } + return [prio isEqualToString:@"0"] ? NO : YES; +} + +- (void)setCategories:(NSArray *)_value { + NSString *catString; + + if(!_value || [_value count] == 0) { + [self->event setCategories:nil]; + return; + } + _value = [_value sortedArrayUsingSelector:@selector(compareAscending:)]; + catString = [_value componentsJoinedByString:@","]; + [self->event setCategories:catString]; + [catString release]; +} +- (NSArray *)categories { + NSString *catString; + NSArray *cats; + NSRange r; + + catString = [self->event categories]; + if(!catString) { + return [NSArray array]; + } + r = [catString rangeOfString:@";"]; + if(r.length > 0) { + catString = [catString substringToIndex:r.location]; + } + cats = [catString componentsSeparatedByString:@","]; + return cats; +} +- (BOOL)hasCategories { + return [self->event categories] != nil ? YES : NO; +} - (void)setStatus:(NSString *)_value { [self->event setStatus:_value]; } - (NSString *)status { - return [(iCalEvent *)self->event status]; + return [self->event status]; } - (void)setStartDate:(NSCalendarDate *)_date { diff --git a/SOGoLogic/SOGoAppointmentICalRenderer.m b/SOGoLogic/SOGoAppointmentICalRenderer.m index 079359bd..b33c269f 100644 --- a/SOGoLogic/SOGoAppointmentICalRenderer.m +++ b/SOGoLogic/SOGoAppointmentICalRenderer.m @@ -147,10 +147,29 @@ static SOGoAppointmentICalRenderer *renderer = nil; [s appendString:[event duration]]; [s appendString:@"\n"]; } - + if([_apt hasPriority]) { + [s appendString:@"PRIORITY:"]; + [s appendString:[_apt priority]]; + [s appendString:@"\n"]; + } + if([_apt hasCategories]) { + NSString *catString; + + catString = [[_apt categories] componentsJoinedByString:@","]; + [s appendString:@"CATEGORIES:"]; + [s appendString:catString]; + [s appendString:@"\n"]; + } + if([_apt hasComment]) { + [s appendString:@"COMMENT:"]; + [s appendString:[_apt comment]]; + [s appendString:@"\n"]; + } + [s appendString:@"STATUS:"]; [s appendString:[_apt status]]; [s appendString:@"\n"]; + /* what's all this? */ [s appendString:@"TRANSP:OPAQUE\n"]; /* transparency */ diff --git a/SOGoLogic/Version b/SOGoLogic/Version index c351558f..9cef7993 100644 --- a/SOGoLogic/Version +++ b/SOGoLogic/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=11 +SUBMINOR_VERSION:=12