]> err.no Git - scalable-opengroupware.org/blob - SOPE/NGCards/iCalToDo.m
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1178 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / SOPE / NGCards / iCalToDo.m
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #import <Foundation/NSString.h>
23
24 #import "NSCalendarDate+NGCards.h"
25
26 #import "iCalDateTime.h"
27 #import "iCalToDo.h"
28
29 @implementation iCalToDo
30
31 - (Class) classForTag: (NSString *) classTag
32 {
33   Class tagClass;
34
35   if ([classTag isEqualToString: @"DUE"]
36       || [classTag isEqualToString: @"COMPLETED"])
37     tagClass = [iCalDateTime class];
38   else if ([classTag isEqualToString: @"PERCENT-COMPLETE"])
39     tagClass = [CardElement class];
40   else
41     tagClass = [super classForTag: classTag];
42
43   return tagClass;
44 }
45
46 /* accessors */
47
48 - (void) setPercentComplete: (NSString *) _value
49 {
50   [[self uniqueChildWithTag: @"percent-complete"] setValue: 0
51                                                   to: _value];
52 }
53
54 - (NSString *) percentComplete
55 {
56   return [[self uniqueChildWithTag: @"percent-complete"] value: 0];
57 }
58
59 - (void) setDue: (NSCalendarDate *) newDueDate
60 {
61   [(iCalDateTime *) [self uniqueChildWithTag: @"due"]
62                     setDateTime: newDueDate];
63 }
64
65 - (NSCalendarDate *) due
66 {
67   return [(iCalDateTime *) [self uniqueChildWithTag: @"due"]
68                            dateTime];
69 }
70
71 - (void) setCompleted: (NSCalendarDate *) newCompletedDate
72 {
73   [(iCalDateTime *) [self uniqueChildWithTag: @"completed"]
74                     setDate: newCompletedDate];
75   [self setStatus: @"COMPLETED"];
76 }
77
78 - (NSCalendarDate *) completed
79 {
80   return [(iCalDateTime *) [self uniqueChildWithTag: @"completed"]
81                            dateTime];
82 }
83
84 /* ical typing */
85
86 - (NSString *) entityName
87 {
88   return @"vtodo";
89 }
90
91 // /* descriptions */
92
93 // - (NSString *)description {
94 //   NSMutableString *ms;
95
96 //   ms = [NSMutableString stringWithCapacity:128];
97 //   [ms appendFormat:@"<0x%p[%@]:", self, NSStringFromClass([self class])];
98
99 //   if (uid)       [ms appendFormat:@" uid=%@", uid];
100 //   if (startDate) [ms appendFormat:@" start=%@", startDate];
101 //   if (due)       [ms appendFormat:@" due=%@", due];
102 //   if (priority)  [ms appendFormat:@" pri=%@", priority];
103
104 //   if (completed) 
105 //     [ms appendFormat:@" completed=%@", completed];
106 //   if (percentComplete) 
107 //     [ms appendFormat:@" complete=%@", percentComplete];
108 //   if (accessClass) 
109 //     [ms appendFormat:@" class=%@", accessClass];
110   
111 //   if (summary)
112 //     [ms appendFormat:@" summary=%@", summary];
113
114 //   [ms appendString:@">"];
115 //   return ms;
116 // }
117
118 @end /* iCalToDo */