Codebase list agenda.app / e06e995
Imported Upstream version 0.42.2 Yavor Doganov 12 years ago
86 changed file(s) with 2418 addition(s) and 1120 deletion(s). Raw diff Collapse all Expand all
2525
2626 + (NSString *)storeName
2727 {
28 return _(@"my address book");
28 return _(@"My address book");
2929 }
3030
3131 + (NSString *)storeTypeName
0 /* emacs buffer mode hint -*- objc -*- */
1
2 #import <Foundation/Foundation.h>
3 #import "config.h"
4
5 @class Date;
6 @class Element;
7
8 @interface Alarm : NSObject <NSCoding>
9 {
10 icalcomponent *_ic;
11 Element *_element;
12 }
13
14 + (id)alarm;
15 - (NSAttributedString *)desc;
16 - (void)setDesc:(NSAttributedString *)desc;
17 - (NSString *)summary;
18 - (void)setSummary:(NSString *)summary;
19 - (BOOL)isAbsoluteTrigger;
20 - (Date *)absoluteTrigger;
21 - (void)setAbsoluteTrigger:(Date *)trigger;
22 - (NSTimeInterval)relativeTrigger;
23 - (void)setRelativeTrigger:(NSTimeInterval)trigger;
24 - (enum icalproperty_action)action;
25 - (void)setAction:(enum icalproperty_action)action;
26 - (NSString *)emailAddress;
27 - (void)setEmailAddress:(NSString *)emailAddress;
28 - (NSString *)sound;
29 - (void)setSound:(NSString *)sound;
30 - (NSURL *)url;
31 - (void)setUrl:(NSURL *)url;
32 - (int)repeatCount;
33 - (void)setRepeatCount:(int)count;
34 - (NSTimeInterval)repeatInterval;
35 - (void)setRepeatInterval:(NSTimeInterval)interval;
36 - (Element *)element;
37 - (void)setElement:(Element *)element;
38 - (Date *)triggerDateRelativeTo:(Date *)date;
39 - (NSString *)shortDescription;
40
41 - (id)initWithICalComponent:(icalcomponent *)ic;
42 - (icalcomponent *)asICalComponent;
43 - (int)iCalComponentType;
44 @end
0 /* emacs buffer mode hint -*- objc -*- */
1
2 #import "Alarm.h"
3 #import "Date.h"
4 #import "Element.h"
5 #import "HourFormatter.h"
6
7 @implementation Alarm
8 - (void)deleteProperty:(icalproperty_kind)kind fromComponent:(icalcomponent *)ic
9 {
10 icalproperty *prop = icalcomponent_get_first_property(ic, kind);
11 if (prop)
12 icalcomponent_remove_property(ic, prop);
13 }
14
15 - (void)encodeWithCoder:(NSCoder *)coder
16 {
17 [coder encodeObject:[NSString stringWithCString:icalcomponent_as_ical_string(_ic)] forKey:@"alarmComponent"];
18 }
19
20 - (id)initWithCoder:(NSCoder *)coder
21 {
22 _ic = icalcomponent_new_from_string([[coder decodeObjectForKey:@"alarmComponent"] cString]);
23 return self;
24 }
25
26 - (void)dealloc
27 {
28 icalcomponent_free(_ic);
29 [super dealloc];
30 }
31
32 - (id)init
33 {
34 self = [super init];
35 if (self) {
36 _element = nil;
37 _ic = icalcomponent_new([self iCalComponentType]);
38 if (!_ic) {
39 NSLog(@"Error while creating an VALARM component");
40 DESTROY(self);
41 }
42 }
43 return self;
44 }
45
46 + (id)alarm
47 {
48 return AUTORELEASE([[Alarm alloc] init]);
49 }
50
51 - (NSAttributedString *)desc
52 {
53 icalproperty *prop = icalcomponent_get_first_property(_ic, ICAL_DESCRIPTION_PROPERTY);
54 if (prop)
55 return AUTORELEASE([[NSAttributedString alloc] initWithString:[NSString stringWithUTF8String:icalproperty_get_description(prop)]]);
56 return nil;
57 }
58
59 - (void)setDesc:(NSAttributedString *)desc
60 {
61 [self deleteProperty:ICAL_DESCRIPTION_PROPERTY fromComponent:_ic];
62 if (desc)
63 icalcomponent_add_property(_ic, icalproperty_new_description([[desc string] UTF8String]));
64 }
65
66 - (NSString *)summary
67 {
68 icalproperty *prop = icalcomponent_get_first_property(_ic, ICAL_SUMMARY_PROPERTY);
69 if (!prop) {
70 NSLog(@"Error : no summary property");
71 return nil;
72 }
73 return [NSString stringWithUTF8String:icalproperty_get_summary(prop)];
74 }
75
76 - (void)setSummary:(NSString *)summary
77 {
78 [self deleteProperty:ICAL_SUMMARY_PROPERTY fromComponent:_ic];
79 if (summary)
80 icalcomponent_add_property(_ic, icalproperty_new_summary([summary UTF8String]));
81 }
82
83 - (BOOL)isAbsoluteTrigger
84 {
85 struct icaltriggertype trigger;
86 icalproperty *prop = icalcomponent_get_first_property(_ic, ICAL_TRIGGER_PROPERTY);
87
88 if (!prop) {
89 NSLog(@"Error : no trigger property");
90 return NO;
91 }
92 trigger = icalproperty_get_trigger(prop);
93 if (icaltime_is_null_time(trigger.time))
94 return NO;
95 return YES;
96 }
97
98 - (Date *)absoluteTrigger
99 {
100 struct icaltriggertype trigger;
101 icalproperty *prop = icalcomponent_get_first_property(_ic, ICAL_TRIGGER_PROPERTY);
102
103 if (!prop) {
104 NSLog(@"Error : no trigger property");
105 return nil;
106 }
107 trigger = icalproperty_get_trigger(prop);
108 return AUTORELEASE([[Date alloc] initWithICalTime:trigger.time]);
109 }
110
111 - (void)setAbsoluteTrigger:(Date *)date
112 {
113 struct icaltriggertype trigger;
114
115 [self deleteProperty:ICAL_TRIGGER_PROPERTY fromComponent:_ic];
116 memset(&trigger, 0, sizeof(trigger));
117 trigger.time = [date UTCICalTime];
118 icalcomponent_add_property(_ic, icalproperty_new_trigger(trigger));
119 }
120
121 - (NSTimeInterval)relativeTrigger
122 {
123 struct icaltriggertype trigger;
124 icalproperty *prop = icalcomponent_get_first_property(_ic, ICAL_TRIGGER_PROPERTY);
125
126 if (!prop) {
127 NSLog(@"Error : no trigger property");
128 return -1;
129 }
130 trigger = icalproperty_get_trigger(prop);
131 return icaldurationtype_as_int(trigger.duration);
132 }
133
134 - (void)setRelativeTrigger:(NSTimeInterval)duration
135 {
136 struct icaltriggertype trigger;
137
138 [self deleteProperty:ICAL_TRIGGER_PROPERTY fromComponent:_ic];
139 memset(&trigger, 0, sizeof(trigger));
140 trigger.duration = icaldurationtype_from_int(duration);
141 icalcomponent_add_property(_ic, icalproperty_new_trigger(trigger));
142 }
143
144 - (enum icalproperty_action)action
145 {
146 icalproperty *prop = icalcomponent_get_first_property(_ic, ICAL_ACTION_PROPERTY);
147
148 if (!prop) {
149 NSLog(@"Error : no ACTION property");
150 return -1;
151 }
152 return icalproperty_get_action(prop);
153 }
154
155 - (void)setAction:(enum icalproperty_action)action
156 {
157 [self deleteProperty:ICAL_ACTION_PROPERTY fromComponent:_ic];
158 icalcomponent_add_property(_ic, icalproperty_new_action(action));
159 }
160
161 - (NSString *)emailAddress
162 {
163 icalproperty *prop = icalcomponent_get_first_property(_ic, ICAL_ATTENDEE_PROPERTY);
164
165 if (prop)
166 return [NSString stringWithUTF8String:icalproperty_get_attendee(prop)];
167 return nil;
168 }
169
170 - (void)setEmailAddress:(NSString *)emailAddress
171 {
172 [self deleteProperty:ICAL_ATTENDEE_PROPERTY fromComponent:_ic];
173 if (emailAddress) {
174 icalcomponent_add_property(_ic, icalproperty_new_attendee([emailAddress UTF8String]));
175 [self setAction:ICAL_ACTION_EMAIL];
176 }
177 }
178
179 - (NSString *)sound
180 {
181 /* FIXME */
182 return nil;
183 }
184
185 - (void)setSound:(NSString *)sound
186 {
187 /* FIXME */
188 if (sound) {
189 [self setAction:ICAL_ACTION_AUDIO];
190 }
191 }
192
193 - (NSURL *)url
194 {
195 /* FIXME */
196 return nil;
197 }
198
199 - (void)setUrl:(NSURL *)url
200 {
201 /* FIXME */
202 if (url) {
203 [self setAction:ICAL_ACTION_PROCEDURE];
204 }
205 }
206
207 - (int)repeatCount
208 {
209 icalproperty *prop = icalcomponent_get_first_property(_ic, ICAL_REPEAT_PROPERTY);
210
211 if (prop)
212 return icalproperty_get_repeat(prop);
213 return 0;
214 }
215
216 - (void)setRepeatCount:(int)count
217 {
218 [self deleteProperty:ICAL_REPEAT_PROPERTY fromComponent:_ic];
219 if (count > 0)
220 icalcomponent_add_property(_ic, icalproperty_new_repeat(count));
221 }
222
223 - (NSTimeInterval)repeatInterval
224 {
225 icalproperty *prop = icalcomponent_get_first_property(_ic, ICAL_DURATION_PROPERTY);
226
227 if (prop)
228 return icaldurationtype_as_int(icalproperty_get_duration(prop));
229 return 0;
230 }
231
232 - (void)setRepeatInterval:(NSTimeInterval)interval
233 {
234 [self deleteProperty:ICAL_DURATION_PROPERTY fromComponent:_ic];
235 if (interval > 0)
236 icalcomponent_add_property(_ic, icalproperty_new_duration(icaldurationtype_from_int(interval)));
237 }
238
239 - (Element *)element
240 {
241 return _element;
242 }
243
244 - (void)setElement:(Element *)element
245 {
246 _element = element;
247 NSDebugLog(@"Added %@ to element %@", [self description], [element UID]);
248 }
249
250 - (Date *)triggerDateRelativeTo:(Date *)date
251 {
252 return [Date dateWithTimeInterval:[self relativeTrigger] sinceDate:date];
253 }
254
255 - (NSString *)description
256 {
257 if ([self isAbsoluteTrigger])
258 return [NSString stringWithFormat:@"Absolute trigger set to %@ repeat %d interval %f description <%@>", [[self absoluteTrigger] description], [self repeatCount], [self repeatInterval], [self desc]];
259 return [NSString stringWithFormat:@"Relative trigger delay %f repeat %d interval %f description <%@>", [self relativeTrigger], [self repeatCount], [self repeatInterval], [self desc]];
260 }
261
262 - (NSString *)shortDescription
263 {
264 NSTimeInterval trigger;
265
266 if ([self isAbsoluteTrigger])
267 return [NSString stringWithFormat:_(@"Trigger on %@"), [[[self absoluteTrigger] calendarDate] descriptionWithCalendarFormat:[[NSUserDefaults standardUserDefaults] objectForKey:NSShortTimeDateFormatString]]];
268 trigger = [self relativeTrigger];
269 if (trigger >= 0)
270 return [NSString stringWithFormat:_(@"Trigger %@ after the event"), [HourFormatter stringForObjectValue:[NSNumber numberWithInt:trigger]]];
271 return [NSString stringWithFormat:_(@"Trigger %@ before the event"), [HourFormatter stringForObjectValue:[NSNumber numberWithInt:-trigger]]];
272 }
273
274 - (id)copyWithZone:(NSZone *)zone
275 {
276 return [[Alarm allocWithZone:zone] initWithICalComponent:[self asICalComponent]];
277 }
278
279
280 - (id)initWithICalComponent:(icalcomponent *)ic
281 {
282 if ((self = [super init])) {
283 _element = nil;
284 _ic = icalcomponent_new_clone(ic);
285 if (!_ic) {
286 NSLog(@"Error creating Alarm from iCal component");
287 NSLog(@"\n\n%s", icalcomponent_as_ical_string(ic));
288 DESTROY(self);
289 }
290 }
291 return self;
292 }
293
294 - (icalcomponent *)asICalComponent
295 {
296 return icalcomponent_new_clone(_ic);
297 }
298
299 - (int)iCalComponentType
300 {
301 return ICAL_VALARM_COMPONENT;
302 }
303 @end
0 /* emacs buffer mode hint -*- objc -*- */
1
2 #import "Alarm.h"
3
4 @interface AlarmBackend : NSObject
5 + (NSString *)backendName;
6 - (enum icalproperty_action)backendType;
7 - (void)display:(Alarm *)alarm;
8 @end
11
22 #import <Foundation/Foundation.h>
33
4 @class Element;
5 @class Alarm;
6
47 @interface AlarmEditor : NSObject
58 {
9 id window;
610 id panel;
7 id calendar;
811 id type;
912 id action;
13 id table;
14 id add;
15 id remove;
16 id relativeSlider;
17 id relativeText;
18 id radio;
19 id date;
20 id time;
21 NSMutableArray *_alarms;
22 Alarm *_current;
23 Alarm *_simple;
1024 }
1125
12 - (void)show;
26 + (NSArray *)editAlarms:(NSArray *)alarms;
27 - (void)addAlarm:(id)sender;
28 - (void)removeAlarm:(id)sender;
29 - (void)changeDelay:(id)sender;
30 - (void)selectType:(id)sender;
31 - (void)switchBeforeAfter:(id)sender;
1332 @end
00 #import <AppKit/AppKit.h>
11 #import "AlarmEditor.h"
2 #import "Element.h"
3 #import "Alarm.h"
4 #import "HourFormatter.h"
25
36 @implementation AlarmEditor
7 - (void)setupForSelection
8 {
9 NSTimeInterval relativeTrigger;
10 Date *d;
11
12 if ([_alarms count] == 0) {
13 [action setEnabled:NO];
14 [type setEnabled:NO];
15 [relativeSlider setEnabled:NO];
16 [radio setEnabled:NO];
17 [date setEnabled:NO];
18 [time setEnabled:NO];
19 [date setObjectValue:nil];
20 [date setObjectValue:nil];
21 [remove setEnabled:NO];
22 _current = nil;
23 return;
24 }
25 [action setEnabled:YES];
26 [type setEnabled:YES];
27 [remove setEnabled:YES];
28 _current = [_alarms objectAtIndex:[table selectedRow]];
29 if ([_current isAbsoluteTrigger]) {
30 [relativeSlider setEnabled:NO];
31 [radio setEnabled:NO];
32 [date setEnabled:YES];
33 [time setEnabled:YES];
34 d = [_current absoluteTrigger];
35 [date setObjectValue:[d calendarDate]];
36 [time setIntValue:[d hourOfDay] * 3600 + [d minuteOfHour] * 60];
37 [type selectItemAtIndex:1];
38 } else {
39 [relativeSlider setEnabled:YES];
40 [radio setEnabled:YES];
41 [date setEnabled:NO];
42 [time setEnabled:NO];
43 [date setObjectValue:nil];
44 [date setObjectValue:nil];
45 [type selectItemAtIndex:0];
46 relativeTrigger = [_current relativeTrigger];
47 if (relativeTrigger >= 0) {
48 [radio selectCellWithTag:1];
49 [relativeSlider setFloatValue:relativeTrigger];
50 } else {
51 [radio selectCellWithTag:0];
52 [relativeSlider setFloatValue:-relativeTrigger];
53 }
54 [relativeText setFloatValue:[relativeSlider floatValue]];
55 }
56 }
57
458 - (id)init
559 {
6 self = [super init];
7 if (self) {
8 if (![NSBundle loadNibNamed:@"Alarm" owner:self]) {
9 [self release];
10 return nil;
11 }
60 HourFormatter *formatter;
61 NSDateFormatter *dateFormatter;
62
63 if (![NSBundle loadNibNamed:@"Alarm" owner:self])
64 return nil;
65 if ((self = [super init])) {
66 _current = nil;
67 _simple = RETAIN([Alarm alarm]);
68 [_simple setRelativeTrigger:-15*60];
69 [_simple setAction:ICAL_ACTION_DISPLAY];
70
71 [table setDelegate:self];
72
73 [type removeAllItems];
74 [type addItemsWithTitles:[NSArray arrayWithObjects:_(@"Relative"), _(@"Absolute"), nil]];
75 [action removeAllItems];
76 [action addItemsWithTitles:[NSArray arrayWithObjects:_(@"Display"), _(@"Sound"), _(@"Email"), _(@"Procedure"), nil]];
77
78 [table setUsesAlternatingRowBackgroundColors:YES];
79 [table sizeLastColumnToFit];
80
81 formatter = AUTORELEASE([[HourFormatter alloc] init]);
82 dateFormatter = AUTORELEASE([[NSDateFormatter alloc] initWithDateFormat:[[NSUserDefaults standardUserDefaults] objectForKey:NSShortDateFormatString] allowNaturalLanguage:NO]);
83 [[relativeText cell] setFormatter:formatter];
84 [time setFormatter:formatter];
85 [date setFormatter:dateFormatter];
1286 }
1387 return self;
1488 }
1589
16 - (void)show
17 {
18 [NSApp runModalForWindow:panel];
90 - (id)initWithAlarms:(NSArray *)alarms
91 {
92 if ((self = [self init])) {
93 _alarms = [[NSMutableArray alloc] initWithArray:alarms copyItems:YES];
94 [table reloadData];
95 [self setupForSelection];
96 }
97 return self;
98 }
99
100 - (NSArray *)run
101 {
102 [NSApp runModalForWindow:window];
103 return [NSArray arrayWithArray:_alarms];
104 }
105
106 + (NSArray *)editAlarms:(NSArray *)alarms
107 {
108 AlarmEditor *editor;
109 NSArray *modified;
110
111 if ((editor = [[AlarmEditor alloc] initWithAlarms:alarms])) {
112 modified = [editor run];
113 [editor release];
114 return modified;
115 }
116 return nil;
117 }
118
119 - (void)dealloc
120 {
121 DESTROY(_simple);
122 DESTROY(_alarms);
123 [super dealloc];
124 }
125
126 - (void)addAlarm:(id)sender
127 {
128 [_alarms addObject:AUTORELEASE([_simple copy])];
129 [table reloadData];
130 [table selectRow:[_alarms count]-1 byExtendingSelection:NO];
131 }
132
133 - (void)removeAlarm:(id)sender
134 {
135 [_alarms removeObjectAtIndex:[table selectedRow]];
136 [table reloadData];
137 [self tableViewSelectionDidChange:nil];
138 }
139
140 - (void)selectType:(id)sender
141 {
142 Date *d;
143
144 if ([type indexOfSelectedItem] == 1) {
145 d = [Date now];
146 [d changeDayBy:7];
147 [date setObjectValue:[d calendarDate]];
148 [time setFloatValue:([d hourOfDay]*60 + [d minuteOfHour]) / 60.0];
149 [_current setAbsoluteTrigger:d];
150 [table reloadData];
151 } else {
152 [self changeDelay:nil];
153 }
154 [self setupForSelection];
155 }
156
157 - (void)changeDelay:(id)sender
158 {
159 [relativeText setIntValue:[relativeSlider intValue]];
160 if ([[radio selectedCell] tag] == 0)
161 [_current setRelativeTrigger:-[relativeSlider intValue]];
162 else
163 [_current setRelativeTrigger:[relativeSlider intValue]];
164 [table reloadData];
165 }
166
167 - (void)switchBeforeAfter:(id)sender
168 {
169 [self changeDelay:self];
170 }
171
172 - (void)tableViewSelectionDidChange:(NSNotification *)aNotification
173 {
174 [self setupForSelection];
175 }
176
177 - (void)controlTextDidEndEditing:(NSNotification *)aNotification
178 {
179 Date *d;
180
181 if (_current && [date objectValue] && [time objectValue]) {
182 d = [Date dateWithCalendarDate:[date objectValue] withTime:NO];
183 d = [Date dateWithTimeInterval:[time intValue] sinceDate:d];
184 [_current setAbsoluteTrigger:d];
185 [table reloadData];
186 }
19187 }
20188 @end
21189
190 @implementation AlarmEditor(NSTableViewDataSource)
191 - (int)numberOfRowsInTableView:(NSTableView *)aTableView
192 {
193 return [_alarms count];
194 }
195 - (BOOL)tableView:(NSTableView *)tableView acceptDrop:(id)info row:(int)row dropOperation:(NSTableViewDropOperation)operation
196 {
197 return NO;
198 }
199 - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
200 {
201 return [[_alarms objectAtIndex:rowIndex] shortDescription];
202 }
203 @end
22 #import <Foundation/NSObject.h>
33 #import "ConfigManager.h"
44
5 @interface AlarmManager : NSObject <ConfigListener>
5 extern NSString * const SAEventReminderWillRun;
6
7 @interface AlarmManager : NSObject
68 {
79 NSMutableDictionary *_activeAlarms;
8 BOOL _active;
10 id _defaultBackend;
911 }
1012
13 + (NSArray *)backends;
14 + (id)backendForName:(NSString *)name;
1115 + (AlarmManager *)globalManager;
16 - (id)defaultBackend;
17 - (NSString *)defaultBackendName;
18 - (void)setDefaultBackend:(NSString *)name;
19 - (BOOL)alarmsEnabled;
20 - (void)setAlarmsEnabled:(BOOL)value;
1221 @end
33 #import "ConfigManager.h"
44 #import "MemoryStore.h"
55 #import "Element.h"
6 #import "SAAlarm.h"
7 #import "defines.h"
8
6 #import "Alarm.h"
7 #import "AlarmBackend.h"
8
9 NSString * const ACTIVATE_ALARMS = @"activateAlarms";
10 NSString * const DEFAULT_ALARM_BACKEND = @"defaultAlarmBackend";
11
12 NSString * const SAEventReminderWillRun = @"SAEventReminderWillRun";
13
14 static NSMutableDictionary *backendsArray;
915 static AlarmManager *singleton;
1016
1117 @interface AlarmManager(Private)
18 + (void)addBackendClass:(Class)class;
1219 - (void)removeAlarms;
1320 - (void)createAlarms;
1421 @end
1522
1623 @implementation AlarmManager(Private)
17 - (void)runAlarm:(SAAlarm *)alarm
18 {
19 NSLog([alarm description]);
20 if ([alarm isAbsoluteTrigger]) {
21 } else {
22 }
23 }
24
25 - (void)addAlarm:(SAAlarm *)alarm forUID:(NSString *)uid
24 + (void)addBackendClass:(Class)class
25 {
26 id backend;
27
28 backend = [class new];
29 if (backend) {
30 [backendsArray setObject:backend forKey:[class backendName]];
31 [backend release];
32 NSLog(@"Alarm backend <%@> registered", [class backendName]);
33 }
34 }
35
36 - (void)runAlarm:(Alarm *)alarm
37 {
38 [[NSNotificationCenter defaultCenter] postNotificationName:SAEventReminderWillRun object:alarm];
39 if (_defaultBackend)
40 [_defaultBackend display:alarm];
41 }
42
43 - (void)addAlarm:(Alarm *)alarm forUID:(NSString *)uid
2644 {
2745 NSMutableArray *alarms = [_activeAlarms objectForKey:uid];
2846
3755 {
3856 NSMutableArray *alarms = [_activeAlarms objectForKey:uid];
3957 NSEnumerator *enumerator;
40 SAAlarm *alarm;
58 Alarm *alarm;
4159
4260 if (alarms) {
4361 enumerator = [alarms objectEnumerator];
4967 }
5068 }
5169
52 - (BOOL)addAbsoluteAlarm:(SAAlarm *)alarm
53 {
54 NSDate *date = [[alarm absoluteTrigger] calendarDate];
55
56 if ([date timeIntervalSinceNow] < 0)
70 - (BOOL)addAbsoluteAlarm:(Alarm *)alarm
71 {
72 NSTimeInterval delay;
73
74 delay = [[alarm absoluteTrigger] timeIntervalSinceNow];
75 if (delay < 0)
5776 return NO;
58 [self performSelector:@selector(absoluteTrigger:)
77 [self performSelector:@selector(runAlarm:)
5978 withObject:alarm
60 afterDelay:[date timeIntervalSinceNow]];
79 afterDelay:delay];
6180 return YES;
6281 }
6382
64 - (BOOL)addRelativeAlarm:(SAAlarm *)alarm
65 {
66 return NO;
83 - (BOOL)addRelativeAlarm:(Alarm *)alarm
84 {
85 Date *activation = [[alarm element] nextActivationDate];
86 NSTimeInterval delay;
87
88 if (!activation)
89 return NO;
90 if ([[Date now] compareTime:activation] == NSOrderedDescending)
91 return NO;
92 activation = [Date dateWithTimeInterval:[alarm relativeTrigger] sinceDate:activation];
93 delay = [activation timeIntervalSinceNow];
94 if (delay < 1 && delay > -600)
95 delay = 1;
96 if (delay < 0)
97 return NO;
98 [self performSelector:@selector(runAlarm:)
99 withObject:alarm
100 afterDelay:delay];
101 return YES;
67102 }
68103
69104 - (void)setAlarmsForElement:(Element *)element
70105 {
71106 NSEnumerator *enumAlarm;
72 SAAlarm *alarm;
107 Alarm *alarm;
73108 BOOL added;
74109
75110 if (![[element store] displayed] || ![element hasAlarms])
76111 return;
77112 enumAlarm = [[element alarms] objectEnumerator];
78113 while ((alarm = [enumAlarm nextObject])) {
114 NSAssert([alarm element] != nil, @"Alarm is not linked with an element");
79115 if ([alarm isAbsoluteTrigger])
80116 added = [self addAbsoluteAlarm:alarm];
81117 else
94130 [self setAlarmsForElement:element];
95131 }
96132
133 - (void)dataChanged:(NSNotification *)not
134 {
135 [self createAlarms];
136 }
137
97138 - (void)elementAdded:(NSNotification *)not
98139 {
99 if (_active) {
140 if ([self alarmsEnabled]) {
100141 MemoryStore *store = [not object];
101142 NSString *uid = [[not userInfo] objectForKey:@"UID"];
102143
103 NSLog(@"Add alarms for %@", uid);
104144 [self setAlarmsForElement:[store elementWithUID:uid]];
105145 }
106146 }
107147
108148 - (void)elementRemoved:(NSNotification *)not
109149 {
110 if (_active) {
111 NSString *uid = [[not userInfo] objectForKey:@"UID"];
112
113 NSLog(@"Remove alarms for %@", uid);
114 [self removeAlarmsforUID:uid];
115 }
150 if ([self alarmsEnabled])
151 [self removeAlarmsforUID:[[not userInfo] objectForKey:@"UID"]];
116152 }
117153
118154 - (void)elementUpdated:(NSNotification *)not
119155 {
120 if (_active) {
156 if ([self alarmsEnabled]) {
121157 MemoryStore *store = [not object];
122158 NSString *uid = [[not userInfo] objectForKey:@"UID"];
123159
124 NSLog(@"Update alarms for %@", uid);
125160 [self removeAlarmsforUID:uid];
126161 [self setAlarmsForElement:[store elementWithUID:uid]];
127162 }
129164
130165 - (NSDictionary *)defaults
131166 {
132 return [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:ALARMS];
133 }
134
167 return [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects: [NSNumber numberWithBool:NO], [AlarmBackend backendName], nil]
168 forKeys:[NSArray arrayWithObjects: ACTIVATE_ALARMS, DEFAULT_ALARM_BACKEND, nil]];
169 }
170
171 /* FIXME : what happens when a store is reloaded ? */
135172 - (id)init
136173 {
137174 NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
140177 self = [super init];
141178 if (self) {
142179 [cm registerDefaults:[self defaults]];
143 [cm registerClient:self forKey:ALARMS];
144 _active = [[cm objectForKey:ALARMS] boolValue];
180 [self setDefaultBackend:[cm objectForKey:DEFAULT_ALARM_BACKEND]];
181
145182 _activeAlarms = [[NSMutableDictionary alloc] initWithCapacity:32];
183 [nc addObserver:self
184 selector:@selector(dataChanged:)
185 name:SADataChangedInStore
186 object:nil];
146187 [nc addObserver:self
147188 selector:@selector(elementAdded:)
148189 name:SAElementAddedToStore
155196 selector:@selector(elementUpdated:)
156197 name:SAElementUpdatedInStore
157198 object:nil];
158 if (_active)
159 [self createAlarms];
160 /* FIXME : what happens when a store is reloaded ? */
199
200 [self createAlarms];
201 NSLog(@"Alarms are %@", [self alarmsEnabled] ? @"enabled" : @"disabled");
161202 }
162203 return self;
163204 }
165206 - (void)dealloc
166207 {
167208 [[NSNotificationCenter defaultCenter] removeObserver:self];
168 [[ConfigManager globalConfig] unregisterClient:self];
169209 RELEASE(_activeAlarms);
170210 [super dealloc];
171211 }
175215 StoreManager *sm = [StoreManager globalManager];
176216
177217 [self removeAlarms];
178 [self setAlarmsForElements:[sm allEvents]];
179 [self setAlarmsForElements:[sm allTasks]];
218 if ([self alarmsEnabled]) {
219 [self setAlarmsForElements:[sm allEvents]];
220 [self setAlarmsForElements:[sm allTasks]];
221 }
180222 }
181223
182224 - (void)removeAlarms
189231 @implementation AlarmManager
190232 + (void)initialize
191233 {
192 if ([AlarmManager class] == self)
234 NSArray *classes;
235 NSEnumerator *enumerator;
236 Class backendClass;
237
238 if ([AlarmManager class] == self) {
239 classes = GSObjCAllSubclassesOfClass([AlarmBackend class]);
240 backendsArray = [[NSMutableDictionary alloc] initWithCapacity:[classes count]+1];
241 enumerator = [classes objectEnumerator];
242 while ((backendClass = [enumerator nextObject]))
243 [self addBackendClass:backendClass];
244 [self addBackendClass:[AlarmBackend class]];
193245 singleton = [[AlarmManager alloc] init];
246 }
247 }
248
249 + (NSArray *)backends
250 {
251 return [backendsArray allValues];
252 }
253
254 + (id)backendForName:(NSString *)name
255 {
256 return [backendsArray objectForKey:name];
194257 }
195258
196259 + (AlarmManager *)globalManager
198261 return singleton;
199262 }
200263
201 - (void)config:(ConfigManager *)config dataDidChangedForKey:(NSString *)key
202 {
203 _active = [[config objectForKey:ALARMS] boolValue];
204 if (_active)
264 - (id)defaultBackend
265 {
266 return _defaultBackend;
267 }
268
269 - (NSString *)defaultBackendName
270 {
271 return [[_defaultBackend class] backendName];
272 }
273
274 - (void)setDefaultBackend:(NSString *)name
275 {
276 id bck = [AlarmManager backendForName:name];
277 if (bck != nil) {
278 _defaultBackend = bck;
279 [[ConfigManager globalConfig] setObject:name forKey:DEFAULT_ALARM_BACKEND];
280 NSLog(@"Default alarm backend is <%@>", name);
281 }
282 }
283
284 - (BOOL)alarmsEnabled
285 {
286 return [[[ConfigManager globalConfig] objectForKey:ACTIVATE_ALARMS] boolValue];
287 }
288
289 - (void)setAlarmsEnabled:(BOOL)value
290 {
291 if (value)
205292 [self createAlarms];
206293 else
207294 [self removeAlarms];
295 [[ConfigManager globalConfig] setInteger:value forKey:ACTIVATE_ALARMS];
296 NSLog(@"Alarms are %@", value ? @"enabled" : @"disabled");
208297 }
209298 @end
299
300
301 @implementation AlarmBackend
302 + (NSString *)backendName
303 {
304 return @"Log backend";
305 }
306 - (enum icalproperty_action)backendType
307 {
308 return ICAL_ACTION_DISPLAY;
309 }
310 - (void)display:(Alarm *)alarm
311 {
312 NSLog([alarm description]);
313 }
314 @end
1010 #import "SelectionManager.h"
1111 #import "ConfigManager.h"
1212
13 @interface AppController : NSObject <ConfigListener>
13 @interface AppController : NSObject
1414 {
1515 IBOutlet CalendarView *calendar;
1616 IBOutlet DayView *dayView;
2323
2424 PreferencesController *_pc;
2525 StoreManager *_sm;
26 SelectionManager *selectionManager;
26 SelectionManager *_selm;
2727 Date *_selectedDay;
2828 DataTree *_summaryRoot;
2929 DataTree *_today;
1010 #import "iCalTree.h"
1111 #import "SelectionManager.h"
1212 #import "AlarmManager.h"
13 #import "Alarm.h"
1314 #import "defines.h"
1415
15 @interface AppIcon : NSView
16 {
17 NSTimer *timer;
16 @interface AppIcon : NSView <ConfigListener>
17 {
18 ConfigManager *_cm;
19 NSDictionary *_attrs;
20 NSTimer *_timer;
21 BOOL _showDate;
22 BOOL _showTime;
23 NSImage *_bell;
1824 }
1925 @end
2026 @implementation AppIcon
27 - (void)setup
28 {
29 _showDate = [[_cm objectForKey:APPICON_DATE] boolValue];
30 _showTime = [[_cm objectForKey:APPICON_TIME] boolValue];
31 if (_showTime) {
32 if (_timer == nil)
33 _timer = [NSTimer scheduledTimerWithTimeInterval:1
34 target:self
35 selector:@selector(secondChanged:)
36 userInfo:nil
37 repeats:YES];
38 } else {
39 [_timer invalidate];
40 _timer = nil;
41 }
42 [self setNeedsDisplay:YES];
43 }
44 - (void)dealloc
45 {
46 [_cm unregisterClient:self];
47 [_attrs release];
48 [_timer invalidate];
49 [super dealloc];
50 }
51 - (id)initWithFrame:(NSRect)frame
52 {
53 self = [super initWithFrame:frame];
54 if (self) {
55 _attrs = [[NSDictionary alloc] initWithObjectsAndKeys:[NSFont systemFontOfSize:8],NSFontAttributeName,nil];
56 _bell = [NSImage imageNamed:@"bell"];
57 _cm = [ConfigManager globalConfig];
58 [_cm registerClient:self forKey:APPICON_DATE];
59 [_cm registerClient:self forKey:APPICON_TIME];
60 [self setup];
61 }
62 return self;
63 }
64 - (void)config:(ConfigManager *)config dataDidChangedForKey:(NSString *)key
65 {
66 [self setup];
67 }
2168 - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
2269 {
2370 return YES;
2875 }
2976 - (void)drawRect:(NSRect)rect
3077 {
31 ConfigManager *config = [ConfigManager globalConfig];
78 NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
3279 NSCalendarDate *now = [[Date now] calendarDate];
33 NSDictionary *attrs;
3480 NSString *aString;
3581
36 attrs = [NSMutableDictionary dictionaryWithObject:[NSFont systemFontOfSize: 8] forKey:NSFontAttributeName];
37 if ([[config objectForKey:APPICON_DATE] boolValue]) {
38 aString = [now descriptionWithCalendarFormat:[[NSUserDefaults standardUserDefaults] objectForKey:NSShortDateFormatString]];
39 [aString drawAtPoint:NSMakePoint(8, 3) withAttributes:attrs];
40 }
41 if ([[config objectForKey:APPICON_TIME] boolValue]) {
42 aString = [now descriptionWithCalendarFormat:[[NSUserDefaults standardUserDefaults] objectForKey:NSTimeFormatString]];
43 [aString drawAtPoint:NSMakePoint(11, 48) withAttributes:attrs];
44 if (timer == nil)
45 timer = [NSTimer scheduledTimerWithTimeInterval:1
46 target:self
47 selector:@selector(secondChanged:)
48 userInfo:nil
49 repeats:YES];
82 if (_showDate) {
83 aString = [now descriptionWithCalendarFormat:[def objectForKey:NSShortDateFormatString]];
84 [aString drawAtPoint:NSMakePoint(8, 3) withAttributes:_attrs];
85 }
86 if (_showTime) {
87 aString = [now descriptionWithCalendarFormat:[def objectForKey:NSTimeFormatString]];
88 [aString drawAtPoint:NSMakePoint(11, 49) withAttributes:_attrs];
89 }
90 //[_bell dissolveToPoint:NSMakePoint(35, 35) fraction:1.0];
91 }
92 - (void)mouseDown:(NSEvent *)theEvent
93 {
94 if ([theEvent clickCount] > 1) {
95 [NSApp unhide:self];
5096 } else {
51 if (timer)
52 [timer invalidate];
53 timer = nil;
54 }
55 }
56 - (void)mouseDown:(NSEvent *)theEvent
57 {
58 if ([theEvent clickCount] > 1)
59 [NSApp unhide:self];
97 /* Code copied from Switcher in GAP */
98 NSPoint lastLocation;
99 NSPoint location;
100 unsigned eventMask = NSLeftMouseDownMask | NSLeftMouseUpMask | NSPeriodicMask | NSOtherMouseUpMask | NSRightMouseUpMask;
101 NSDate *theDistantFuture = [NSDate distantFuture];
102 BOOL done = NO;
103
104 lastLocation = [theEvent locationInWindow];
105 [NSEvent startPeriodicEventsAfterDelay: 0.02 withPeriod: 0.02];
106
107 while (!done) {
108 theEvent = [NSApp nextEventMatchingMask: eventMask
109 untilDate: theDistantFuture
110 inMode: NSEventTrackingRunLoopMode
111 dequeue: YES];
112 switch ([theEvent type]) {
113 case NSRightMouseUp:
114 case NSOtherMouseUp:
115 case NSLeftMouseUp:
116 done = YES;
117 break;
118 case NSPeriodic:
119 location = [_window mouseLocationOutsideOfEventStream];
120 if (NSEqualPoints(location, lastLocation) == NO) {
121 NSPoint origin = [_window frame].origin;
122 origin.x += (location.x - lastLocation.x);
123 origin.y += (location.y - lastLocation.y);
124 [_window setFrameOrigin: origin];
125 }
126 break;
127 default:
128 break;
129 }
130 }
131 [NSEvent stopPeriodicEvents];
132 }
60133 }
61134 @end
62135
132205 [soonStart changeDayBy:2];
133206 [soonEnd changeDayBy:5];
134207 while ((event = [enumerator nextObject])) {
208 if (![[event store] displayed])
209 continue;
135210 if ([event isScheduledForDay:today])
136211 [_today addChild:[DataTree dataTreeWithAttributes:[self attributesFrom:event and:today]]];
137212 if ([event isScheduledForDay:tomorrow])
146221 [_tomorrow sortChildrenUsingFunction:compareDataTreeElements context:nil];
147222 [_soon sortChildrenUsingFunction:compareDataTreeElements context:nil];
148223 [_tasks removeChildren];
149 enumerator = [[_sm allTasks] objectEnumerator];
224 enumerator = [[_sm visibleTasks] objectEnumerator];
150225 while ((task = [enumerator nextObject])) {
151226 if ([task state] != TK_COMPLETED)
152227 [_tasks addChild:[DataTree dataTreeWithAttributes:[self attributesFromTask:task]]];
178253 {
179254 self = [super init];
180255 if (self) {
181 ConfigManager *config = [ConfigManager globalConfig];
182 [config registerDefaults:[self defaults]];
183 [config registerClient:self forKey:APPICON_DATE];
184 [config registerClient:self forKey:APPICON_TIME];
185 selectionManager = [SelectionManager globalManager];
256 [[ConfigManager globalConfig] registerDefaults:[self defaults]];
257 _selm = [SelectionManager globalManager];
186258 _sm = [StoreManager globalManager];
187259 _pc = [PreferencesController new];
188260 [self initSummary];
197269 [[taskView tableColumnWithIdentifier:@"state"] setDataCell:cell];
198270 [[taskView tableColumnWithIdentifier:@"state"] setMaxWidth:128];
199271 [taskView setAutoresizesAllColumnsToFit:YES];
200 /*
201 * FIXME : this shouldn't be needed but I can't make it
202 * work by editing the interface with Gorm...
203 * [[taskView superview] superview] is the ScrollView
204 *
205 * Edit : I don't know if the bug comes from Gorm or
206 * NSTabView but here's an explanation : there is a NSView
207 * between NSTabView and each tab view (NSTabView -> NSView -> DayView,
208 * NSTabView -> NSView -> WeekView etc) and, except for the first tab,
209 * the intermediate view's autoresizingMask is 0
210 */
211 [[[[taskView superview] superview] superview] setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
212 [[weekView superview] setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
213272 [taskView setUsesAlternatingRowBackgroundColors:YES];
214273 [taskView setTarget:self];
215274 [taskView setDoubleAction:@selector(editAppointment:)];
217276 [summary setTarget:self];
218277 [summary setDoubleAction:@selector(editAppointment:)];
219278 [window setFrameAutosaveName:@"mainWindow"];
279 [window makeKeyAndOrderFront:self];
220280 }
221281
222282 - (void)applicationDidFinishLaunching:(NSNotification *)not
241301 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dataChanged:) name:SADataChangedInStoreManager object:nil];
242302 /* FIXME : this is overkill, we should only refresh the views for visual changes */
243303 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dataChanged:) name:SAStatusChangedForStore object:nil];
244 /* Set the selected day : this will update all views and titles (but not the summary */
304 /* Set the selected day : this will update all views and titles (but not the summary) */
305 [calendar setDateSource:self];
245306 [calendar setDate:[Date today]];
246307 /*
247308 * If stores are loaded before this is executed (it happens
251312 * empty so this is needed here.
252313 */
253314 [self updateSummaryData];
315 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reminderWillRun:) name:SAEventReminderWillRun object:nil];
254316 /* This will init the alarms for all loaded elements needing one */
255317 [AlarmManager globalManager];
256318 }
257319
258 - (void)applicationWillTerminate:(NSNotification*)aNotification
259 {
260 [[ConfigManager globalConfig] unregisterClient:self];
320 - (void)applicationWillTerminate:(NSNotification *)aNotification
321 {
261322 [[NSNotificationCenter defaultCenter] removeObserver:self];
262 [_summaryRoot release];
263 [_pc release];
264 /*
265 * FIXME : we shouldn't have to release the store
266 * manager as we don't retain it. It's a global
267 * instance that should synchronise itself when
268 * it's freed
269 */
270 [_sm release];
323 [_sm synchronise];
324 RELEASE(_summaryRoot);
325 RELEASE(_pc);
326 RELEASE(_appicon);
271327 RELEASE(_selectedDay);
272328 }
273329
303359 [_pc showPreferences];
304360 }
305361
362 NSComparisonResult compareEventTime(id a, id b, void *context)
363 {
364 return [[a startDate] compareTime:[b startDate]];
365 }
366
306367 - (int)_sensibleStartForDuration:(int)duration
307368 {
308369 int minute = [dayView firstHour] * 60;
309 NSEnumerator *enumerator = [[_sm scheduledAppointmentsForDay:_selectedDay] objectEnumerator];
370 NSEnumerator *enumerator = [[[[_sm visibleAppointmentsForDay:_selectedDay] allObjects]
371 sortedArrayUsingFunction:compareEventTime context:nil] objectEnumerator];
310372 Event *apt;
311373
312374 while ((apt = [enumerator nextObject])) {
370432
371433 - (void)editAppointment:(id)sender
372434 {
373 id lastSelection = [selectionManager lastObject];
435 id lastSelection = [_selm lastObject];
374436
375437 if (lastSelection) {
376438 if ([lastSelection isKindOfClass:[Event class]])
384446
385447 - (void)delAppointment:(id)sender
386448 {
387 NSEnumerator *enumerator = [selectionManager enumerator];
449 NSEnumerator *enumerator = [_selm enumerator];
388450 Element *el;
389451
390452 while ((el = [enumerator nextObject]))
391453 [[el store] remove:el];
392 [selectionManager clear];
454 [_selm clear];
393455 }
394456
395457 - (void)exportAppointment:(id)sender;
396458 {
397 NSEnumerator *enumerator = [selectionManager enumerator];
459 NSEnumerator *enumerator = [_selm enumerator];
398460 NSSavePanel *panel = [NSSavePanel savePanel];
399461 NSString *str;
400462 iCalTree *tree;
401463 Element *el;
402464
403 if ([selectionManager count] > 0) {
465 if ([_selm count] > 0) {
404466 [panel setRequiredFileType:@"ics"];
405467 [panel setTitle:_(@"Export as")];
406 if ([panel runModalForDirectory:nil file:[[selectionManager lastObject] summary]] == NSOKButton) {
468 if ([panel runModalForDirectory:nil file:[[_selm lastObject] summary]] == NSOKButton) {
407469 tree = [iCalTree new];
408470 while ((el = [enumerator nextObject]))
409471 [tree add:el];
427489
428490 - (void)copy:(id)sender
429491 {
430 [selectionManager copySelection];
492 [_selm copySelection];
431493 }
432494
433495 - (void)cut:(id)sender
434496 {
435 [selectionManager cutSelection];
497 [_selm cutSelection];
436498 }
437499
438500 - (void)paste:(id)sender
439501 {
440 if ([selectionManager copiedCount] > 0) {
441 NSEnumerator *enumerator = [[selectionManager paste] objectEnumerator];
502 if ([_selm copiedCount] > 0) {
503 NSEnumerator *enumerator = [[_selm paste] objectEnumerator];
442504 Date *date = [[calendar date] copy];
443505 Event *el;
444506 id <MemoryStore> store;
448510 while ((el = [enumerator nextObject])) {
449511 /* FIXME : store property could be handled by Event:copy ? */
450512 store = [el store];
513
514 /* FIXME : this isn't enough : we have to find a writable store or error out */
515 if (![store writable])
516 store = [_sm defaultStore];
517
451518 start = [[el startDate] minuteOfDay];
452 if ([selectionManager lastOperation] == SMCopy)
519 if ([_selm lastOperation] == SMCopy)
453520 el = [el copy];
454521 [date setMinute:start];
455522 [el setStartDate:date];
456 if ([selectionManager lastOperation] == SMCopy) {
523 if ([_selm lastOperation] == SMCopy) {
457524 [store add:el];
458525 /*
459526 * FIXME : the new event is now in store's dictionary, we
531598 - (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem
532599 {
533600 SEL action = [menuItem action];
534
535 if (sel_eq(action, @selector(copy:)))
536 return [selectionManager count] > 0;
537 if (sel_eq(action, @selector(cut:)))
538 return [selectionManager count] > 0;
539 if (sel_eq(action, @selector(editAppointment:)))
540 return [selectionManager count] == 1;
541 if (sel_eq(action, @selector(delAppointment:)))
542 return [selectionManager count] > 0;
543 if (sel_eq(action, @selector(exportAppointment:)))
544 return [selectionManager count] > 0;
545 if (sel_eq(action, @selector(paste:)))
546 return [selectionManager copiedCount] > 0;
601 NSEnumerator *enumerator;
602 Element *el;
603
604 if (sel_isEqual(action, @selector(copy:)))
605 return [_selm count] > 0;
606 if (sel_isEqual(action, @selector(cut:))) {
607 if ([_selm count] == 0)
608 return NO;
609 enumerator = [[_selm selection] objectEnumerator];
610 while ((el = [enumerator nextObject])) {
611 if (![[el store] writable])
612 return NO;
613 }
614 return YES;
615 }
616 if (sel_isEqual(action, @selector(editAppointment:)))
617 return [_selm count] == 1;
618 if (sel_isEqual(action, @selector(delAppointment:)))
619 return [_selm count] > 0;
620 if (sel_isEqual(action, @selector(exportAppointment:)))
621 return [_selm count] > 0;
622 if (sel_isEqual(action, @selector(paste:)))
623 return [_selm copiedCount] > 0;
547624 return YES;
548625 }
549626
553630 * FIXME : if a selected event was deleted by another application,
554631 * the selection will reference a non existing object
555632 */
633 [calendar reloadData];
556634 [dayView reloadData];
557635 [weekView reloadData];
558636 [taskView reloadData];
560638 [self updateSummaryData];
561639 }
562640
641 - (BOOL)showElement:(Element *)element onDay:(Date *)day
642 {
643 NSString *tabIdentifier = [[tabs selectedTabViewItem] identifier];
644
645 NSAssert(element != nil, @"An object must be passed");
646 NSAssert([day isDate], @"This method uses a day, not a date");
647 if ([element isKindOfClass:[Event class]]) {
648 [calendar setDate:day];
649 if (![tabIdentifier isEqualToString:@"Day"] && ![tabIdentifier isEqualToString:@"Week"])
650 [tabs selectTabViewItemWithIdentifier:@"Day"];
651 [_selm select:element];
652 return YES;
653 }
654 if ([element isKindOfClass:[Task class]]) {
655 if (![tabIdentifier isEqualToString:@"Tasks"])
656 [tabs selectTabViewItemWithIdentifier:@"Tasks"];
657 [_selm select:element];
658 return YES;
659 }
660 return NO;
661 }
662
663 - (void)reminderWillRun:(NSNotification *)not
664 {
665 Alarm *alarm = [not object];
666
667 [self showElement:[alarm element] onDay:[Date today]];
668 }
669
563670 - (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType
564671 {
565 if ([selectionManager count] && (!sendType || [sendType isEqual:NSFilenamesPboardType] || [sendType isEqual:NSStringPboardType]))
672 if ([_selm count] && (!sendType || [sendType isEqual:NSFilenamesPboardType] || [sendType isEqual:NSStringPboardType]))
566673 return self;
567674 return nil;
568675 }
569676 - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types
570677 {
571 NSEnumerator *enumerator = [selectionManager enumerator];
678 NSEnumerator *enumerator = [_selm enumerator];
572679 Element *el;
573680 NSString *ical;
574681 NSString *filename;
576683 NSFileWrapper *fw;
577684 BOOL written;
578685
579 if ([selectionManager count] == 0)
686 if ([_selm count] == 0)
580687 return NO;
581688 NSAssert([types count] == 1, @"It seems our assumption was wrong");
582689 tree = AUTORELEASE([iCalTree new]);
590697 NSLog(@"Unable to encode into NSFileWrapper");
591698 return NO;
592699 }
593 filename = [NSString stringWithFormat:@"%@/%@.ics", NSTemporaryDirectory(), [[selectionManager lastObject] summary]];
700 filename = [NSString stringWithFormat:@"%@/%@.ics", NSTemporaryDirectory(), [[_selm lastObject] summary]];
594701 written = [fw writeToFile:filename atomically:YES updateFilenames:YES];
595702 [fw release];
596703 if (!written) {
606713 }
607714 return NO;
608715 }
609
610 - (void)config:(ConfigManager *)config dataDidChangedForKey:(NSString *)key
611 {
612 [_appicon setNeedsDisplay:YES];
613 }
614716 @end
615717
616718 @implementation AppController(NSOutlineViewDataSource)
642744 - (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
643745 {
644746 id object = [item valueForKey:@"object"];
645 NSString *tabIdentifier = [[tabs selectedTabViewItem] identifier];
646 Date *date;
647
648 if (object && [object isKindOfClass:[Event class]]) {
649 date = [[item valueForKey:@"date"] copy];
650 [date setIsDate:YES];
651 [calendar setDate:date];
652 [date release];
653 if (![tabIdentifier isEqualToString:@"Day"] && ![tabIdentifier isEqualToString:@"Week"])
654 [tabs selectTabViewItemWithIdentifier:@"Day"];
655 [selectionManager set:object];
656 return YES;
657 }
658 if (object && [object isKindOfClass:[Task class]]) {
659 if (![tabIdentifier isEqualToString:@"Tasks"])
660 [tabs selectTabViewItemWithIdentifier:@"Tasks"];
661 [selectionManager set:object];
662 return YES;
663 }
747
748 if (object && [object isKindOfClass:[Event class]])
749 return [self showElement:object onDay:[Date dayWithDate:[item valueForKey:@"date"]]];
750 if (object && [object isKindOfClass:[Task class]])
751 return [self showElement:object onDay:[calendar date]];
664752 return NO;
753 }
754 @end
755
756 @implementation AppController(CalendarViewDataSource)
757 - (CVCellStatus)calendarView:(CalendarView *)view cellStatusForDate:(Date *)date
758 {
759 if ([[_sm visibleAppointmentsForDay:date] count] > 0)
760 return CVHasDataCell;
761 return CVEmptyCell;
665762 }
666763 @end
667764
729826 @implementation AppController(NSTableDataSource)
730827 - (int)numberOfRowsInTableView:(NSTableView *)aTableView
731828 {
732 return [[_sm allTasks] count];
829 return [[_sm visibleTasks] count];
733830 }
734831 - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
735832 {
736 Task *task = [[_sm allTasks] objectAtIndex:rowIndex];
833 Task *task = [[_sm visibleTasks] objectAtIndex:rowIndex];
737834
738835 if ([[aTableColumn identifier] isEqualToString:@"summary"])
739836 return [task summary];
741838 }
742839 - (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
743840 {
744 Task *task = [[_sm allTasks] objectAtIndex:rowIndex];
841 Task *task = [[_sm visibleTasks] objectAtIndex:rowIndex];
745842
746843 if ([[task store] writable]) {
747844 [task setState:[anObject intValue]];
753850 Task *task;
754851
755852 if ([[aTableColumn identifier] isEqualToString:@"state"]) {
756 task = [[_sm allTasks] objectAtIndex:rowIndex];
853 task = [[_sm visibleTasks] objectAtIndex:rowIndex];
757854 [aCell setEnabled:[[task store] writable]];
758855 }
759856 }
761858 {
762859 int index = [taskView selectedRow];
763860 if (index > -1)
764 [selectionManager set:[[_sm allTasks] objectAtIndex:index]];
861 [_selm select:[[_sm visibleTasks] objectAtIndex:index]];
765862 }
766863 @end
767864
2020 id timeText;
2121 Date *startDate;
2222 Event *_event;
23 NSArray *_modifiedAlarms;
2324 }
2425
2526 + (AppointmentEditor *)editorForEvent:(Event *)event;
2829 - (void)selectFrequency:(id)sender;
2930 - (void)toggleUntil:(id)sender;
3031 - (void)toggleAllDay:(id)sender;
32 - (void)editAlarms:(id)sender;
3133 @end
44 #import "HourFormatter.h"
55 #import "AgendaStore.h"
66 #import "ConfigManager.h"
7 #import "AlarmEditor.h"
78 #import "defines.h"
89
910 static NSMutableDictionary *editors;
4647 self = [self init];
4748 if (self) {
4849 ASSIGN(_event , event);
50 ASSIGNCOPY(_modifiedAlarms, [event alarms]);
4951 [title setStringValue:[event summary]];
50 [duration setFloatValue:[event duration] / 60.0];
51 [durationText setFloatValue:[event duration] / 60.0];
52 [duration setIntValue:[event duration] * 60];
53 [durationText setIntValue:[event duration] * 60];
5254 [location setStringValue:[event location]];
5355 [allDay setState:[event allDay]];
54 [time setFloatValue:([[event startDate] hourOfDay]*60 + [[event startDate] minuteOfHour]) / 60.0];
55 [timeText setFloatValue:([[event startDate] hourOfDay]*60 + [[event startDate] minuteOfHour]) / 60.0];
56 [time setIntValue:[[event startDate] minuteOfDay] * 60];
57 [timeText setIntValue:[[event startDate] minuteOfDay] * 60];
5658 if (![event rrule])
5759 [repeat selectItemAtIndex:0];
5860 else
9395 - (void)dealloc
9496 {
9597 RELEASE(_event);
98 RELEASE(_modifiedAlarms);
9699 [super dealloc];
97100 }
98101
122125 Date *date;
123126
124127 [_event setSummary:[title stringValue]];
125 [_event setDuration:[duration floatValue] * 60.0];
128 [_event setDuration:[duration intValue] / 60];
126129
127130 if (![repeat indexOfSelectedItem]) {
128131 [_event setRRule:nil];
140143 if (![_event allDay]) {
141144 date = [[_event startDate] copy];
142145 [date setIsDate:NO];
143 [date setMinute:[time floatValue] * 60.0];
146 [date setMinute:[time intValue] / 60];
144147 [_event setStartDate:date];
145148 [date release];
146149 }
150 [_event setAlarms:_modifiedAlarms];
147151 aStore = [sm storeForName:[store titleOfSelectedItem]];
148152 if (!originalStore)
149153 [aStore add:_event];
153157 [originalStore remove:_event];
154158 [aStore add:_event];
155159 }
160 [window close];
156161 [editors removeObjectForKey:[_event UID]];
162 /* After this point the panel instance is released */
163 }
164
165 - (void)cancel:(id)sender
166 {
157167 [window close];
158 }
159
160 - (void)cancel:(id)sender
161 {
162168 [editors removeObjectForKey:[_event UID]];
163 [window close];
164 }
165
166 - (void)controlTextDidChange:(NSNotification *)aNotification
169 }
170
171 - (void)controlTextDidEndEditing:(NSNotification *)aNotification
167172 {
168173 id end = [endDate objectValue];
169
170 if (end == nil || ![end isKindOfClass:[NSDate class]])
171 [ok setEnabled:NO];
172 else
173 [ok setEnabled:[self canBeModified]];
174 [ok setEnabled: ([self canBeModified] && (end != nil))];
174175 }
175176
176177 - (void)selectFrequency:(id)sender
228229 }
229230 }
230231
232 - (void)editAlarms:(id)sender
233 {
234 NSArray *alarms;
235
236 alarms = [AlarmEditor editAlarms:_modifiedAlarms];
237 if (alarms)
238 ASSIGN(_modifiedAlarms, alarms);
239 [window makeKeyAndOrderFront:self];
240 }
241
231242 - (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector
232243 {
233244 if ([NSStringFromSelector(aSelector) isEqualToString:@"insertTab:"]) {
1616 Event *_apt;
1717 }
1818 - (NSImage *)repeatImage;
19 - (NSImage *)alarmImage;
1920 - (id)initWithFrame:(NSRect)frameRect appointment:(Event *)apt;
2021 - (Event *)appointment;
2122 - (void)tooltipSetup;
33 #import "defines.h"
44
55 static NSImage *_repeatImage;
6 static NSImage *_alarmImage;
67
78 @implementation AppointmentView
89 + (void)initialize
910 {
10 if (!_repeatImage) {
11 _repeatImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:@"repeat"]];
12 [_repeatImage setFlipped:YES];
13 }
11 _repeatImage = [NSImage imageNamed:@"repeat"];
12 _alarmImage = [NSImage imageNamed:@"small-bell"];
1413 }
1514
1615 - (NSImage *)repeatImage
1716 {
1817 return _repeatImage;
18 }
19
20 - (NSImage *)alarmImage
21 {
22 return _alarmImage;
1923 }
2024
2125 - (id)initWithFrame:(NSRect)frameRect appointment:(Event *)apt
00 /* emacs objective-c mode -*- objc -*- */
11
22 #import <AppKit/AppKit.h>
3
4 typedef enum {
5 CVEmptyCell = 0,
6 CVHasDataCell
7 } CVCellStatus;
38
49 @interface CalendarView : NSView
510 {
1621 IBOutlet id delegate;
1722 NSTimer *_dayTimer;
1823 int bezeledCell;
24 id _dataSource;
1925 }
2026
2127 - (id)initWithFrame:(NSRect)frame;
2228 - (Date *)date;
29 - (void)setDate:(Date *)date;
2330 - (NSString *)dateAsString;
2431 - (id)delegate;
25 - (void)setDate:(Date *)date;
2632 - (void)setDelegate:(id)delegate;
33 - (id)dataSource;
34 - (void)setDateSource:(id)dataSource;
35 - (void)reloadData;
2736 @end
2837
2938 @interface NSObject(CalendarViewDelegate)
3140 - (void)calendarView:(CalendarView *)cs currentDateChanged:(Date *)date;
3241 - (void)calendarView:(CalendarView *)cs userActionForDate:(Date *)date;
3342 @end
43
44 @interface NSObject(CalendarViewDataSource)
45 - (CVCellStatus)calendarView:(CalendarView *)view cellStatusForDate:(Date *)date;
46 @end
00 #import <AppKit/AppKit.h>
11 #import "Date.h"
22 #import "CalendarView.h"
3 #import "StoreManager.h"
43
54 @interface DayFormatter : NSFormatter
65 @end
87 - (NSString *)stringForObjectValue:(id)anObject
98 {
109 NSAssert([anObject isKindOfClass:[Date class]], @"Needs a Date as input");
11 return [NSString stringWithFormat:@"%2d", [anObject dayOfMonth]];
10 return [NSString stringWithFormat:@"%2d", [(Date *)anObject dayOfMonth]];
1211 }
1312 - (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string errorDescription:(NSString **)error
1413 {
2827 static NSImage *_2right;
2928 + (void)initialize
3029 {
31 NSString *path;
32
33 path = [[NSBundle mainBundle] pathForImageResource:@"1left"];
34 _1left = [[NSImage alloc] initWithContentsOfFile:path];
35 path = [[NSBundle mainBundle] pathForImageResource:@"2left"];
36 _2left = [[NSImage alloc] initWithContentsOfFile:path];
37 path = [[NSBundle mainBundle] pathForImageResource:@"1right"];
38 _1right = [[NSImage alloc] initWithContentsOfFile:path];
39 path = [[NSBundle mainBundle] pathForImageResource:@"2right"];
40 _2right = [[NSImage alloc] initWithContentsOfFile:path];
30 _1left = [NSImage imageNamed:@"1left"];
31 _2left = [NSImage imageNamed:@"2left"];
32 _1right = [NSImage imageNamed:@"1right"];
33 _2right = [NSImage imageNamed:@"2right"];
4134 }
4235
4336 - (void)dealloc
4437 {
45 [[NSNotificationCenter defaultCenter] removeObserver:self];
38 [_dayTimer invalidate];
4639 RELEASE(date);
4740 RELEASE(monthDisplayed);
48 [_dayTimer invalidate];
4941 RELEASE(_dayTimer);
5042 RELEASE(delegate);
51 [boldFont release];
52 [normalFont release];
53 [title release];
54 [matrix release];
55 [obl release];
56 [tbl release];
57 [obr release];
58 [tbr release];
43 RELEASE(_dataSource);
44 RELEASE(boldFont);
45 RELEASE(normalFont);
46 RELEASE(title);
47 RELEASE(matrix);
48 RELEASE(obl);
49 RELEASE(tbl);
50 RELEASE(obr);
51 RELEASE(tbr);
5952 [super dealloc];
6053 }
6154
7265 NSArray *days = [[NSUserDefaults standardUserDefaults] objectForKey:NSShortWeekDayNameArray];
7366 boldFont = RETAIN([NSFont boldSystemFontOfSize:11]);
7467 normalFont = RETAIN([NSFont systemFontOfSize:11]);
75 delegate = nil;
7668
7769 title = [[NSTextField alloc] initWithFrame: NSMakeRect(32, 128, 168, 20)];
7870 [title setEditable:NO];
164156 userInfo:nil
165157 repeats:YES];
166158 [[NSRunLoop currentRunLoop] addTimer:_dayTimer forMode:NSDefaultRunLoopMode];
167 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dataChanged:) name:SADataChangedInStoreManager object:nil];
168 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dataChanged:) name:SAStatusChangedForStore object:nil];
169159 }
170160 return self;
171161 }
208198 NSColor *clear = [NSColor clearColor];
209199 NSColor *white = [NSColor whiteColor];
210200 NSColor *black = [NSColor blackColor];
211 StoreManager *sm = [StoreManager globalManager];
212201
213202 [self clearSelectedDay];
214203 today = [Date today];
229218 [cell setDrawsBackground:NO];
230219 }
231220 [cell setObjectValue:AUTORELEASE([day copy])];
232 if ([[sm scheduledAppointmentsForDay:day] count])
221 if (_dataSource &&
222 [_dataSource respondsToSelector:@selector(calendarView:cellStatusForDate:)] &&
223 [_dataSource calendarView:self cellStatusForDate:day] & CVHasDataCell)
233224 [cell setFont:boldFont];
234225 else
235226 [cell setFont: normalFont];
307298 return delegate;
308299 }
309300
301 - (id)dataSource
302 {
303 return _dataSource;
304 }
305 - (void)setDateSource:(id)dataSource
306 {
307 ASSIGN(_dataSource, dataSource);
308 [self updateView];
309 }
310
311 - (void)reloadData
312 {
313 [self updateView];
314 }
315
310316 - (void)setDate:(Date *)nDate
311317 {
312318 NSAssert([nDate isDate], @"Calender expects a date");
325331 {
326332 return [[date calendarDate] descriptionWithCalendarFormat:[[NSUserDefaults standardUserDefaults] objectForKey:NSDateFormatString]];
327333 }
328
329 - (void)dataChanged:(NSNotification *)not
330 {
331 [self updateView];
332 }
333334 @end
1414 NSMutableDictionary *_dict;
1515 }
1616
17 - (ConfigManager *)initForKey:(NSString *)key withParent:(ConfigManager *)parent;
1817 + (ConfigManager *)globalConfig;
18 - (id)initForKey:(NSString *)key;
1919 - (void)registerDefaults:(NSDictionary *)defaults;
2020 - (void)registerClient:(id <ConfigListener>)client forKey:(NSString *)key;
2121 - (void)unregisterClient:(id <ConfigListener>)client forKey:(NSString *)key;
00 #import <Foundation/Foundation.h>
1 #import "NSColor+SimpleAgenda.h"
12 #import "ConfigManager.h"
23
34 static ConfigManager *singleton;
4 static NSMutableDictionary *_cpkey;
5 static NSMutableDictionary *cpkey;
56
67 @implementation ConfigManager(Private)
78 - (ConfigManager *)initRoot
89 {
9 self = [super init];
10 if (self) {
11 _dict = [NSMutableDictionary new];
12 _defaults = [NSMutableDictionary new];
13 [_dict setDictionary:[[NSUserDefaults standardUserDefaults]
14 persistentDomainForName:[[NSProcessInfo processInfo] processName]]];
15 }
10 if ((self = [self init]))
11 [_dict setDictionary:[[NSUserDefaults standardUserDefaults]
12 persistentDomainForName:[[NSProcessInfo processInfo] processName]]];
1613 return self;
1714 }
1815 @end
2118 + (void)initialize
2219 {
2320 if ([ConfigManager class] == self) {
24 _cpkey = [NSMutableDictionary new];
21 cpkey = [NSMutableDictionary new];
2522 singleton = [[ConfigManager alloc] initRoot];
2623 }
2724 }
2825
29 - (ConfigManager *)initForKey:(NSString *)key withParent:(ConfigManager *)parent
26 + (ConfigManager *)globalConfig
3027 {
31 NSAssert(key != nil, @"ConfigManager initForKey called with nil key");
32 self = [super init];
33 if (self) {
28 return singleton;
29 }
30
31 - (id)init
32 {
33 if ((self = [super init])) {
3434 _dict = [NSMutableDictionary new];
3535 _defaults = [NSMutableDictionary new];
36 if (parent == nil)
37 parent = [ConfigManager globalConfig];
36 }
37 return self;
38 }
39
40 - (id)initForKey:(NSString *)key
41 {
42 ConfigManager *parent = [ConfigManager globalConfig];
43
44 if ((self = [self init])) {
3845 [_dict setDictionary:[parent dictionaryForKey:key]];
3946 ASSIGN(_parent, parent);
4047 ASSIGNCOPY(_key, key);
4249 return self;
4350 }
4451
45 + (ConfigManager *)globalConfig
46 {
47 return singleton;
48 }
49
5052 - (void)dealloc
5153 {
52 RELEASE(_key);
53 RELEASE(_parent);
54 [_defaults release];
55 [_dict release];
54 DESTROY(_key);
55 DESTROY(_parent);
56 DESTROY(_defaults);
57 DESTROY(_dict);
5658 [super dealloc];
5759 }
5860
5961 - (void)notifyListenerForKey:(NSString *)key
6062 {
61 NSEnumerator *enumerator;
6263 id <ConfigListener> listener;
63 NSValue *value;
64 NSPointerArray *array;
65 NSUInteger index;
6466
65 NSAssert(key != nil, @"Missing key");
66 enumerator = [[_cpkey objectForKey:key] objectEnumerator];
67 while ((value = [enumerator nextObject])) {
68 listener = [value nonretainedObjectValue];
69 [listener config:self dataDidChangedForKey:key];
67 array = [cpkey objectForKey:key];
68 for (index = 0; index < [array count]; index++) {
69 listener = [array pointerAtIndex:index];
70 if (listener)
71 [listener config:self dataDidChangedForKey:key];
7072 }
7173 }
7274
106108
107109 - (int)integerForKey:(NSString *)key
108110 {
109 id object;
111 id object = [self objectForKey:key];
110112
111 object = [self objectForKey:key];
112113 if (object != nil)
113114 return [object intValue];
114115 return 0;
121122
122123 - (NSDictionary *)dictionaryForKey:(NSString *)key
123124 {
124 id object;
125 id object = [self objectForKey:key];
125126
126 object = [self objectForKey:key];
127127 if (object != nil && [object isKindOfClass:[NSDictionary class]])
128128 return object;
129129 return nil;
148148 [self setObject:[value description] forKey:key];
149149 }
150150
151 - (void)registerClient:(id <ConfigListener>)client forKey:(NSString*)key
151 - (void)registerClient:(id <ConfigListener>)client forKey:(NSString *)key
152152 {
153 NSAssert(key != nil, @"You have to register for a specific key");
154 NSMutableSet *listeners = [_cpkey objectForKey:key];
153 NSPointerArray *listeners = [cpkey objectForKey:key];
155154
156 if (listeners)
157 [listeners addObject:[NSValue valueWithNonretainedObject:client]];
158 else
159 listeners = [NSMutableSet setWithObject:[NSValue valueWithNonretainedObject:client]];
160 [_cpkey setObject:listeners forKey:key];
161
155 if (!listeners) {
156 listeners = [NSPointerArray pointerArrayWithWeakObjects];
157 [cpkey setObject:listeners forKey:key];
158 }
159 [listeners addPointer:client];
162160 }
163161
164 - (void)unregisterClient:(id <ConfigListener>)client forKey:(NSString*)key
162 - (void)unregisterClient:(id <ConfigListener>)client forKey:(NSString *)key
165163 {
166 NSMutableSet *set = [_cpkey objectForKey:key];
167 NSSet *copy;
168 NSEnumerator *enumerator;
169 NSValue *v;
164 NSPointerArray *array = [cpkey objectForKey:key];
165 NSUInteger index;
170166
171 if (set) {
172 copy = [NSSet setWithSet:set];
173 enumerator = [copy objectEnumerator];
174 while ((v = [enumerator nextObject])) {
175 if (client == [v nonretainedObjectValue])
176 [set removeObject:v];
167 if (array) {
168 for (index = 0; index < [array count]; index++) {
169 if ([array pointerAtIndex:index] == client)
170 [array replacePointerAtIndex:index withPointer:NULL];
177171 }
172 [array compact];
178173 }
179174 }
180175
181176 - (void)unregisterClient:(id <ConfigListener>)client
182177 {
183 NSMutableSet *set;
184 NSSet *copy;
185 NSValue *v;
186 NSEnumerator *enumerator = [_cpkey objectEnumerator];
187 NSEnumerator *en;
178 NSEnumerator *enumerator = [cpkey objectEnumerator];
179 NSPointerArray *array;
180 NSUInteger index;
188181
189 while ((set = [enumerator nextObject])) {
190 copy = [NSSet setWithSet:set];
191 en = [copy objectEnumerator];
192 while ((v = [en nextObject])) {
193 if (client == [v nonretainedObjectValue])
194 [set removeObject:v];
182 while ((array = [enumerator nextObject])) {
183 for (index = 0; index < [array count]; index++) {
184 if ([array pointerAtIndex:index] == client)
185 [array replacePointerAtIndex:index withPointer:NULL];
195186 }
187 [array compact];
196188 }
197189 }
198190 @end
0 #import <Foundation/Foundation.h>
1 #import <DBusKit/DBusKit.h>
2 #import "AlarmBackend.h"
3 #import "Alarm.h"
4 #import "Element.h"
5
6 @protocol Notifications
7 - (NSArray *)GetCapabilities;
8 - (NSNumber *)Notify:(NSString *)appname :(uint)replaceid :(NSString *)appicon :(NSString *)summary :(NSString *)body :(NSArray *)actions :(NSDictionary *)hints :(int)expires;
9 @end
10
11 @interface DBusBackend : AlarmBackend
12 @end
13
14 static NSString * const DBUS_BUS = @"org.freedesktop.Notifications";
15 static NSString * const DBUS_PATH = @"/org/freedesktop/Notifications";
16
17 @implementation DBusBackend
18 + (NSString *)backendName
19 {
20 return @"DBus desktop notification";
21 }
22
23 - (enum icalproperty_action)backendType
24 {
25 return ICAL_ACTION_DISPLAY;
26 }
27
28 - (id)init
29 {
30 NSConnection *c;
31 id <NSObject,Notifications> remote;
32 NSArray *caps;
33
34 self = [super init];
35 if (self) {
36 NS_DURING
37 {
38 c = [NSConnection connectionWithReceivePort:[DKPort port] sendPort:[[DKPort alloc] initWithRemote:DBUS_BUS]];
39 if (!c) {
40 NSLog(@"Unable to create a connection to %@", DBUS_BUS);
41 DESTROY(self);
42 }
43 remote = (id <NSObject,Notifications>)[c proxyAtPath:DBUS_PATH];
44 if (!remote) {
45 NSLog(@"Unable to create a proxy for %@", DBUS_PATH);
46 DESTROY(self);
47 }
48 caps = [remote GetCapabilities];
49 if (!caps) {
50 NSLog(@"No response to GetCapabilities method");
51 DESTROY(self);
52 }
53 [c invalidate];
54 }
55 NS_HANDLER
56 {
57 NSLog([localException description]);
58 NSLog(@"Exception during DBus backend setup, backend disabled");
59 DESTROY(self);
60 }
61 NS_ENDHANDLER
62 }
63 return self;
64 }
65
66 - (void)display:(Alarm *)alarm
67 {
68 NSConnection *c;
69 NSNumber *dnid;
70 id <NSObject,Notifications> remote;
71 Element *el = [alarm element];
72 NSString *desc;
73
74 c = [NSConnection connectionWithReceivePort:[DKPort port] sendPort:[[DKPort alloc] initWithRemote:DBUS_BUS]];
75 remote = (id <NSObject,Notifications>)[c proxyAtPath:DBUS_PATH];
76 if ([el text])
77 desc = [NSString stringWithFormat:@"%@\n\n%@ : %@", [[[el nextActivationDate] calendarDate] descriptionWithCalendarFormat:[[NSUserDefaults standardUserDefaults] objectForKey:NSShortTimeDateFormatString]], [el summary], [[el text] string]];
78 else
79 desc = [NSString stringWithFormat:@"%@\n\n%@", [[[el nextActivationDate] calendarDate] descriptionWithCalendarFormat:[[NSUserDefaults standardUserDefaults] objectForKey:NSShortTimeDateFormatString]], [el summary]];
80 dnid = [remote Notify:@"SimpleAgenda"
81 :0
82 :@""
83 :_(@"SimpleAgenda Reminder !")
84 :desc
85 :[NSArray array]
86 :[NSDictionary dictionary]
87 :-1];
88 [c invalidate];
89 }
90 @end
1111 + (id)today;
1212 + (id)dateWithTimeInterval:(NSTimeInterval)seconds sinceDate:(Date *)refDate;
1313 + (id)dateWithCalendarDate:(NSCalendarDate *)cd withTime:(BOOL)time;
14 + (id)dayWithDate:(Date *)date;
1415 - (NSCalendarDate *)calendarDate;
1516 - (NSComparisonResult)compare:(id)aDate;
1617 - (NSComparisonResult)compareTime:(id)aTime;
3839 - (void)setIsDate:(BOOL)date;
3940 - (NSTimeInterval)timeIntervalSince1970;
4041 - (NSTimeInterval)timeIntervalSinceDate:(Date *)anotherDate;
42 - (NSTimeInterval)timeIntervalSinceNow;
43 - (BOOL)belongsToDay:(Date *)day;
4144 @end
4245
4346 @interface Date(iCalendar)
4447 - (id)initWithICalTime:(struct icaltimetype)time;
45 - (struct icaltimetype)iCalTime;
48 - (struct icaltimetype)UTCICalTime;
49 - (struct icaltimetype)localICalTime;
4650 @end
144144 /* To be able to add hours and minutes, it has to be a datetime */
145145 d-> _time.is_date = 0;
146146 d->_time = icaltime_add(d->_time, icaldurationtype_from_int(seconds));
147 /*
148 * FIXME : this is wrong is refDate is a date but seconds
149 * not a multiple of 86400
150 */
151 d->_time.is_date = refDate->_time.is_date;
147 if (!d->_time.hour && !d->_time.minute && !d->_time.second)
148 d->_time.is_date = 1;
149 else
150 d->_time.is_date = 0;
152151 return AUTORELEASE(d);
153152 }
154153
172171 return AUTORELEASE(d);
173172 }
174173
174 + (id)dayWithDate:(Date *)date
175 {
176 Date *d = [date copy];
177 [d setIsDate:YES];
178 return AUTORELEASE(d);
179 }
180
175181 - (NSCalendarDate *)calendarDate
176182 {
177183 return [NSCalendarDate dateWithYear:_time.year
319325 {
320326 return icaldurationtype_as_int(icaltime_subtract(_time, anotherDate->_time));
321327 }
328
329 - (NSTimeInterval)timeIntervalSinceNow
330 {
331 return [self timeIntervalSinceDate:[Date now]];
332 }
333
334 - (BOOL)belongsToDay:(Date *)day
335 {
336 NSAssert([day isDate], @"This method expects a date, not a datetime");
337 return _time.year == day->_time.year && _time.month == day->_time.month && _time.day == day->_time.day;
338 }
322339 @end
323340
324341 /*
334351 _time = icaltime_convert_to_zone(time, gl_tz);
335352 return self;
336353 }
337 - (struct icaltimetype)iCalTime
354 - (struct icaltimetype)UTCICalTime
338355 {
339356 return icaltime_convert_to_zone(_time, gl_utc);
340357 }
341 @end
358 - (struct icaltimetype)localICalTime
359 {
360 return _time;
361 }
362 @end
0 #import <Foundation/Foundation.h>
01 #import "DateRange.h"
12
23 @implementation DateRange
00 /* emacs buffer mode hint -*- objc -*- */
11
2 #import <Foundation/Foundation.h>
23 #import "AgendaStore.h"
34 #import "DayView.h"
45 #import "ConfigManager.h"
2930 #define RADIUS 5
3031 - (void)drawRect:(NSRect)rect
3132 {
33 NSPoint point;
3234 NSString *title;
3335 NSString *label;
3436 Date *start = [_apt startDate];
8587 PSfill();
8688 }
8789 [label drawInRect:TextRect(rect) withAttributes:textAttributes];
88 if ([_apt rrule])
90 point = NSMakePoint(rect.size.width - 18, rect.size.height - 16);
91 if ([_apt rrule]) {
8992 [[self repeatImage] compositeToPoint:NSMakePoint(rect.size.width - 18, rect.size.height - 18) operation:NSCompositeSourceOver];
93 point = NSMakePoint(rect.size.width - 30, rect.size.height - 16);
94 }
95 if ([_apt hasAlarms])
96 [[self alarmImage] compositeToPoint:point operation:NSCompositeSourceOver];
9097 }
9198
9299 - (void)mouseDown:(NSEvent *)theEvent
345352 - (void)selectAppointmentView:(AppointmentView *)aptv
346353 {
347354 _selected = aptv;
348 [[SelectionManager globalManager] set:[aptv appointment]];
355 [[SelectionManager globalManager] select:[aptv appointment]];
349356 if ([delegate respondsToSelector:@selector(viewSelectEvent:)])
350357 [delegate viewSelectEvent:[aptv appointment]];
351358 [self setNeedsDisplay:YES];
359366 NSSet *events;
360367 BOOL found;
361368
362 events = [[StoreManager globalManager] scheduledAppointmentsForDay:_date];
369 events = [[StoreManager globalManager] visibleAppointmentsForDay:_date];
363370 enumerator = [[self subviews] objectEnumerator];
364371 while ((aptv = [enumerator nextObject])) {
365372 if (![events containsObject:[aptv appointment]] || ![[[aptv appointment] store] displayed]) {
1313 ICAL_CLASS_NONE = 10010
1414 */
1515
16 @class SAAlarm;
16 @class Alarm;
1717
1818 @interface Element : NSObject <NSCoding>
1919 {
4545
4646 - (BOOL)hasAlarms;
4747 - (NSArray *)alarms;
48 - (void)addAlarm:(SAAlarm *)alarm;
49 - (void)removeAlarm:(SAAlarm *)alarm;
48 - (void)setAlarms:(NSArray *)alarms;
49 - (void)addAlarm:(Alarm *)alarm;
50 - (void)removeAlarm:(Alarm *)alarm;
51 - (Date *)nextActivationDate;
5052
5153 - (NSArray *)categories;
5254 - (void)setCategories:(NSArray *)categories;
00 #import <Foundation/Foundation.h>
11 #import "Date.h"
22 #import "Element.h"
3 #import "SAAlarm.h"
3 #import "Alarm.h"
44 #import "NSString+SimpleAgenda.h"
55
66 @implementation Element
77 - (void)encodeWithCoder:(NSCoder *)coder
88 {
99 [coder encodeObject:_summary forKey:@"title"];
10 [coder encodeObject:[_text string] forKey:@"descriptionText"];
10 if (_text)
11 [coder encodeObject:[_text string] forKey:@"descriptionText"];
1112 [coder encodeObject:_uid forKey:@"uid"];
1213 [coder encodeInt:_classification forKey:@"classification"];
1314 if (_stamp)
1415 [coder encodeObject:_stamp forKey:@"dtstamp"];
1516 [coder encodeObject:_categories forKey:@"categories"];
17 [coder encodeObject:_alarms forKey:@"alarms"];
1618 }
1719
1820 - (id)initWithCoder:(NSCoder *)coder
1921 {
2022 _summary = [[coder decodeObjectForKey:@"title"] retain];
21 _text = [[NSAttributedString alloc] initWithString:[coder decodeObjectForKey:@"descriptionText"]];
23 if ([coder containsValueForKey:@"descriptionText"])
24 _text = [[NSAttributedString alloc] initWithString:[coder decodeObjectForKey:@"descriptionText"]];
25 else
26 _text = nil;
2227 if ([coder containsValueForKey:@"uid"])
2328 _uid = [[coder decodeObjectForKey:@"uid"] retain];
2429 else
3540 _categories = [[coder decodeObjectForKey:@"categories"] retain];
3641 else
3742 _categories = [NSMutableArray new];
43 [self setAlarms:[coder decodeObjectForKey:@"alarms"]];
3844 return self;
3945 }
4046
4147 - (id)init
4248 {
43 self = [super init];
44 if (self) {
45 _alarms = [NSMutableArray new];
46 _categories = [NSMutableArray new];
47 _classification = ICAL_CLASS_PUBLIC;
48 ASSIGNCOPY(_stamp, [Date now]);
49 }
49 if (!(self = [super init]))
50 return nil;
51 _alarms = [NSMutableArray new];
52 _categories = [NSMutableArray new];
53 _classification = ICAL_CLASS_PUBLIC;
54 _text = nil;
55 ASSIGNCOPY(_stamp, [Date now]);
5056 return self;
5157 }
5258
150156 return [NSArray arrayWithArray:_alarms];
151157 }
152158
153 - (void)addAlarm:(SAAlarm *)alarm
159 - (void)setAlarms:(NSArray *)alarms
160 {
161 NSEnumerator *enumerator;
162 Alarm *alarm;
163
164 DESTROY(_alarms);
165 ASSIGNCOPY(_alarms, alarms);
166 enumerator = [_alarms objectEnumerator];
167 while ((alarm = [enumerator nextObject]))
168 [alarm setElement:self];
169 }
170
171 - (void)addAlarm:(Alarm *)alarm
154172 {
155173 [alarm setElement:self];
156174 [_alarms addObject:alarm];
157175 }
158176
159 - (void)removeAlarm:(SAAlarm *)alarm
177 - (void)removeAlarm:(Alarm *)alarm
160178 {
161179 /* FIXME : do something */
180 }
181
182 - (Date *)nextActivationDate
183 {
184 return nil;
162185 }
163186
164187 - (NSArray *)categories
187210 - (id)initWithICalComponent:(icalcomponent *)ic
188211 {
189212 icalproperty *prop;
213 icalcomponent *subc;
214 Alarm *alarm;
190215
191216 self = [self init];
192217 if (self == nil)
215240 prop = icalcomponent_get_first_property(ic, ICAL_CATEGORIES_PROPERTY);
216241 if (prop)
217242 [self setCategories:[[NSString stringWithUTF8String:icalproperty_get_categories(prop)] componentsSeparatedByString:@","]];
243
244 subc = icalcomponent_get_first_component(ic, ICAL_VALARM_COMPONENT);
245 for (; subc != NULL; subc = icalcomponent_get_next_component(ic, ICAL_VALARM_COMPONENT)) {
246 alarm = [[Alarm alloc] initWithICalComponent:subc];
247 if (alarm) {
248 [self addAlarm:alarm];
249 RELEASE(alarm);
250 }
251 }
218252 return self;
253
219254 init_error:
220255 NSLog(@"Error creating Element from iCal component");
221256 [self release];
238273
239274 - (void)deleteProperty:(icalproperty_kind)kind fromComponent:(icalcomponent *)ic
240275 {
241 icalproperty *prop;
242 prop = icalcomponent_get_first_property(ic, kind);
276 icalproperty *prop = icalcomponent_get_first_property(ic, kind);
243277 if (prop)
244278 icalcomponent_remove_property(ic, prop);
245279 }
246280
247281 - (BOOL)updateICalComponent:(icalcomponent *)ic
248282 {
283 NSEnumerator *enumerator;
284 Alarm *alarm;
285 icalcomponent *subc;
286
249287 [self deleteProperty:ICAL_UID_PROPERTY fromComponent:ic];
250288 icalcomponent_add_property(ic, icalproperty_new_uid([[self UID] cString]));
251289 [self deleteProperty:ICAL_SUMMARY_PROPERTY fromComponent:ic];
255293 if ([self text])
256294 icalcomponent_add_property(ic, icalproperty_new_description([[[self text] string] UTF8String]));
257295 [self deleteProperty:ICAL_DTSTAMP_PROPERTY fromComponent:ic];
258 icalcomponent_add_property(ic, icalproperty_new_dtstamp([_stamp iCalTime]));
296 icalcomponent_add_property(ic, icalproperty_new_dtstamp([_stamp UTCICalTime]));
259297 [self deleteProperty:ICAL_CLASS_PROPERTY fromComponent:ic];
260298 icalcomponent_add_property(ic, icalproperty_new_class([self classification]));
261299 [self deleteProperty:ICAL_CATEGORIES_PROPERTY fromComponent:ic];
262300 icalcomponent_add_property(ic, icalproperty_new_categories([[[self categories] componentsJoinedByString:@","] UTF8String]));
301
302 subc = icalcomponent_get_first_component(ic, ICAL_VALARM_COMPONENT);
303 for (; subc != NULL; subc = icalcomponent_get_next_component(ic, ICAL_VALARM_COMPONENT))
304 icalcomponent_remove_component(ic, subc);
305 enumerator = [[self alarms] objectEnumerator];
306 while ((alarm = [enumerator nextObject])) {
307 subc = [alarm asICalComponent];
308 icalcomponent_add_component(ic, subc);
309 icalcomponent_free(subc);
310 }
263311 return YES;
264312 }
265313
00 #import <Foundation/Foundation.h>
1 #import <string.h>
12 #import "Event.h"
23 #import "DateRange.h"
34
7879 break;
7980 }
8081 return NSMakeRange(0, 0);
82 }
83
84 - (Date *)nextActivationDate
85 {
86 if (!_rrule)
87 return _startDate;
88 return nil;
8189 }
8290
8391 - (NSString *)location
226234 return nil;
227235 }
228236
229 - (icalcomponent *)asICalComponent
230 {
231 icalcomponent *ic = icalcomponent_new(ICAL_VEVENT_COMPONENT);
232 if (!ic) {
233 NSLog(@"Couldn't create iCalendar component");
234 return NULL;
235 }
236 if (![self updateICalComponent:ic]) {
237 icalcomponent_free(ic);
238 return NULL;
239 }
240 return ic;
241 }
242
243237 - (BOOL)updateICalComponent:(icalcomponent *)ic
244238 {
245239 Date *end;
253247 icalcomponent_add_property(ic, icalproperty_new_location([[self location] UTF8String]));
254248
255249 [self deleteProperty:ICAL_DTSTART_PROPERTY fromComponent:ic];
256 icalcomponent_add_property(ic, icalproperty_new_dtstart([_startDate iCalTime]));
250 icalcomponent_add_property(ic, icalproperty_new_dtstart([_startDate UTCICalTime]));
257251
258252 [self deleteProperty:ICAL_DTEND_PROPERTY fromComponent:ic];
259253 [self deleteProperty:ICAL_DURATION_PROPERTY fromComponent:ic];
260254 if (![self allDay])
261 icalcomponent_add_property(ic, icalproperty_new_dtend(icaltime_add([_startDate iCalTime], icaldurationtype_from_int(_duration * 60))));
255 icalcomponent_add_property(ic, icalproperty_new_dtend(icaltime_add([_startDate UTCICalTime], icaldurationtype_from_int(_duration * 60))));
262256 else {
263257 end = [_startDate copy];
264258 [end incrementDay];
265 icalcomponent_add_property(ic, icalproperty_new_dtend([end iCalTime]));
259 icalcomponent_add_property(ic, icalproperty_new_dtend([end UTCICalTime]));
266260 [end release];
267261 /* OGo workaround ? */
268262 prop = icalcomponent_get_first_property(ic, ICAL_X_PROPERTY);
00 /***
11 French.lproj/Localizable.strings
2 updated by make_strings 2010-03-11 10:46:44 +0100
2 updated by make_strings 2011-01-28 11:25:26 +0100
33 add comments above this one
44 ***/
55
66
77 /*** Keys found in multiple places ***/
88
9 /* File: DayView.m:42 */
10 /* File: WeekView.m:32 */
9 /* File: DayView.m:43 */
10 /* File: WeekView.m:33 */
1111 "All day : %@" = "Toute la journ\U00E9e : %@";
12
13 /* File: Alarm.m:271 */
14 /* File: SAAlarm.m:271 */
15 /* Flag: unmatched */
16 "Trigger %@ after the event"
17 = "Se d\U00E9clenche %@ apr\U00E8s l'\U00E9v\U00E9nement";
18
19 /* File: Alarm.m:272 */
20 /* File: SAAlarm.m:272 */
21 /* Flag: unmatched */
22 "Trigger %@ before the event"
23 = "Se d\U00E9clenche %@ avant l'\U00E9v\U00E9nement";
24
25 /* File: Alarm.m:268 */
26 /* File: SAAlarm.m:268 */
27 /* Flag: unmatched */
28 "Trigger on %@" = "Se d\U00E9clenche le %@";
1229
1330
1431 /*** Strings from ABStore.m ***/
1532 /* File: ABStore.m:58 */
1633 "Birthday" = "Anniversaire";
1734 /* File: ABStore.m:29 */
18 "my address book" = "mon carnet d'adresses";
35 "My address book" = "Mon carnet d'adresses";
36
37
38 /*** Strings from AlarmEditor.m ***/
39 /* File: AlarmEditor.m:75 */
40 "Absolute" = "Absolue";
41 /* File: AlarmEditor.m:77 */
42 "Display" = "Affichage";
43 /* File: AlarmEditor.m:77 */
44 "Email" = "Email";
45 /* File: AlarmEditor.m:77 */
46 "Procedure" = "Action";
47 /* File: AlarmEditor.m:75 */
48 "Relative" = "Relative";
49 /* File: AlarmEditor.m:77 */
50 "Sound" = "Son";
1951
2052
2153 /*** Strings from AppController.m ***/
22 /* File: AppController.m:406 */
54 /* File: AppController.m:475 */
2355 "Export as" = "Exporter sous";
24 /* File: AppController.m:363 */
56 /* File: AppController.m:432 */
2557 "New task" = "Nouvelle t\U00E2che";
26 /* File: AppController.m:82 */
58 /* File: AppController.m:155 */
2759 "Open tasks" = "T\U00E2ches en cours";
28 /* File: AppController.m:155 */
60 /* File: AppController.m:230 */
2961 "Open tasks (%d)" = "T\U00E2ches en cours (%d)";
30 /* File: AppController.m:514 */
31 /* File: AppController.m:81 */
62 /* File: AppController.m:588 */
63 /* File: AppController.m:154 */
3264 "Search results" = "R\U00E9sultats recherche";
33 /* File: AppController.m:512 */
65 /* File: AppController.m:586 */
3466 "Search results (%d items)" = "R\U00E9sultats (%d \U00E9l\U00E9ments)";
35 /* File: AppController.m:80 */
67 /* File: AppController.m:153 */
3668 "Soon" = "Bient\U00F4t";
37 /* File: AppController.m:680 */
38 /* File: AppController.m:169 */
69 /* File: AppController.m:784 */
70 /* File: AppController.m:244 */
3971 "Tasks" = "T\U00E2ches";
40 /* File: AppController.m:78 */
72 /* File: AppController.m:151 */
4173 "Today" = "Aujourd'hui";
42 /* File: AppController.m:79 */
74 /* File: AppController.m:152 */
4375 "Tomorrow" = "Demain";
44 /* File: AppController.m:682 */
45 /* File: AppController.m:167 */
76 /* File: AppController.m:786 */
77 /* File: AppController.m:242 */
4678 "Week %d" = "Semaine %d";
47 /* File: AppController.m:339 */
79 /* File: AppController.m:408 */
4880 "edit summary..." = "modifier le r\U00E9sum\U00E9...";
49 /* File: AppController.m:715 */
50 /* File: AppController.m:331 */
81 /* File: AppController.m:400 */
82 /* File: AppController.m:819 */
5183 "edit title..." = "modifier le titre...";
84
85
86 /*** Strings from DBusBackend.m ***/
87 /* File: DBusBackend.m:84 */
88 "SimpleAgenda Reminder !" = "Rappel SimpleAgenda !";
5289
5390
5491 /*** Strings from Task.m ***/
5794 /* File: Task.m:30 */
5895 "Completed" = "Termin\U00E9";
5996 /* File: Task.m:30 */
97 "Needs action" = "En attente";
98 /* File: Task.m:30 */
6099 "None" = "Aucun";
61100 /* File: Task.m:30 */
62101 "Started" = "D\U00E9marr\U00E9";
33 #
44 # Application
55 #
6 VERSION = 0.41
6 VERSION = 0.42.2
77 PACKAGE_NAME = SimpleAgenda
88 APP_NAME = SimpleAgenda
99 SimpleAgenda_APPLICATION_ICON = Calendar.tiff
2525 Resources/1left.tiff \
2626 Resources/1right.tiff \
2727 Resources/2left.tiff \
28 Resources/2right.tiff
28 Resources/2right.tiff \
29 Resources/bell.tiff \
30 Resources/small-bell.tiff
2931
3032 SimpleAgenda_LANGUAGES = English French
3133
6163 RecurrenceRule.m \
6264 NSColor+SimpleAgenda.m \
6365 DateRange.m \
64 SAAlarm.m \
66 Alarm.m \
6567 AlarmManager.m \
6668 NSString+SimpleAgenda.m \
67 AlarmEditor.m
69 AlarmEditor.m \
70 SoundBackend.m
6871
6972 ifeq ($(ADDRESSES),yes)
7073 SimpleAgenda_OBJC_FILES += ABStore.m
74 endif
75
76 ifeq ($(DBUSKIT),yes)
77 SimpleAgenda_OBJC_FILES += DBusBackend.m
7178 endif
7279
7380 #
1111 ADDITIONAL_CFLAGS +=
1212
1313 # Additional flags to pass to the linker
14 ADDITIONAL_LDFLAGS += -lical
14 ADDITIONAL_TOOL_LIBS += -lical
1515 ifeq ($(LIBUUID),yes)
16 ADDITIONAL_LDFLAGS += -luuid
16 ADDITIONAL_TOOL_LIBS += -luuid
1717 endif
1818 ifeq ($(ADDRESSES),yes)
19 ADDITIONAL_LDFLAGS += -lAddresses
19 ADDITIONAL_TOOL_LIBS += -lAddresses
20 endif
21 ifeq ($(DBUSKIT),yes)
22 ADDITIONAL_TOOL_LIBS += -lDBusKit
2023 endif
2124
2225 # Additional include directories the compiler should search
66 #import "iCalTree.h"
77 #import "defines.h"
88
9 @interface GroupDAVStore : MemoryStore <AgendaStore>
9 @interface GroupDAVStore : MemoryStore <AgendaStore, ConfigListener>
1010 {
1111 NSURL *_url;
1212 WebDAVResource *_calendar;
109109 set = (GSXPathNodeSet *)[xpc evaluateExpression:@"//response[propstat/prop/resourcetype/vtodo-collection]/href/text()"];
110110 for (i = 0; i < [set count]; i++)
111111 [task addItemWithTitle:[[set nodeAtIndex:i] content]];
112 [xpc release];
112 RELEASE(xpc);
113 if ([calendar numberOfItems] > 0)
114 [calendar selectItemAtIndex:1];
115 if ([task numberOfItems] > 0)
116 [task selectItemAtIndex:1];
113117 }
114118 }
115119 [resource release];
144148 @implementation GroupDAVStore
145149 - (NSDictionary *)defaults
146150 {
147 return [NSDictionary dictionaryWithObjectsAndKeys:[[NSColor blueColor] description], ST_COLOR,
148 [[NSColor darkGrayColor] description], ST_TEXT_COLOR,
151 return [NSDictionary dictionaryWithObjectsAndKeys:[[NSColor redColor] description], ST_COLOR,
152 [[NSColor whiteColor] description], ST_TEXT_COLOR,
149153 [NSNumber numberWithBool:NO], ST_RW,
150154 [NSNumber numberWithBool:YES], ST_DISPLAY,
151155 [NSNumber numberWithBool:YES], ST_ENABLED,
161165 _hrefresource = [[NSMutableDictionary alloc] initWithCapacity:512];
162166 _modifiedhref = [NSMutableArray new];
163167 _loadedData = [[NSMutableSet alloc] initWithCapacity:512];
168 [_config registerClient:self forKey:ST_REFRESH];
169 [_config registerClient:self forKey:ST_REFRESH_INTERVAL];
170 [_config registerClient:self forKey:ST_ENABLED];
164171 [NSThread detachNewThreadSelector:@selector(initStoreAsync:) toTarget:self withObject:nil];
165172 [self initTimer];
166173 }
188195 if ([dialog task])
189196 taskURL = [NSURL URLWithString:[dialog task] possiblyRelativeToURL:baseURL];
190197 [dialog release];
191 cm = [[ConfigManager alloc] initForKey:name withParent:nil];
198 cm = [[ConfigManager alloc] initForKey:name];
192199 [cm setObject:[dialog url] forKey:ST_URL];
193200 if (calendarURL)
194 [cm setObject:[calendarURL description] forKey:ST_CALENDAR_URL];
201 [cm setObject:[calendarURL absoluteString] forKey:ST_CALENDAR_URL];
195202 if (taskURL)
196 [cm setObject:[taskURL description] forKey:ST_TASK_URL];
203 [cm setObject:[taskURL absoluteString] forKey:ST_TASK_URL];
197204 [cm setObject:[[self class] description] forKey:ST_CLASS];
198205 [cm setObject:[NSNumber numberWithBool:YES] forKey:ST_RW];
199206 return YES;
204211
205212 + (NSString *)storeTypeName
206213 {
207 return @"GroupDAV store";
214 return @"GroupDAV";
208215 }
209216
210217 - (void)dealloc
245252 /* Reloading all data is a way to handle href and uid modification done by the server */
246253 [self fetchData];
247254 else
248 NSLog(@"Error %d writing event to %@", [resource httpStatus], [url absoluteString]);
255 NSLog(@"Error %d writing event to %@", [resource httpStatus], [url anonymousAbsoluteString]);
249256 }
250257 [tree release];
251258 [resource release];
312319 [copy release];
313320 return YES;
314321 }
322
323 - (void)config:(ConfigManager *)config dataDidChangedForKey:(NSString *)key
324 {
325 if (config == _config && [key isEqualToString:ST_ENABLED] && [self enabled]) {
326 [self read];
327 [self initTimer];
328 }
329 }
315330 @end
316331
317332
339354 if (elementURL)
340355 [result addObject:[elementURL absoluteString]];
341356 }
342 [xpc release];
357 RELEASE(xpc);
343358 }
344359 return result;
345360 }
389404 }
390405 - (void)fetchData
391406 {
407 if (![self enabled])
408 return;
392409 [_loadedData removeAllObjects];
393410 if (_calendar)
394411 [self fetchList:[self itemsUnderRessource:_calendar]];
400417 else
401418 [self performSelectorOnMainThread:@selector(fillWithElements:) withObject:_loadedData waitUntilDone:YES];
402419 }
403 NSLog(@"GroupDAVStore from %@ : loaded %d appointment(s)", [_url absoluteString], [[self events] count]);
404 NSLog(@"GroupDAVStore from %@ : loaded %d tasks(s)", [_url absoluteString], [[self tasks] count]);
405 }
406 @end
420 NSLog(@"GroupDAVStore from %@ : loaded %d appointment(s)", [_url anonymousAbsoluteString], [[self events] count]);
421 NSLog(@"GroupDAVStore from %@ : loaded %d tasks(s)", [_url anonymousAbsoluteString], [[self tasks] count]);
422 }
423 @end
22 #import <Foundation/Foundation.h>
33
44 @interface HourFormatter : NSFormatter
5 + (NSString *)stringForObjectValue:(id)anObject;
56 @end
22 #import "HourFormatter.h"
33
44 @implementation HourFormatter
5 + (NSString *)stringForObjectValue:(id)anObject
6 {
7 int hours;
8 int minutes;
9
10 if (![anObject isKindOfClass:[NSNumber class]])
11 return nil;
12 hours = [anObject intValue] / 3600;
13 minutes = [anObject intValue] / 60 - hours * 60;
14 return [NSString stringWithFormat:@"%dh%02d", hours, minutes];
15 }
516
617 - (NSString *)stringForObjectValue:(id)anObject
718 {
8 if (![anObject isKindOfClass:[NSNumber class]])
9 return nil;
10 int m = ([anObject floatValue] - [anObject intValue]) * 100;
11 return [NSString stringWithFormat:@"%dh%02d", [anObject intValue], 60 * m / 100];
19 return [HourFormatter stringForObjectValue:anObject];
1220 }
1321
1422 - (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string errorDescription:(NSString **)error
1523 {
16 return NO;
24 NSNumberFormatter *nf;
25 NSNumber *hours;
26 NSNumber *minutes;
27 NSArray *components = [string componentsSeparatedByString:@"h"];
28
29 if (!components || [components count] != 2) {
30 if (error)
31 *error = [[NSError alloc] initWithDomain:@"Bad time formatting : cannot find hours and minutes separated by h" code:1 userInfo:nil];
32 else
33 NSLog(@"Bad time formatting : cannot find hours and minutes separated by h");
34 return NO;
35 }
36 nf = AUTORELEASE([[NSNumberFormatter alloc] init]);
37 hours = [nf numberFromString:[components objectAtIndex:0]];
38 minutes = [nf numberFromString:[components objectAtIndex:1]];
39 if (!hours || !minutes) {
40 if (error)
41 *error = [[NSError alloc] initWithDomain:@"Bad time formatting" code:2 userInfo:nil];
42 else
43 NSLog(@"Bad time formatting");
44 return NO;
45 }
46 if ([hours intValue] < 0 || [hours intValue] > 23) {
47 if (error)
48 *error = [[NSError alloc] initWithDomain:@"Hours must be between 0 and 23" code:3 userInfo:nil];
49 else
50 NSLog(@"Hours must be between 0 and 23");
51 return NO;
52 }
53 if ([minutes intValue] < 0 || [minutes intValue] > 59) {
54 if (error)
55 *error = [[NSError alloc] initWithDomain:@"Minutes must be between 0 and 59" code:4 userInfo:nil];
56 else
57 NSLog(@"Minutes must be between 0 and 59");
58 return NO;
59 }
60 *anObject = [[NSNumber alloc] initWithInt:[hours intValue] * 3600 + [minutes intValue] * 60.0];
61 return YES;
1762 }
1863
1964 - (NSAttributedString *)attributedStringForObjectValue:(id)anObject withDefaultAttributes:(NSDictionary *)attributes
2065 {
2166 return nil;
2267 }
23
2468 @end
4444 {
4545 ConfigManager *cm;
4646
47 cm = [[ConfigManager alloc] initForKey:name withParent:nil];
47 cm = [[ConfigManager alloc] initForKey:name];
4848 [cm setObject:[name copy] forKey:ST_FILE];
4949 [cm setObject:[[self class] description] forKey:ST_CLASS];
5050 [cm release];
5353
5454 + (NSString *)storeTypeName
5555 {
56 return @"Simple file store";
56 return @"Local file";
5757 }
5858
5959 - (void)dealloc
2121 self = [super init];
2222 if (self) {
2323 _name = [name copy];
24 _config = [[ConfigManager alloc] initForKey:name withParent:nil];
24 _config = [[ConfigManager alloc] initForKey:name];
2525 /*
2626 * Don't remove this even if it's seems silly : it will
2727 * call the subclass's -defaults method which will have
0 version 0.42.2 (2012/02/02)
1 * Bug fix backport from trunk : 'Reload all' wouldn't work if ABStore
2 was compiled in
3
4 version 0.42.1 (2012/01/29)
5 * Bug fixes backport from trunk (store removal and element encoding)
6
7 version 0.42 (2011/04/27)
8 * Bug fixes and code cleanups
9 * Handle read only stores when cut & pasting elements
10 * Simple reminders/alarms handling with multiple backends
11 * Alarm editor for events and tasks with basic functionalities
12 * New images from OpenClipArt (bell_gold.svg)
13 * Fix ticket #12 : timezone problems with recurrent events
14 * Use calendar instead of store and agenda in the ui
15 * Handle due date in tasks
16 * Fix URL handling for GroupDAV calendars, tested against
17 Citadel and OGO
18 * Enable copy/paste on multiple elements (select with control key)
19 * Don't write authentication informations on the stdout (see ticket #17)
20
021 version 0.41 (2010/03/15)
122 * Threads/memory pools/notifications fixes
223 * Fix silly bugs in the makefile when using conditions : we
00 /* emacs buffer mode hint -*- objc -*- */
11
2 #import <AppKit/AppKit.h>
2 #import <AppKit/NSColor.h>
3
4 /*
5 * This method is available but not defined. Avoid
6 * a compilation warning by declaring it here.
7 */
8 @interface NSColor(NotDefinedMethods)
9 + (NSColor *)colorFromString:(NSString *)string;
10 @end
311
412 @interface NSColor(SimpleAgenda)
513 - (NSColor *)colorModifiedWithDeltaRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;
3535 IBOutlet id uiPreferences;
3636 IBOutlet id showDateAppIcon;
3737 IBOutlet id showTimeAppIcon;
38 IBOutlet id alarmPreferences;
39 IBOutlet id alarmEnabled;
40 IBOutlet id alarmBackendPopUp;
3841 StoreManager *_sm;
3942 }
4043
5760 - (void)toggleTooltip:(id)sender;
5861 - (void)toggleShowDate:(id)sender;
5962 - (void)toggleShowTime:(id)sender;
63 - (void)toggleAlarms:(id)sender;
64 - (void)selectAlarmBackend:(id)sender;
6065 @end
22 #import "PreferencesController.h"
33 #import "HourFormatter.h"
44 #import "ConfigManager.h"
5 #import "AlarmManager.h"
6 #import "AlarmBackend.h"
57 #import "defines.h"
68
79 @implementation PreferencesController
2123 RETAIN(globalPreferences);
2224 RETAIN(storePreferences);
2325 RETAIN(storeFactory);
26 RETAIN(uiPreferences);
27 RETAIN(alarmPreferences);
2428 [self selectItem:itemPopUp];
2529 [panel setFrameAutosaveName:@"preferencesPanel"];
2630 /* FIXME : could we call setupDefaultStore directly ? */
4145 RELEASE(globalPreferences);
4246 RELEASE(storePreferences);
4347 RELEASE(storeFactory);
48 RELEASE(uiPreferences);
49 RELEASE(alarmPreferences);
4450 [super dealloc];
4551 }
4652
8692
8793 - (void)showPreferences
8894 {
89 NSEnumerator *backends = [[StoreManager backends] objectEnumerator];
9095 ConfigManager *config = [ConfigManager globalConfig];
96 NSEnumerator *backends;
9197 int start = [config integerForKey:FIRST_HOUR];
9298 int end = [config integerForKey:LAST_HOUR];
9399 int step = [config integerForKey:MIN_STEP];
94100 Class backend;
95
96 [dayStart setIntValue:start];
97 [dayEnd setIntValue:end];
98 [dayStartText setIntValue:start];
99 [dayEndText setIntValue:end];
100 [minStep setDoubleValue:step/60.0];
101 [minStepText setDoubleValue:step/60.0];
101 NSString *name;
102
103 [dayStart setIntValue:start*3600];
104 [dayEnd setIntValue:end*3600];
105 [dayStartText setIntValue:start*3600];
106 [dayEndText setIntValue:end*3600];
107 [minStep setIntValue:step * 60];
108 [minStepText setIntValue:step * 60];
102109 [showTooltip setState:[config integerForKey:TOOLTIP]];
103110 [showDateAppIcon setState:[config integerForKey:APPICON_DATE]];
104111 [showTimeAppIcon setState:[config integerForKey:APPICON_TIME]];
105112
113 [alarmEnabled setState:[[AlarmManager globalManager] alarmsEnabled]];
114 [alarmBackendPopUp removeAllItems];
115 backends = [[AlarmManager backends] objectEnumerator];
116 while ((backend = [backends nextObject]))
117 [alarmBackendPopUp addItemWithTitle:[[backend class] backendName]];
118
119 name = [[AlarmManager globalManager] defaultBackendName];
120 if ([alarmBackendPopUp itemWithTitle:name])
121 [alarmBackendPopUp selectItemWithTitle:name];
122
106123 [self setupStores];
107124 [storeClass removeAllItems];
125 backends = [[StoreManager backends] objectEnumerator];
108126 while ((backend = [backends nextObject]))
109127 if ([backend isUserInstanciable])
110128 [storeClass addItemWithTitle:[backend storeTypeName]];
121139 [storeRefresh setState:[store periodicRefresh]];
122140 [refreshInterval setEnabled:[store periodicRefresh]];
123141 [refreshIntervalText setEnabled:[store periodicRefresh]];
124 [refreshIntervalText setDoubleValue:[store refreshInterval]/3600.0];
125 [refreshInterval setDoubleValue:[store refreshInterval]/3600.0];
142 [refreshIntervalText setIntValue:[store refreshInterval]];
143 [refreshInterval setIntValue:[store refreshInterval]];
126144 } else {
127145 [storeRefresh setEnabled:NO];
128146 [storeRefresh setState:NO];
129147 [refreshInterval setEnabled:NO];
130148 [refreshIntervalText setEnabled:NO];
131 [refreshIntervalText setDoubleValue:0];
132 [refreshInterval setDoubleValue:0];
149 [refreshIntervalText setIntValue:0];
150 [refreshInterval setIntValue:0];
133151 }
134152 }
135153
164182
165183 - (void)changeStart:(id)sender
166184 {
167 int value = [dayStart intValue];
185 int value = [dayStart intValue] / 3600;
168186 if (value != [[ConfigManager globalConfig] integerForKey:FIRST_HOUR]) {
169 [dayStartText setIntValue:value];
187 [dayStartText setIntValue:value * 3600];
170188 [[ConfigManager globalConfig] setInteger:value forKey:FIRST_HOUR];
171189 }
172190 }
173191
174192 - (void)changeEnd:(id)sender
175193 {
176 int value = [dayEnd intValue];
194 int value = [dayEnd intValue] / 3600;
177195 if (value != [[ConfigManager globalConfig] integerForKey:LAST_HOUR]) {
178 [dayEndText setIntValue:value];
196 [dayEndText setIntValue:value * 3600];
179197 [[ConfigManager globalConfig] setInteger:value forKey:LAST_HOUR];
180198 }
181199 }
182200
183201 - (void)changeStep:(id)sender
184202 {
185 double value = [minStep doubleValue];
186 if (value * 60 != [[ConfigManager globalConfig] integerForKey:MIN_STEP]) {
187 [minStepText setDoubleValue:value];
188 [[ConfigManager globalConfig] setInteger:value * 60 forKey:MIN_STEP];
203 int value = [minStep intValue] / 60;
204 if (value != [[ConfigManager globalConfig] integerForKey:MIN_STEP]) {
205 [minStepText setIntValue:value * 60];
206 [[ConfigManager globalConfig] setInteger:value forKey:MIN_STEP];
189207 }
190208 }
191209
192210 - (void)changeInterval:(id)sender
193211 {
194 double value = [refreshInterval doubleValue];
212 int value = [refreshInterval intValue];
195213 id <PeriodicRefresh> store = (id <PeriodicRefresh>)[_sm storeForName:[storePopUp titleOfSelectedItem]];
196 [store setRefreshInterval:value * 3600];
197 [refreshIntervalText setDoubleValue:value];
198 [refreshInterval setDoubleValue:value];
214 [store setRefreshInterval:value];
215 [refreshIntervalText setIntValue:value];
216 [refreshInterval setIntValue:value];
199217 }
200218
201219 - (void)selectDefaultStore:(id)sender
244262 [[ConfigManager globalConfig] setInteger:[showTimeAppIcon state] forKey:APPICON_TIME];
245263 }
246264
265 - (void)toggleAlarms:(id)sender
266 {
267 [[AlarmManager globalManager] setAlarmsEnabled:[alarmEnabled state]];
268 }
269
270 - (void)selectAlarmBackend:(id)sender
271 {
272 [[AlarmManager globalManager] setDefaultBackend:[alarmBackendPopUp titleOfSelectedItem]];
273 }
274
247275 /* We only allow the removal of non-default stores */
248276 - (void)removeStore:(id)sender
249277 {
250278 id <AgendaStore> store = [_sm storeForName:[storePopUp titleOfSelectedItem]];
251279 ConfigManager *config = [ConfigManager globalConfig];
252 NSMutableArray *storeArray = [config objectForKey:STORES];
280 NSMutableArray *storeArray = [NSMutableArray arrayWithArray:[config objectForKey:STORES]];
253281
254282 [storeArray removeObject:[store description]];
255283 [config setObject:storeArray forKey:STORES];
276304 [createButton setEnabled:NO];
277305 }
278306
307 - (void)setContent:(id)content
308 {
309 id old = [slot contentView];
310
311 if (old == content)
312 return;
313 [slot setContentView: content];
314 [itemPopUp setNextKeyView:[slot contentView]];
315 }
316
317
279318 - (void)selectItem:(id)sender
280319 {
281320 switch ([sender indexOfSelectedItem]) {
282321 case 0:
283 [slot setContentView:globalPreferences];
322 [self setContent:globalPreferences];
284323 break;
285324 case 1:
286 [slot setContentView:storePreferences];
325 [self setContent:storePreferences];
287326 break;
288327 case 2:
289 [slot setContentView:storeFactory];
328 [self setContent:storeFactory];
290329 break;
291330 case 3:
292 [slot setContentView:uiPreferences];
293 break;
294 }
295 [itemPopUp setNextKeyView:[slot contentView]];
331 [self setContent:uiPreferences];
332 break;
333 case 4:
334 [self setContent:alarmPreferences];
335 break;
336 }
296337 }
297338
298339 - (void)controlTextDidChange:(NSNotification *)notification
1010 * create, resize and move appointments easily
1111 * export individual elements as files and to pasteboard
1212 * import .ics files
13 * simple text search
13 * simple text search
14 * alarms with multiples backends
1415
1516 Dependencies
1617 ============
1718
18 GNUstep Startup 0.19.0
19 libical 0.27
19 GNUstep stable version released on 2011/04/14
20 (make 2.6.0, base 1.22.0, gui 0.20.0, back 0.20.0)
21 libical 0.27 or later
2022 libuuid (optional)
23 Addresses framework (optional)
24 DBusKit 0.1 (optional)
2125
2226
2327 Website
99 @implementation DateRecurrenceEnumerator
1010 - (id)initWithRule:(RecurrenceRule *)rule start:(Date *)start;
1111 {
12 self = [super init];
13 /*
14 * It's OK to use Date iCaltime: here as timezone modifications
15 * only affect datetimes, not dates
16 */
17 if (self)
18 _iterator = icalrecur_iterator_new([rule iCalRRule], [start iCalTime]);
12 if ((self = [super init]))
13 _iterator = icalrecur_iterator_new([rule iCalRRule], [start localICalTime]);
1914 return self;
2015 }
2116 - (id)nextObject
4439 @implementation DateRangeRecurrenceEnumerator
4540 - (id)initWithRule:(RecurrenceRule *)rule start:(Date *)start length:(NSTimeInterval)length;
4641 {
47 self = [super init];
48 if (self) {
49 _iterator = icalrecur_iterator_new([rule iCalRRule], [start iCalTime]);
42 if ((self = [super init])) {
43 _iterator = icalrecur_iterator_new([rule iCalRRule], [start localICalTime]);
5044 _length = length;
5145 }
5246 return self;
8074 - (id)initWithFrequency:(recurrenceFrequency)frequency
8175 {
8276 NSAssert(frequency < recurrenceFrequenceOther, @"Wrong frequency");
83 self = [self init];
84 if (self)
77 if ((self = [self init]))
8578 recur.freq = frequency;
8679 return self;
8780 }
8982 {
9083 NSAssert(frequency < recurrenceFrequenceOther, @"Wrong frequency");
9184 NSAssert([endDate isDate], @"Works on dates");
92 self = [self init];
93 if (self) {
85 if ((self = [self init])) {
9486 /*
9587 * It's OK to use Date iCaltime: here as timezone modifications
9688 * only affect datetimes, not dates
9789 */
98 recur.until = [endDate iCalTime];
90 recur.until = [endDate UTCICalTime];
9991 recur.freq = frequency;
10092 }
10193 return self;
10395 - (id)initWithFrequency:(recurrenceFrequency)frequency count:(int)count
10496 {
10597 NSAssert(frequency < recurrenceFrequenceOther, @"Wrong frequency");
106 self = [self init];
107 if (self) {
98 if ((self = [self init])) {
10899 recur.count = count;
109100 recur.freq = frequency;
110101 }
144135 @implementation RecurrenceRule(iCalendar)
145136 - (id)initWithICalRRule:(struct icalrecurrencetype)rrule
146137 {
147 self = [super init];
148 if (self)
138 if ((self = [super init]))
149139 recur = rrule;
150140 return self;
151141 }
152142 - (id)initWithICalString:(NSString *)rrule
153143 {
154 self = [super init];
155 if (self)
144 if ((self = [super init]))
156145 recur = icalrecurrencetype_from_string([rrule cString]);
157146 return self;
158147 }
11 "## Comment" = "Do NOT change this file, Gorm maintains it";
22 AlarmEditor = {
33 Actions = (
4 "addAlarm:",
5 "selectType:",
6 "removeAlarm:",
7 "changeDelay:",
8 "switchBeforeAfter:"
49 );
510 Outlets = (
611 panel,
7 calendar,
812 type,
9 action
13 action,
14 window,
15 table,
16 add,
17 remove,
18 relativeSlider,
19 relativeText,
20 radio,
21 date,
22 time
1023 );
1124 Super = NSObject;
1225 };
2235 };
2336 FirstResponder = {
2437 Actions = (
25 "setDelegate:"
38 "addAlarm:",
39 "changeDelay:",
40 "removeAlarm:",
41 "selectType:",
42 "setDelegate:",
43 "switchBeforeAfter:"
2644 );
2745 Super = NSObject;
2846 };
55 "validate:",
66 "selectFrequency:",
77 "toggleUntil:",
8 "toggleAllDay:"
8 "toggleAllDay:",
9 "editAlarms:"
910 );
1011 Outlets = (
1112 description,
2627 };
2728 FirstResponder = {
2829 Actions = (
30 "editAlarms:",
31 "selectFrequency:",
2932 "toggleAllDay:",
30 "selectFrequency:",
3133 "toggleUntil:",
3234 "validate:"
3335 );
Binary diff not shown
66 "changeStart:",
77 "changeStep:",
88 "createStore:",
9 "toggleEnabled:",
9 "selectAlarmBackend:",
1010 "removeStore:",
1111 "selectDefaultStore:",
1212 "selectItem:",
1313 "selectStore:",
1414 "setColor:",
15 "toggleAlarms:",
1516 "toggleDisplay:",
17 "toggleEnabled:",
1618 "toggleRefresh:",
1719 "toggleShowDate:",
1820 "toggleShowTime:",
4042 "toggleTooltip:",
4143 "toggleShowTime:",
4244 "toggleShowDate:",
43 "toggleEnabled:"
45 "toggleEnabled:",
46 "toggleAlarms:",
47 "selectAlarmBackend:"
4448 );
4549 Outlets = (
4650 panel,
7276 showTimeAppIcon,
7377 showDateAppIcon,
7478 uiPreferences,
75 storeEnabled
79 storeEnabled,
80 alarmPreferences,
81 alarmEnabled,
82 alarmBackendPopUp
7683 );
7784 Super = NSObject;
7885 };
11 "## Comment" = "Do NOT change this file, Gorm maintains it";
22 FirstResponder = {
33 Actions = (
4 "editAlarms:",
5 "toggleDueDate:",
46 "validate:"
57 );
68 Super = NSObject;
810 TaskEditor = {
911 Actions = (
1012 "validate:",
11 "cancel:"
13 "cancel:",
14 "editAlarms:",
15 "toggleDueDate:"
1216 );
1317 Outlets = (
1418 window,
1620 summary,
1721 store,
1822 state,
19 ok
23 ok,
24 dueDate,
25 dueTime,
26 toggleDueDate,
27 alarms
2028 );
2129 Super = NSObject;
2230 };
Binary diff not shown
1010 Actions = (
1111 );
1212 Outlets = (
13 _delegate
13 "_delegate"
1414 );
1515 Super = NSObject;
1616 };
Binary diff not shown
+0
-47
SAAlarm.h less more
0 /* emacs buffer mode hint -*- objc -*- */
1
2 #import <Foundation/Foundation.h>
3
4 extern NSString * const SAActionDisplay;
5 extern NSString * const SAActionEmail;
6 extern NSString * const SAActionProcedure;
7 extern NSString * const SAActionSound;
8
9 @class Date;
10 @class Element;
11
12 @interface SAAlarm : NSObject
13 {
14 Date *_absoluteTrigger;
15 NSTimeInterval _relativeTrigger;
16 NSString *_action;
17 NSString *_emailaddress;
18 NSString *_sound;
19 NSURL *_url;
20 int _repeatCount;
21 NSTimeInterval _repeatInterval;
22 Element *_element;
23 }
24
25 + (id)alarm;
26 - (BOOL)isAbsoluteTrigger;
27 - (Date *)absoluteTrigger;
28 - (void)setAbsoluteTrigger:(Date *)trigger;
29 - (NSTimeInterval)relativeTrigger;
30 - (void)setRelativeTrigger:(NSTimeInterval)trigger;
31 - (NSString *)action;
32 - (void)setAction:(NSString *)action;
33 - (NSString *)emailAddress;
34 - (void)setEmailAddress:(NSString *)emailAddress;
35 - (NSString *)sound;
36 - (void)setSound:(NSString *)sound;
37 - (NSURL *)url;
38 - (void)setUrl:(NSURL *)url;
39 - (int)repeatCount;
40 - (void)setRepeatCount:(int)count;
41 - (NSTimeInterval)repeatInterval;
42 - (void)setRepeatInterval:(NSTimeInterval)interval;
43 - (Element *)element;
44 - (void)setElement:(Element *)element;
45 - (Date *)triggerDateRelativeTo:(Date *)date;
46 @end
+0
-156
SAAlarm.m less more
0 /* emacs buffer mode hint -*- objc -*- */
1
2 #import "SAAlarm.h"
3 #import "Date.h"
4
5 NSString * const SAActionDisplay = @"DISPLAY";
6 NSString * const SAActionEmail = @"EMAIL";
7 NSString * const SAActionProcedure = @"PROCEDURE";
8 NSString * const SAActionSound = @"AUDIO";
9
10 @implementation SAAlarm
11 - (void)dealloc
12 {
13 DESTROY(_absoluteTrigger);
14 DESTROY(_action);
15 DESTROY(_emailaddress);
16 DESTROY(_sound);
17 DESTROY(_url);
18 [super dealloc];
19 }
20
21 - (id)init
22 {
23 self = [super init];
24 _absoluteTrigger = nil;
25 _relativeTrigger = 0;
26 _emailaddress = nil;
27 _sound = nil;
28 _url = nil;
29 _element = nil;
30 return self;
31 }
32
33 + (id)alarm
34 {
35 return AUTORELEASE([[SAAlarm alloc] init]);
36 }
37
38 - (BOOL)isAbsoluteTrigger
39 {
40 return _absoluteTrigger != nil;
41 }
42
43 - (Date *)absoluteTrigger
44 {
45 return _absoluteTrigger;
46 }
47
48 - (void)setAbsoluteTrigger:(Date *)trigger
49 {
50 ASSIGNCOPY(_absoluteTrigger, trigger);
51 _relativeTrigger = 0;
52 }
53
54 - (NSTimeInterval)relativeTrigger
55 {
56 return _relativeTrigger;
57 }
58
59 - (void)setRelativeTrigger:(NSTimeInterval)trigger
60 {
61 _relativeTrigger = trigger;
62 DESTROY(_absoluteTrigger);
63 }
64
65 - (NSString *)action
66 {
67 return _action;
68 }
69
70 - (void)setAction:(NSString *)action
71 {
72 ASSIGN(_action, action);
73 }
74
75 - (NSString *)emailAddress
76 {
77 return _emailaddress;
78 }
79
80 - (void)setEmailAddress:(NSString *)emailAddress
81 {
82 ASSIGN(_emailaddress, emailAddress);
83 DESTROY(_sound);
84 DESTROY(_url);
85 [self setAction:SAActionEmail];
86 }
87
88 - (NSString *)sound
89 {
90 return _sound;
91 }
92
93 - (void)setSound:(NSString *)sound
94 {
95 ASSIGN(_sound, sound);
96 DESTROY(_emailaddress);
97 DESTROY(_url);
98 [self setAction:SAActionSound];
99 }
100
101 - (NSURL *)url
102 {
103 return _url;
104 }
105
106 - (void)setUrl:(NSURL *)url
107 {
108 ASSIGN(_url, url);
109 DESTROY(_emailaddress);
110 DESTROY(_sound);
111 [self setAction:SAActionProcedure];
112 }
113
114 - (int)repeatCount
115 {
116 return _repeatCount;
117 }
118
119 - (void)setRepeatCount:(int)count
120 {
121 _repeatCount = count;
122 }
123
124 - (NSTimeInterval)repeatInterval
125 {
126 return _repeatInterval;
127 }
128
129 - (void)setRepeatInterval:(NSTimeInterval)interval
130 {
131 _repeatInterval = interval;
132 }
133
134 - (Element *)element
135 {
136 return _element;
137 }
138
139 - (void)setElement:(Element *)element
140 {
141 _element = element;
142 }
143
144 - (Date *)triggerDateRelativeTo:(Date *)date
145 {
146 return [Date dateWithTimeInterval:_relativeTrigger sinceDate:date];
147 }
148
149 - (NSString *)description
150 {
151 if ([self isAbsoluteTrigger])
152 return [NSString stringWithFormat:@"Absolute trigger set to %@ repeat %d interval %f", [_absoluteTrigger description], _repeatCount, _repeatInterval];
153 return [NSString stringWithFormat:@"Relative trigger delay %f repeat %d interval %f", _relativeTrigger, _repeatCount, _repeatInterval];
154 }
155 @end
1616 + (SelectionManager *)globalManager;
1717 - (int)count;
1818 - (int)copiedCount;
19 - (void)add:(id)object;
20 - (void)set:(id)object;
19 - (void)select:(id)object;
2120 - (void)clear;
2221 - (id)lastObject;
2322 - (void)copySelection;
00 #import <Foundation/Foundation.h>
1 #import <AppKit/AppKit.h>
12 #import "SelectionManager.h"
23
34 static SelectionManager *singleton;
4344 return [_copyarea count];
4445 }
4546
46 - (void)add:(id)object
47 - (void)select:(id)object
4748 {
48 [_objects addObject:object];
49 }
50
51 - (void)set:(id)object
52 {
53 [_objects removeAllObjects];
54 [_objects addObject:object];
49 if (!([[NSApp currentEvent] modifierFlags] & NSControlKeyMask))
50 [_objects removeAllObjects];
51 if (![_objects containsObject:object])
52 [_objects addObject:object];
5553 }
5654
5755 - (void)clear
11 ApplicationDescription = "Simple agenda and calendar application";
22 ApplicationIcon = Calendar.tiff;
33 ApplicationName = SimpleAgenda;
4 ApplicationRelease = 0.41;
4 ApplicationRelease = 0.42.2;
55 Authors = (
66 "Philippe Roussel <p.o.roussel@free.fr>"
77 );
8 Copyright = "Copyright (C) 2007-2010";
8 Copyright = "Copyright (C) 2007-2012";
99 CopyrightDescription = "Released under GPL Version 2 or any later version";
10 FullVersionID = 0.41;
10 FullVersionID = 0.42.2;
1111 NSExecutable = SimpleAgenda;
1212 NSIcon = Calendar.tiff;
1313 NSMainNibFile = Agenda.gorm;
3030 );
3131 NSTypes = (
3232 {
33 NSDocumentClass = "";
34 NSHumanReadableName = "";
3533 NSIcon = "ical-file.tiff";
36 NSName = "";
37 NSRole = "";
3834 NSUnixExtensions = (
3935 ics
4036 );
0 #import <AppKit/NSSound.h>
1 #import "AlarmBackend.h"
2 #import "Alarm.h"
3
4 @interface SoundBackend : AlarmBackend
5 {
6 NSSound *sound;
7 }
8 @end
9
10 static NSMutableArray *sounds;
11
12 @implementation SoundBackend
13 + (void)initialize
14 {
15 NSFileManager *fm = [NSFileManager defaultManager];
16 NSString *path, *file;
17 NSArray *paths, *files;
18 NSEnumerator *enumerator, *fenum;
19
20 if ([SoundBackend class] == self) {
21 sounds = [[NSMutableArray alloc] initWithCapacity:8];
22 paths = NSStandardLibraryPaths();
23 enumerator = [paths objectEnumerator];
24 while ((path = [enumerator nextObject])) {
25 path = [path stringByAppendingPathComponent:@"/Sounds/"];
26 files = [fm directoryContentsAtPath:path];
27 if (files) {
28 fenum = [files objectEnumerator];
29 while ((file = [fenum nextObject])) {
30 if ([NSSound soundNamed:[file stringByDeletingPathExtension]])
31 [sounds addObject:[file stringByDeletingPathExtension]];
32 }
33 }
34 }
35 }
36 }
37
38 + (NSString *)backendName
39 {
40 return @"Sound notification";
41 }
42
43 - (enum icalproperty_action)backendType
44 {
45 return ICAL_ACTION_AUDIO;
46 }
47
48 - (id)init
49 {
50 self = [super init];
51 if (self) {
52 sound = [NSSound soundNamed:@"Basso"];
53 if (!sound) {
54 [self release];
55 self = nil;
56 }
57 }
58 return self;
59 }
60
61 - (void)display:(Alarm *)alarm
62 {
63 [sound play];
64 }
65 @end
88 @interface StoreManager : NSObject
99 {
1010 NSMutableDictionary *_stores;
11 NSMutableDictionary *_cache;
11 NSMutableDictionary *_dayEventsCache;
12 NSMutableArray *_eventCache;
1213 id _defaultStore;
1314 }
1415
2223 - (void)setDefaultStore:(NSString *)name;
2324 - (id <AgendaStore>)defaultStore;
2425 - (NSEnumerator *)storeEnumerator;
25 /* FIXME : add enabledStoreEnumerator ? */
2626 - (void)synchronise;
2727 - (void)refresh;
2828 - (id <AgendaStore>)storeContainingElement:(Element *)elt;
2929 - (NSArray *)allEvents;
3030 - (NSArray *)allTasks;
3131 - (NSSet *)scheduledAppointmentsForDay:(Date *)date;
32 - (NSSet *)visibleAppointmentsForDay:(Date *)date;
33 - (NSArray *)visibleTasks;
3234 @end
6767 ConfigManager *config = [ConfigManager globalConfig];
6868 id store;
6969
70 self = [super init];
71 if (self) {
70 if ((self = [super init])) {
7271 [config registerDefaults:[self defaults]];
7372 [[NSNotificationCenter defaultCenter] addObserver:self
7473 selector:@selector(dataChanged:)
9190 name:SAEnabledStatusChangedForStore
9291 object:nil];
9392 _stores = [[NSMutableDictionary alloc] initWithCapacity:1];
94 _cache = [[NSMutableDictionary alloc] initWithCapacity:256];
93 _dayEventsCache = [[NSMutableDictionary alloc] initWithCapacity:256];
94 _eventCache = [[NSMutableArray alloc] initWithCapacity:512];
9595 /* Create user defined stores */
9696 storeArray = [config objectForKey:STORES];
9797 defaultStore = [config objectForKey:ST_DEFAULT];
117117 [[NSNotificationCenter defaultCenter] removeObserver:self];
118118 [self synchronise];
119119 RELEASE(_defaultStore);
120 [_stores release];
121 [_cache release];
120 RELEASE(_stores);
121 RELEASE(_dayEventsCache);
122 RELEASE(_eventCache);
122123 [super dealloc];
123124 }
124125
125126 - (void)dataChanged:(NSNotification *)not
126127 {
127 [_cache removeAllObjects];
128 [_dayEventsCache removeAllObjects];
129 [_eventCache removeAllObjects];
128130 [[NSNotificationCenter defaultCenter] postNotificationName:SADataChangedInStoreManager object:self];
129131 }
130132
141143 if (store) {
142144 [_stores setObject:store forKey:name];
143145 NSLog(@"Added %@ to StoreManager", name);
144 } else
146 } else {
145147 NSLog(@"Unable to initialize store %@", name);
148 }
146149 }
147150 }
148151
193196 id <AgendaStore> store;
194197
195198 while ((store = [enumerator nextObject]))
196 [store read];
199 if ([store conformsToProtocol:@protocol(StoreBackend)])
200 [store read];
197201 }
198202
199203 - (id <AgendaStore>)storeContainingElement:(Element *)elt
209213
210214 - (NSArray *)allEvents
211215 {
212 NSMutableArray *all = [NSMutableArray arrayWithCapacity:128];
213 NSEnumerator *enumerator = [_stores objectEnumerator];
214 id <AgendaStore> store;
215
216 while ((store = [enumerator nextObject]))
217 if ([store enabled] && [store displayed])
218 [all addObjectsFromArray:[store events]];
216 NSEnumerator *enumerator;
217 id <AgendaStore> store;
218
219 if ([_eventCache count])
220 return _eventCache;
221 enumerator = [_stores objectEnumerator];
222 while ((store = [enumerator nextObject]))
223 if ([store enabled])
224 [_eventCache addObjectsFromArray:[store events]];
225 return _eventCache;
226 }
227
228 - (NSArray *)allTasks
229 {
230 NSMutableArray *all = [NSMutableArray arrayWithCapacity:32];
231 NSEnumerator *enumerator = [_stores objectEnumerator];
232 id <AgendaStore> store;
233
234 while ((store = [enumerator nextObject]))
235 if ([store enabled])
236 [all addObjectsFromArray:[store tasks]];
219237 return all;
220238 }
221239
222 - (NSArray *)allTasks;
223 {
224 NSMutableArray *all = [NSMutableArray arrayWithCapacity:128];
240 - (NSArray *)visibleTasks
241 {
242 NSMutableArray *all = [NSMutableArray arrayWithCapacity:32];
225243 NSEnumerator *enumerator = [_stores objectEnumerator];
226244 id <AgendaStore> store;
227245
238256 Event *event;
239257
240258 NSAssert(date != nil, @"No date specified, am I supposed to guess ?");
241 dayEvents = [_cache objectForKey:date];
259 dayEvents = [_dayEventsCache objectForKey:date];
242260 if (dayEvents)
243261 return dayEvents;
244262
247265 while ((event = [enumerator nextObject]))
248266 if ([event isScheduledForDay:date])
249267 [dayEvents addObject:event];
250 [_cache setObject:dayEvents forKey:date];
268 [_dayEventsCache setObject:dayEvents forKey:date];
251269 return dayEvents;
252270 }
271
272 - (NSSet *)visibleAppointmentsForDay:(Date *)date
273 {
274 NSMutableSet *visible = [NSMutableSet setWithCapacity:4];
275 NSEnumerator *enumerator;
276 Event *event;
277
278 enumerator = [[self scheduledAppointmentsForDay:date] objectEnumerator];
279 while ((event = [enumerator nextObject])) {
280 if ([[event store] displayed])
281 [visible addObject:event];
282 }
283 return visible;
284 }
253285 @end
00 In no particular order :
11
22 * redesign networking
3
4 * alerts and user notification (visual, by mail etc)
53
64 * month view
75
44
55 enum taskState
66 {
7 TK_NONE = 0,
8 TK_INPROCESS,
9 TK_COMPLETED,
10 TK_CANCELED
7 TK_NONE = 0,
8 TK_INPROCESS,
9 TK_COMPLETED,
10 TK_CANCELED,
11 TK_NEEDSACTION
1112 };
1213
1314 @interface Task : Element
1415 {
1516 enum taskState _state;
16 Date *_completionDate;
17 Date *_dueDate;
1718 }
1819
1920 + (NSArray *)stateNamesArray;
2021 - (enum taskState)state;
2122 - (NSString *)stateAsString;
2223 - (void)setState:(enum taskState)state;
23 - (Date *)completionDate;
24 - (void)setCompletionDate:(Date *)cd;
24 - (Date *)dueDate;
25 - (void)setDueDate:(Date *)cd;
2526 @end
2627
2728 @interface Task(iCalendar)
55 {
66 [super encodeWithCoder:coder];
77 [coder encodeInt:_state forKey:@"state"];
8 if (_completionDate != nil)
9 [coder encodeObject:_completionDate forKey:@"completion"];
8 if (_dueDate != nil)
9 [coder encodeObject:_dueDate forKey:@"dueDate"];
1010 }
1111 - (id)initWithCoder:(NSCoder *)coder
1212 {
1313 [super initWithCoder:coder];
1414 _state = [coder decodeIntForKey:@"state"];
15 if ([coder containsValueForKey:@"completion"])
16 _completionDate = [[coder decodeObjectForKey:@"completion"] retain];
15 if ([coder containsValueForKey:@"dueDate"])
16 _dueDate = [[coder decodeObjectForKey:@"dueDate"] retain];
1717 else
18 _completionDate = nil;
18 _dueDate = nil;
1919 return self;
2020 }
2121 @end
2525 @implementation Task
2626 + (void)initialize
2727 {
28 if (stateName == nil)
29 stateName = [[NSArray alloc] initWithObjects:_(@"None"), _(@"Started"), _(@"Completed"), _(@"Canceled"), nil];
28 if ([Task class] == self)
29 stateName = [[NSArray alloc] initWithObjects:_(@"None"), _(@"Started"), _(@"Completed"), _(@"Canceled"), _(@"Needs action"), nil];
3030 }
3131
3232 + (NSArray *)stateNamesArray
3636
3737 - (id)init
3838 {
39 self = [super init];
40 if (self) {
39 if ((self = [super init])) {
4140 _state = TK_NONE;
42 _completionDate = nil;
41 _dueDate = nil;
4342 }
4443 return self;
4544 }
45
4646 - (void)dealloc
4747 {
48 RELEASE(_completionDate);
48 RELEASE(_dueDate);
4949 [super dealloc];
5050 }
51
5152 - (enum taskState)state
5253 {
5354 return _state;
5455 }
56
5557 - (NSString *)stateAsString
5658 {
5759 return [stateName objectAtIndex:_state];
5860 }
61
5962 - (void)setState:(enum taskState)state
6063 {
6164 _state = state;
62 if (state == TK_COMPLETED)
63 [self setCompletionDate:[Date today]];
64 else
65 [self setCompletionDate:nil];
6665 }
67 - (Date *)completionDate
66
67 - (Date *)dueDate
6868 {
69 return _completionDate;
69 return _dueDate;
7070 }
71 - (void)setCompletionDate:(Date *)cd
71
72 - (void)setDueDate:(Date *)cd
7273 {
73 if (_completionDate != nil)
74 RELEASE(_completionDate);
74 DESTROY(_dueDate);
7575 if (cd != nil)
76 ASSIGNCOPY(_completionDate, cd);
77 else
78 _completionDate = nil;
76 ASSIGNCOPY(_dueDate, cd);
7977 }
78
79 - (Date *)nextActivationDate
80 {
81 /* FIXME */
82 return _dueDate;
83 }
84
8085 - (NSString *)description
8186 {
8287 return [self summary];
8893 {
8994 icalproperty *prop;
9095
91 self = [super initWithICalComponent:ic];
92 if (self == nil)
93 return nil;
94 prop = icalcomponent_get_first_property(ic, ICAL_STATUS_PROPERTY);
95 if (prop) {
96 switch (icalproperty_get_status(prop))
97 {
98 case ICAL_STATUS_COMPLETED:
99 [self setState:TK_COMPLETED];
100 break;
101 case ICAL_STATUS_CANCELLED:
102 [self setState:TK_CANCELED];
103 break;
104 case ICAL_STATUS_INPROCESS:
105 [self setState:TK_INPROCESS];
106 break;
107 default:
108 [self setState:TK_NONE];
109 }
96 if ((self = [super initWithICalComponent:ic])) {
97 prop = icalcomponent_get_first_property(ic, ICAL_STATUS_PROPERTY);
98 if (prop) {
99 switch (icalproperty_get_status(prop))
100 {
101 case ICAL_STATUS_COMPLETED:
102 [self setState:TK_COMPLETED];
103 break;
104 case ICAL_STATUS_CANCELLED:
105 [self setState:TK_CANCELED];
106 break;
107 case ICAL_STATUS_INPROCESS:
108 [self setState:TK_INPROCESS];
109 break;
110 case ICAL_STATUS_NEEDSACTION:
111 [self setState:TK_NEEDSACTION];
112 break;
113 default:
114 [self setState:TK_NONE];
115 }
116 }
117 else
118 [self setState:TK_NONE];
119 prop = icalcomponent_get_first_property(ic, ICAL_DUE_PROPERTY);
120 if (prop)
121 [self setDueDate:AUTORELEASE([[Date alloc] initWithICalTime:icalproperty_get_due(prop)])];
110122 }
111 else
112 [self setState:TK_NONE];
113123 return self;
114124 }
115125
116 - (icalcomponent *)asICalComponent
117 {
118 icalcomponent *ic = icalcomponent_new(ICAL_VTODO_COMPONENT);
119 if (!ic) {
120 NSLog(@"Couldn't create iCalendar component");
121 return NULL;
122 }
123 [self updateICalComponent:ic];
124 return ic;
125 }
126
127 static int statusCorr[] = {ICAL_STATUS_NONE, ICAL_STATUS_INPROCESS, ICAL_STATUS_COMPLETED, ICAL_STATUS_CANCELLED};
126 static int statusCorr[] = {ICAL_STATUS_NONE, ICAL_STATUS_INPROCESS, ICAL_STATUS_COMPLETED, ICAL_STATUS_CANCELLED, ICAL_STATUS_NEEDSACTION};
128127
129128 - (BOOL)updateICalComponent:(icalcomponent *)ic
130129 {
132131 return NO;
133132 [self deleteProperty:ICAL_STATUS_PROPERTY fromComponent:ic];
134133 icalcomponent_add_property(ic, icalproperty_new_status(statusCorr[[self state]]));
134 [self deleteProperty:ICAL_DUE_PROPERTY fromComponent:ic];
135 if (_dueDate)
136 icalcomponent_add_property(ic, icalproperty_new_due([_dueDate UTCICalTime]));
135137 return YES;
136138 }
137139
1111 id store;
1212 id state;
1313 id ok;
14 id toggleDueDate;
15 id dueDate;
16 id dueTime;
17 id alarms;
1418 Task *_task;
19 NSArray *_modifiedAlarms;
1520 }
1621
1722 + (TaskEditor *)editorForTask:(Task *)task;
1823 - (void)validate:(id)sender;
1924 - (void)cancel:(id)sender;
25 - (void)editAlarms:(id)sender;
26 - (void)toggleDueDate:(id)sender;
2027 @end
33 #import "TaskEditor.h"
44 #import "StoreManager.h"
55 #import "Task.h"
6 #import "AlarmEditor.h"
7 #import "HourFormatter.h"
8 #import "Date.h"
69
710 static NSMutableDictionary *editors;
811
1518
1619 - (id)init
1720 {
18 self = [super init];
19 if (self) {
20 if (![NSBundle loadNibNamed:@"Task" owner:self])
21 return nil;
21 HourFormatter *formatter;
22 NSDateFormatter *dateFormatter;
23
24 if (![NSBundle loadNibNamed:@"Task" owner:self])
25 return nil;
26 if ((self = [super init])) {
27 formatter = AUTORELEASE([[HourFormatter alloc] init]);
28 dateFormatter = AUTORELEASE([[NSDateFormatter alloc] initWithDateFormat:[[NSUserDefaults standardUserDefaults] objectForKey:NSShortDateFormatString] allowNaturalLanguage:NO]);
29 [dueTime setFormatter:formatter];
30 [dueDate setFormatter:dateFormatter];
2231 }
2332 return self;
2433 }
3342 self = [self init];
3443 if (self) {
3544 ASSIGN(_task, task);
45 ASSIGNCOPY(_modifiedAlarms, [task alarms]);
3646 [summary setStringValue:[task summary]];
3747
3848 [[description textStorage] deleteCharactersInRange:NSMakeRange(0, [[description textStorage] length])];
5565 [state addItemsWithTitles:[Task stateNamesArray]];
5666 [state selectItemWithTitle:[task stateAsString]];
5767 [ok setEnabled:[self canBeModified]];
68 if ([task dueDate]) {
69 [dueDate setObjectValue:[[task dueDate] calendarDate]];
70 [dueTime setIntValue:[[task dueDate] hourOfDay] * 3600 + [[task dueDate] minuteOfHour] * 60];
71 [toggleDueDate setState:YES];
72 }
73 [dueDate setEnabled:[toggleDueDate state]];
74 [dueTime setEnabled:[toggleDueDate state]];
5875 [window makeKeyAndOrderFront:self];
5976 }
6077 return self;
6279
6380 - (void)dealloc
6481 {
65 RELEASE(_task);
66 [super dealloc];
82 RELEASE(_task);
83 RELEASE(_modifiedAlarms);
84 [super dealloc];
6785 }
6886
6987 + (void)initialize
89107 StoreManager *sm = [StoreManager globalManager];
90108 id <MemoryStore> originalStore = [_task store];
91109 id <MemoryStore> aStore;
110 Date *date;
92111
93112 [_task setSummary:[summary stringValue]];
94113 [_task setText:[[description textStorage] copy]];
95114 [_task setState:[state indexOfSelectedItem]];
115 [_task setAlarms:_modifiedAlarms];
116 if ([toggleDueDate state]) {
117 date = [Date dateWithCalendarDate:[dueDate objectValue] withTime:NO];
118 date = [Date dateWithTimeInterval:[dueTime intValue] sinceDate:date];
119 [_task setDueDate:date];
120 } else {
121 [_task setDueDate:nil];
122 }
96123 aStore = [sm storeForName:[store titleOfSelectedItem]];
97124 if (!originalStore)
98125 [aStore add:_task];
102129 [originalStore remove:_task];
103130 [aStore add:_task];
104131 }
132 [window close];
105133 [editors removeObjectForKey:[_task UID]];
106 [window close];
107134 }
108135
109136 - (void)cancel:(id)sender
110137 {
138 [window close];
111139 [editors removeObjectForKey:[_task UID]];
112 [window close];
140 }
141
142 - (void)editAlarms:(id)sender
143 {
144 NSArray *alarmArray;
145
146 alarmArray = [AlarmEditor editAlarms:_modifiedAlarms];
147 if (alarmArray)
148 ASSIGN(_modifiedAlarms, alarmArray);
149 [window makeKeyAndOrderFront:self];
150 }
151
152 - (void)toggleDueDate:(id)sender
153 {
154 Date *date;
155
156 [dueDate setEnabled:[toggleDueDate state]];
157 [dueTime setEnabled:[toggleDueDate state]];
158 if ([toggleDueDate state]) {
159 date = [Date now];
160 [date changeDayBy:7];
161 [dueDate setObjectValue:[date calendarDate]];
162 [dueTime setIntValue:[date hourOfDay] * 3600 + [date minuteOfHour] * 60];
163 } else {
164 [dueDate setObjectValue:nil];
165 [dueTime setObjectValue:nil];
166 }
113167 }
114168
115169 - (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector
1515 NSString *_user;
1616 NSString *_password;
1717 NSData *_data;
18 BOOL _debug;
1918 }
2019
2120 - (id)initWithURL:(NSURL *)url;
2221 - (id)initWithURL:(NSURL *)anUrl authFromURL:(NSURL *)parent;
23 - (void)setDebug:(BOOL)debug;
2422 - (BOOL)readable;
2523 /* WARNING Destructive */
2624 - (BOOL)writableWithData:(NSData *)data;
3735 @interface NSURL(SimpleAgenda)
3836 + (BOOL)stringIsValidURL:(NSString *)string;
3937 + (NSURL *)URLWithString:(NSString *)string possiblyRelativeToURL:(NSURL *)base;
40 - (NSURL *)redirection;
38 - (NSString *)anonymousAbsoluteString;
4139 @end
4240
4341 @interface GSXMLDocument(SimpleAgenda)
22 #import "WebDAVResource.h"
33
44 @implementation WebDAVResource
5 - (void)debugLog:(NSString *)format,...
6 {
7 va_list ap;
8 if (_debug) {
9 va_start(ap, format);
10 NSLogv(format, ap);
11 va_end(ap);
12 }
13 }
145 - (void)dealloc
156 {
167 DESTROY(_user);
1910 DESTROY(_url);
2011 DESTROY(_lastModified);
2112 DESTROY(_data);
13 DESTROY(_reason);
14 DESTROY(_etag);
2215 [super dealloc];
2316 }
2417
25 - (void)fixURLScheme
26 {
27 if ([[_url scheme] hasPrefix:@"webcal"])
28 ASSIGN(_url, [NSURL URLWithString:[[_url absoluteString] stringByReplacingString:@"webcal" withString:@"http"]]);
18 - (void)setURL:(NSURL *)anURL
19 {
20 if ([[anURL scheme] hasPrefix:@"webcal"])
21 ASSIGN(_url, [NSURL URLWithString:[[anURL absoluteString] stringByReplacingString:@"webcal" withString:@"http"]]);
22 else
23 ASSIGN(_url, anURL);
24 _handleClass = [NSURLHandle URLHandleClassForURL:_url];
25 if ([_url user])
26 ASSIGN(_user, [_url user]);
27 if ([_url password])
28 ASSIGN(_password, [_url password]);
2929 }
3030
3131 - (id)initWithURL:(NSURL *)anUrl
3232 {
3333 self = [super init];
3434 if (self) {
35 /* FIXME : this causes a bogus GET for every resource creation */
36 _url = [anUrl redirection];
37 [self fixURLScheme];
38 _handleClass = [NSURLHandle URLHandleClassForURL:_url];
3935 _lock = [NSLock new];
40 _user = nil;
41 _password = nil;
4236 _data = nil;
43 _debug = NO;
37 [self setURL:anUrl];
4438 }
4539 return self;
4640 }
5347 ASSIGN(_password, [parent password]);
5448 }
5549 return self;
56 }
57
58 - (void)setDebug:(BOOL)debug
59 {
60 _debug = debug;
6150 }
6251
6352 /* FIXME : ugly hack to work around NSURLHandle shortcomings */
8473 NSURLHandle *handle;
8574
8675 [_lock lock];
76 restart:
8777 handle = [[_handleClass alloc] initWithURL:_url cached:NO];
8878 [handle writeProperty:method forKey:GSHTTPPropertyMethodKey];
8979 if (attributes) {
9787 [handle writeProperty:[NSString stringWithFormat:@"([%@])", _etag] forKey:@"If"];
9888 if (body)
9989 [handle writeData:body];
100 [self debugLog:@"%@ %@ (%@)", [_url absoluteString], method, [attributes description]];
90 NSDebugLog(@"%@ %@ (%@)", [_url anonymousAbsoluteString], method, [attributes description]);
10191 DESTROY(_data);
10292 data = [handle resourceData];
10393 /* FIXME : this is more than ugly */
10595 _httpStatus = data ? 200 : 199;
10696 else
10797 _httpStatus = [[handle propertyForKeyIfAvailable:NSHTTPPropertyStatusCodeKey] intValue];
108 if (data)
109 [self debugLog:@"%@ =>\n%@", method, AUTORELEASE([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding])];
110 else
111 [self debugLog:@"%@ status %d", method, _httpStatus];
98
99 /* FIXME : why do we have to check for httpStatus == 0 */
100 if ((_httpStatus == 0 ||_httpStatus == 301 || _httpStatus == 302) && [handle propertyForKey:@"Location"] != nil) {
101 NSDebugLog(@"Redirection to %@", [handle propertyForKey:@"Location"]);
102 [self setURL:[NSURL URLWithString:[handle propertyForKey:@"Location"]]];
103 goto restart;
104 }
105
106 NSDebugLog(@"%@ status %d", method, _httpStatus);
112107 property = [handle propertyForKeyIfAvailable:NSHTTPPropertyStatusReasonKey];
113108 if (property)
114109 ASSIGN(_reason, property);
232227 result = (GSXPathString *)[xpc evaluateExpression:GETLASTMODIFIED];
233228 if (result)
234229 ASSIGN(_lastModified, [result stringValue]);
230 RELEASE(xpc);
235231 }
236232 }
237233 }
245241
246242 NS_DURING
247243 {
248 url = [NSURL URLWithString:string];
249 valid = url ? YES : NO;
244 /* We want an absolute URL */
245 if ((url = [NSURL URLWithString:string]) && [url scheme])
246 valid = YES;
250247 }
251248 NS_HANDLER
252249 {
261258 if ([NSURL stringIsValidURL:string])
262259 url = [NSURL URLWithString:string];
263260 else
264 url = [NSURL URLWithString:[[base absoluteString] stringByReplacingString:[base path] withString:string]];
261 url = [NSURL URLWithString:string relativeToURL:base];
265262 return url;
266263 }
267 - (NSURL *)redirection
268 {
269 NSString *location;
270
271 location = [self propertyForKey:@"Location"];
272 if (location) {
273 NSLog(@"Redirected to %@", location);
274 return [[NSURL URLWithString:location] redirection];
275 }
276 return [self copy];
264 - (NSString *)anonymousAbsoluteString
265 {
266 NSString *as = [self absoluteString];
267
268 if (![self user] && ![self password])
269 return as;
270 return [as stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@:%@@", [self user], [self password]]
271 withString:@""];
277272 }
278273 @end
279274
1919 #define RADIUS 5
2020 - (void)drawRect:(NSRect)rect
2121 {
22 NSPoint point;
2223 NSString *title;
2324 NSString *label;
2425 Date *start = [_apt startDate];
5960 PSsetlinewidth(CEC_BORDERSIZE);
6061 PSstroke();
6162 [label drawInRect:TextRect(rect) withAttributes:textAttributes];
62 if ([_apt rrule] != nil)
63 point = NSMakePoint(rect.size.width - 18, rect.size.height - 16);
64 if ([_apt rrule]) {
6365 [[self repeatImage] compositeToPoint:NSMakePoint(rect.size.width - 18, rect.size.height - 18) operation:NSCompositeSourceOver];
66 point = NSMakePoint(rect.size.width - 30, rect.size.height - 16);
67 }
68 if ([_apt hasAlarms])
69 [[self alarmImage] compositeToPoint:point operation:NSCompositeSourceOver];
6470 }
6571
6672 - (void)mouseDown:(NSEvent *)theEvent
222228 {
223229 if ([delegate respondsToSelector:@selector(viewSelectDate:)])
224230 [delegate viewSelectDate:[(WeekDayView *)[aptv superview] day]];
225 [[SelectionManager globalManager] set:[aptv appointment]];
231 [[SelectionManager globalManager] select:[aptv appointment]];
226232 if ([delegate respondsToSelector:@selector(viewSelectEvent:)])
227233 [delegate viewSelectEvent:[aptv appointment]];
228234 [self setNeedsDisplay:YES];
238244 enumerator = [[self subviews] objectEnumerator];
239245 while ((wdv = [enumerator nextObject])) {
240246 [wdv clear];
241 events = [[StoreManager globalManager] scheduledAppointmentsForDay:[wdv day]];
247 events = [[StoreManager globalManager] visibleAppointmentsForDay:[wdv day]];
242248 enm = [events objectEnumerator];
243249 while ((apt = [enm nextObject]))
244250 [wdv addAppointment:apt];
33 GNUSTEP_SH_EXPORT_ALL_VARIABLES=yes
44 . "$GNUSTEP_MAKEFILES/GNUstep.sh"
55 unset GNUSTEP_SH_EXPORT_ALL_VARIABLES
6
7 # For backwards compatibility, define GNUSTEP_SYSTEM_HEADERS from
8 # GNUSTEP_SYSTEM_ROOT if not set yet.
9 if test x"$GNUSTEP_SYSTEM_HEADERS" = x""; then
10 GNUSTEP_SYSTEM_HEADERS="$GNUSTEP_SYSTEM_ROOT/Library/Headers"
11 fi
12 if test x"$GNUSTEP_LOCAL_HEADERS" = x""; then
13 GNUSTEP_LOCAL_HEADERS="$GNUSTEP_LOCAL_ROOT/Library/Headers"
14 fi
15
16 if test x"$GNUSTEP_SYSTEM_LIBRARIES" = x""; then
17 GNUSTEP_SYSTEM_LIBRARIES="$GNUSTEP_SYSTEM_ROOT/Library/Libraries"
18 fi
19 if test x"$GNUSTEP_LOCAL_LIBRARIES" = x""; then
20 GNUSTEP_LOCAL_LIBRARIES="$GNUSTEP_LOCAL_ROOT/Library/Libraries"
21 fi
226
23 OLD_CFLAGS=$CFLAGS
24 CFLAGS="-xobjective-c"
25 PREFIX="-I"
26 OLD_CPPFLAGS="$CPPFLAGS"
27 CPPFLAGS="$CPPFLAGS $PREFIX$GNUSTEP_SYSTEM_HEADERS $PREFIX$GNUSTEP_LOCAL_HEADERS"
7 OLD_CFLAGS=$CFLAGS
8 CFLAGS="-xobjective-c "
9 CFLAGS+=`gnustep-config --objc-flags`
2810
2911 OLD_LDFLAGS="$LD_FLAGS"
30 PREFIX="-L"
31 LDFLAGS="$LDFLAGS $PREFIX$GNUSTEP_SYSTEM_LIBRARIES $PREFIX$GNUSTEP_LOCAL_LIBRARIES"
12 LDFLAGS=`gnustep-config --objc-libs`
3213 OLD_LIBS="$LIBS"
33 LIBS="-lgnustep-base"
14 LIBS="-lgnustep-base -lAddresses"
3415 AC_MSG_CHECKING([for Addresses framework])
35
36 LIBS="$LIBS -lAddresses"
3716
3817 AC_LINK_IFELSE(
3918 AC_LANG_PROGRAM(
4625 have_addresses=no)
4726
4827 LIBS="$OLD_LIBS"
49 CPPFLAGS="$OLD_CPPFLAGS"
5028 LDFLAGS="$OLD_LDFLAGS"
5129 CFLAGS="$OLD_CFLAGS"
5230
5331 AC_MSG_RESULT($have_addresses)
5432 ])
33
34 AC_DEFUN(AC_CHECK_DBUSKIT,[
35
36 GNUSTEP_SH_EXPORT_ALL_VARIABLES=yes
37 . "$GNUSTEP_MAKEFILES/GNUstep.sh"
38 unset GNUSTEP_SH_EXPORT_ALL_VARIABLES
39
40 OLD_CFLAGS=$CFLAGS
41 CFLAGS="-xobjective-c "
42 CFLAGS+=`gnustep-config --objc-flags`
43
44 OLD_LDFLAGS="$LD_FLAGS"
45 LDFLAGS=`gnustep-config --objc-libs`
46 OLD_LIBS="$LIBS"
47 LIBS="-lgnustep-base -lDBusKit"
48 AC_MSG_CHECKING([for DBusKit framework])
49
50 AC_LINK_IFELSE(
51 AC_LANG_PROGRAM(
52 [[#import <Foundation/Foundation.h>
53 #import <DBusKit/DBusKit.h>]],
54 [[[[DKPort sessionBusPort]];]]),
55 $1;
56 have_dbuskit=yes,
57 $2;
58 have_dbuskit=no)
59
60 LIBS="$OLD_LIBS"
61 LDFLAGS="$OLD_LDFLAGS"
62 CFLAGS="$OLD_CFLAGS"
63
64 AC_MSG_RESULT($have_dbuskit)
65 ])
5959 #else
6060 #import <ical.h>
6161 #endif
62
63 /*
64 * Workaround a build failure found by Sergey Golovin :
65 * it seems MIN and MAX macros are not always defined
66 */
67 #ifndef MAX
68 #import <GNUstepBase/preface.h>
69 #endif
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.64.
2 # Generated by GNU Autoconf 2.67.
3 #
34 #
45 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
5 # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
6 # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
67 # Foundation, Inc.
8 #
79 #
810 # This configure script is free software; the Free Software Foundation
911 # gives unlimited permission to copy, distribute and modify it.
313315 test -d "$as_dir" && break
314316 done
315317 test -z "$as_dirs" || eval "mkdir $as_dirs"
316 } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
318 } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
317319
318320
319321 } # as_fn_mkdir_p
353355 fi # as_fn_arith
354356
355357
356 # as_fn_error ERROR [LINENO LOG_FD]
357 # ---------------------------------
358 # as_fn_error STATUS ERROR [LINENO LOG_FD]
359 # ----------------------------------------
358360 # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
359361 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
360 # script with status $?, using 1 if that was 0.
362 # script with STATUS, using 1 if that was 0.
361363 as_fn_error ()
362364 {
363 as_status=$?; test $as_status -eq 0 && as_status=1
364 if test "$3"; then
365 as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
366 $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
365 as_status=$1; test $as_status -eq 0 && as_status=1
366 if test "$4"; then
367 as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
368 $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
367369 fi
368 $as_echo "$as_me: error: $1" >&2
370 $as_echo "$as_me: error: $2" >&2
369371 as_fn_exit $as_status
370372 } # as_fn_error
371373
523525 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
524526
525527
526 exec 7<&0 </dev/null 6>&1
528 test -n "$DJDIR" || exec 7<&0 </dev/null
529 exec 6>&1
527530
528531 # Name of the host.
529 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
532 # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
530533 # so uname gets run too.
531534 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
532535
590593
591594 ac_subst_vars='LTLIBOBJS
592595 LIBOBJS
596 additional_lib_dir
597 additional_include_dir
598 have_dbuskit
593599 have_addresses
594600 have_libuuid
595601 EGREP
643649 ac_subst_files=''
644650 ac_user_opts='
645651 enable_option_checking
652 with_ical_include
653 with_ical_library
654 enable_dbuskit
646655 '
647656 ac_precious_vars='build_alias
648657 host_alias
715724 fi
716725
717726 case $ac_option in
718 *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
719 *) ac_optarg=yes ;;
727 *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
728 *=) ac_optarg= ;;
729 *) ac_optarg=yes ;;
720730 esac
721731
722732 # Accept the important Cygnus configure options, so we can diagnose typos.
761771 ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
762772 # Reject names that are not valid shell variable names.
763773 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
764 as_fn_error "invalid feature name: $ac_useropt"
774 as_fn_error $? "invalid feature name: $ac_useropt"
765775 ac_useropt_orig=$ac_useropt
766776 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
767777 case $ac_user_opts in
787797 ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
788798 # Reject names that are not valid shell variable names.
789799 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
790 as_fn_error "invalid feature name: $ac_useropt"
800 as_fn_error $? "invalid feature name: $ac_useropt"
791801 ac_useropt_orig=$ac_useropt
792802 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
793803 case $ac_user_opts in
9911001 ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
9921002 # Reject names that are not valid shell variable names.
9931003 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
994 as_fn_error "invalid package name: $ac_useropt"
1004 as_fn_error $? "invalid package name: $ac_useropt"
9951005 ac_useropt_orig=$ac_useropt
9961006 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
9971007 case $ac_user_opts in
10071017 ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
10081018 # Reject names that are not valid shell variable names.
10091019 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
1010 as_fn_error "invalid package name: $ac_useropt"
1020 as_fn_error $? "invalid package name: $ac_useropt"
10111021 ac_useropt_orig=$ac_useropt
10121022 ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
10131023 case $ac_user_opts in
10371047 | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
10381048 x_libraries=$ac_optarg ;;
10391049
1040 -*) as_fn_error "unrecognized option: \`$ac_option'
1041 Try \`$0 --help' for more information."
1050 -*) as_fn_error $? "unrecognized option: \`$ac_option'
1051 Try \`$0 --help' for more information"
10421052 ;;
10431053
10441054 *=*)
10461056 # Reject names that are not valid shell variable names.
10471057 case $ac_envvar in #(
10481058 '' | [0-9]* | *[!_$as_cr_alnum]* )
1049 as_fn_error "invalid variable name: \`$ac_envvar'" ;;
1059 as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
10501060 esac
10511061 eval $ac_envvar=\$ac_optarg
10521062 export $ac_envvar ;;
10641074
10651075 if test -n "$ac_prev"; then
10661076 ac_option=--`echo $ac_prev | sed 's/_/-/g'`
1067 as_fn_error "missing argument to $ac_option"
1077 as_fn_error $? "missing argument to $ac_option"
10681078 fi
10691079
10701080 if test -n "$ac_unrecognized_opts"; then
10711081 case $enable_option_checking in
10721082 no) ;;
1073 fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
1083 fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
10741084 *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
10751085 esac
10761086 fi
10931103 [\\/$]* | ?:[\\/]* ) continue;;
10941104 NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
10951105 esac
1096 as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
1106 as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
10971107 done
10981108
10991109 # There might be people who depend on the old broken behavior: `$host'
11071117 if test "x$host_alias" != x; then
11081118 if test "x$build_alias" = x; then
11091119 cross_compiling=maybe
1110 $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
1111 If a cross compiler is detected then cross compile mode will be used." >&2
1120 $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
1121 If a cross compiler is detected then cross compile mode will be used" >&2
11121122 elif test "x$build_alias" != "x$host_alias"; then
11131123 cross_compiling=yes
11141124 fi
11231133 ac_pwd=`pwd` && test -n "$ac_pwd" &&
11241134 ac_ls_di=`ls -di .` &&
11251135 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
1126 as_fn_error "working directory cannot be determined"
1136 as_fn_error $? "working directory cannot be determined"
11271137 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
1128 as_fn_error "pwd does not report name of working directory"
1138 as_fn_error $? "pwd does not report name of working directory"
11291139
11301140
11311141 # Find the source files, if location was not specified.
11641174 fi
11651175 if test ! -r "$srcdir/$ac_unique_file"; then
11661176 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
1167 as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
1177 as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
11681178 fi
11691179 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
11701180 ac_abs_confdir=`(
1171 cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
1181 cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
11721182 pwd)`
11731183 # When building in place, set srcdir=.
11741184 if test "$ac_abs_confdir" = "$ac_pwd"; then
12081218 --help=short display options specific to this package
12091219 --help=recursive display the short help of all the included packages
12101220 -V, --version display version information and exit
1211 -q, --quiet, --silent do not print \`checking...' messages
1221 -q, --quiet, --silent do not print \`checking ...' messages
12121222 --cache-file=FILE cache test results in FILE [disabled]
12131223 -C, --config-cache alias for \`--cache-file=config.cache'
12141224 -n, --no-create do not create output files
12571267
12581268 cat <<\_ACEOF
12591269
1270 Optional Features:
1271 --disable-option-checking ignore unrecognized --enable/--with options
1272 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
1273 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
1274 --disable-dbuskit disable DBusKit based alarm notification
1275
1276 Optional Packages:
1277 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
1278 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
1279 --with-ical-include=DIR include path for ical headers
1280 --with-ical-library=DIR library path for ical libraries
1281
12601282 Some influential environment variables:
12611283 CC C compiler command
12621284 CFLAGS C compiler flags
12631285 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
12641286 nonstandard directory <lib dir>
12651287 LIBS libraries to pass to the linker, e.g. -l<library>
1266 CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
1288 CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
12671289 you have headers in a nonstandard directory <include dir>
12681290 CPP C preprocessor
12691291
13341356 if $ac_init_version; then
13351357 cat <<\_ACEOF
13361358 configure
1337 generated by GNU Autoconf 2.64
1338
1339 Copyright (C) 2009 Free Software Foundation, Inc.
1359 generated by GNU Autoconf 2.67
1360
1361 Copyright (C) 2010 Free Software Foundation, Inc.
13401362 This configure script is free software; the Free Software Foundation
13411363 gives unlimited permission to copy, distribute and modify it.
13421364 _ACEOF
13811403 ac_retval=1
13821404 fi
13831405 eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
1384 return $ac_retval
1406 as_fn_set_status $ac_retval
13851407
13861408 } # ac_fn_c_try_compile
13871409
14061428 mv -f conftest.er1 conftest.err
14071429 fi
14081430 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1409 test $ac_status = 0; } >/dev/null && {
1431 test $ac_status = 0; } > conftest.i && {
14101432 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
14111433 test ! -s conftest.err
14121434 }; then :
14181440 ac_retval=1
14191441 fi
14201442 eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
1421 return $ac_retval
1443 as_fn_set_status $ac_retval
14221444
14231445 } # ac_fn_c_try_cpp
14241446
14301452 ac_fn_c_check_header_mongrel ()
14311453 {
14321454 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1433 if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
1455 if eval "test \"\${$3+set}\"" = set; then :
14341456 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
14351457 $as_echo_n "checking for $2... " >&6; }
1436 if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
1458 if eval "test \"\${$3+set}\"" = set; then :
14371459 $as_echo_n "(cached) " >&6
14381460 fi
14391461 eval ac_res=\$$3
14691491 else
14701492 ac_header_preproc=no
14711493 fi
1472 rm -f conftest.err conftest.$ac_ext
1494 rm -f conftest.err conftest.i conftest.$ac_ext
14731495 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
14741496 $as_echo "$ac_header_preproc" >&6; }
14751497
14961518 esac
14971519 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
14981520 $as_echo_n "checking for $2... " >&6; }
1499 if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
1521 if eval "test \"\${$3+set}\"" = set; then :
15001522 $as_echo_n "(cached) " >&6
15011523 else
15021524 eval "$3=\$ac_header_compiler"
15471569 fi
15481570 rm -rf conftest.dSYM conftest_ipa8_conftest.oo
15491571 eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
1550 return $ac_retval
1572 as_fn_set_status $ac_retval
15511573
15521574 } # ac_fn_c_try_run
15531575
15601582 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
15611583 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
15621584 $as_echo_n "checking for $2... " >&6; }
1563 if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
1585 if eval "test \"\${$3+set}\"" = set; then :
15641586 $as_echo_n "(cached) " >&6
15651587 else
15661588 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
16241646 # left behind by Apple's compiler. We do this before executing the actions.
16251647 rm -rf conftest.dSYM conftest_ipa8_conftest.oo
16261648 eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
1627 return $ac_retval
1649 as_fn_set_status $ac_retval
16281650
16291651 } # ac_fn_c_try_link
16301652 cat >config.log <<_ACEOF
16321654 running configure, to aid debugging if configure makes a mistake.
16331655
16341656 It was created by $as_me, which was
1635 generated by GNU Autoconf 2.64. Invocation command line was
1657 generated by GNU Autoconf 2.67. Invocation command line was
16361658
16371659 $ $0 $@
16381660
17421764 {
17431765 echo
17441766
1745 cat <<\_ASBOX
1746 ## ---------------- ##
1767 $as_echo "## ---------------- ##
17471768 ## Cache variables. ##
1748 ## ---------------- ##
1749 _ASBOX
1769 ## ---------------- ##"
17501770 echo
17511771 # The following way of writing the cache mishandles newlines in values,
17521772 (
17801800 )
17811801 echo
17821802
1783 cat <<\_ASBOX
1784 ## ----------------- ##
1803 $as_echo "## ----------------- ##
17851804 ## Output variables. ##
1786 ## ----------------- ##
1787 _ASBOX
1805 ## ----------------- ##"
17881806 echo
17891807 for ac_var in $ac_subst_vars
17901808 do
17971815 echo
17981816
17991817 if test -n "$ac_subst_files"; then
1800 cat <<\_ASBOX
1801 ## ------------------- ##
1818 $as_echo "## ------------------- ##
18021819 ## File substitutions. ##
1803 ## ------------------- ##
1804 _ASBOX
1820 ## ------------------- ##"
18051821 echo
18061822 for ac_var in $ac_subst_files
18071823 do
18151831 fi
18161832
18171833 if test -s confdefs.h; then
1818 cat <<\_ASBOX
1819 ## ----------- ##
1834 $as_echo "## ----------- ##
18201835 ## confdefs.h. ##
1821 ## ----------- ##
1822 _ASBOX
1836 ## ----------- ##"
18231837 echo
18241838 cat confdefs.h
18251839 echo
18741888 ac_site_file1=NONE
18751889 ac_site_file2=NONE
18761890 if test -n "$CONFIG_SITE"; then
1877 ac_site_file1=$CONFIG_SITE
1891 # We do not want a PATH search for config.site.
1892 case $CONFIG_SITE in #((
1893 -*) ac_site_file1=./$CONFIG_SITE;;
1894 */*) ac_site_file1=$CONFIG_SITE;;
1895 *) ac_site_file1=./$CONFIG_SITE;;
1896 esac
18781897 elif test "x$prefix" != xNONE; then
18791898 ac_site_file1=$prefix/share/config.site
18801899 ac_site_file2=$prefix/etc/config.site
18851904 for ac_site_file in "$ac_site_file1" "$ac_site_file2"
18861905 do
18871906 test "x$ac_site_file" = xNONE && continue
1888 if test -r "$ac_site_file"; then
1907 if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
18891908 { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
18901909 $as_echo "$as_me: loading site script $ac_site_file" >&6;}
18911910 sed 's/^/| /' "$ac_site_file" >&5
1892 . "$ac_site_file"
1911 . "$ac_site_file" \
1912 || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
1913 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
1914 as_fn_error $? "failed to load site script $ac_site_file
1915 See \`config.log' for more details" "$LINENO" 5 ; }
18931916 fi
18941917 done
18951918
18961919 if test -r "$cache_file"; then
1897 # Some versions of bash will fail to source /dev/null (special
1898 # files actually), so we avoid doing that.
1899 if test -f "$cache_file"; then
1920 # Some versions of bash will fail to source /dev/null (special files
1921 # actually), so we avoid doing that. DJGPP emulates it as a regular file.
1922 if test /dev/null != "$cache_file" && test -f "$cache_file"; then
19001923 { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
19011924 $as_echo "$as_me: loading cache $cache_file" >&6;}
19021925 case $cache_file in
19651988 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
19661989 { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
19671990 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
1968 as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
1991 as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
19691992 fi
19701993 ## -------------------- ##
19711994 ## Main body of script. ##
19822005 ac_config_headers="$ac_config_headers config.h"
19832006
19842007
2008 old_cppflags=$CPPFLAGS
2009 old_ldflags=$LDFLAGS
2010
2011 additional_include_dir=
2012 additional_lib_dir=
2013
2014
2015 # Check whether --with-ical-include was given.
2016 if test "${with_ical_include+set}" = set; then :
2017 withval=$with_ical_include; additional_include_dir+=-I"$withval"
2018 fi
2019
2020
2021 # Check whether --with-ical-library was given.
2022 if test "${with_ical_library+set}" = set; then :
2023 withval=$with_ical_library; additional_lib_dir=-L"$withval"
2024 fi
2025
2026 CPPFLAGS="$CPPFLAGS $additional_include_dir"
2027 LDFLAGS="$LDFLAGS $additional_lib_dir"
19852028 ac_ext=c
19862029 ac_cpp='$CPP $CPPFLAGS'
19872030 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
22822325
22832326 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
22842327 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2285 as_fn_error "no acceptable C compiler found in \$PATH
2286 See \`config.log' for more details." "$LINENO" 5; }
2328 as_fn_error $? "no acceptable C compiler found in \$PATH
2329 See \`config.log' for more details" "$LINENO" 5 ; }
22872330
22882331 # Provide some information about the compiler.
22892332 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
23042347 ... rest of stderr output deleted ...
23052348 10q' conftest.err >conftest.er1
23062349 cat conftest.er1 >&5
2307 rm -f conftest.er1 conftest.err
23082350 fi
2351 rm -f conftest.er1 conftest.err
23092352 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
23102353 test $ac_status = 0; }
23112354 done
23122355
23132356 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
23142357 /* end confdefs.h. */
2315 #include <stdio.h>
2358
23162359 int
23172360 main ()
23182361 {
2319 FILE *f = fopen ("conftest.out", "w");
2320 return ferror (f) || fclose (f) != 0;
23212362
23222363 ;
23232364 return 0;
23242365 }
23252366 _ACEOF
23262367 ac_clean_files_save=$ac_clean_files
2327 ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
2368 ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
23282369 # Try to create an executable without -o first, disregard a.out.
23292370 # It will help us diagnose broken compilers, and finding out an intuition
23302371 # of exeext.
2331 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
2332 $as_echo_n "checking for C compiler default output file name... " >&6; }
2372 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
2373 $as_echo_n "checking whether the C compiler works... " >&6; }
23332374 ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
23342375
23352376 # The possible output files:
23912432 else
23922433 ac_file=''
23932434 fi
2435 if test -z "$ac_file"; then :
2436 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
2437 $as_echo "no" >&6; }
2438 $as_echo "$as_me: failed program was:" >&5
2439 sed 's/^/| /' conftest.$ac_ext >&5
2440
2441 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
2442 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2443 as_fn_error 77 "C compiler cannot create executables
2444 See \`config.log' for more details" "$LINENO" 5 ; }
2445 else
2446 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
2447 $as_echo "yes" >&6; }
2448 fi
2449 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
2450 $as_echo_n "checking for C compiler default output file name... " >&6; }
23942451 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
23952452 $as_echo "$ac_file" >&6; }
2396 if test -z "$ac_file"; then :
2397 $as_echo "$as_me: failed program was:" >&5
2398 sed 's/^/| /' conftest.$ac_ext >&5
2399
2400 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
2401 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2402 { as_fn_set_status 77
2403 as_fn_error "C compiler cannot create executables
2404 See \`config.log' for more details." "$LINENO" 5; }; }
2405 fi
24062453 ac_exeext=$ac_cv_exeext
24072454
2408 # Check that the compiler produces executables we can run. If not, either
2409 # the compiler is broken, or we cross compile.
2410 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
2411 $as_echo_n "checking whether the C compiler works... " >&6; }
2412 # If not cross compiling, check that we can run a simple program.
2413 if test "$cross_compiling" != yes; then
2414 if { ac_try='./$ac_file'
2415 { { case "(($ac_try" in
2416 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2417 *) ac_try_echo=$ac_try;;
2418 esac
2419 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
2420 $as_echo "$ac_try_echo"; } >&5
2421 (eval "$ac_try") 2>&5
2422 ac_status=$?
2423 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2424 test $ac_status = 0; }; }; then
2425 cross_compiling=no
2426 else
2427 if test "$cross_compiling" = maybe; then
2428 cross_compiling=yes
2429 else
2430 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
2431 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2432 as_fn_error "cannot run C compiled programs.
2433 If you meant to cross compile, use \`--host'.
2434 See \`config.log' for more details." "$LINENO" 5; }
2435 fi
2436 fi
2437 fi
2438 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
2439 $as_echo "yes" >&6; }
2440
2441 rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
2455 rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
24422456 ac_clean_files=$ac_clean_files_save
2443 # Check that the compiler produces executables we can run. If not, either
2444 # the compiler is broken, or we cross compile.
2445 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
2446 $as_echo_n "checking whether we are cross compiling... " >&6; }
2447 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
2448 $as_echo "$cross_compiling" >&6; }
2449
24502457 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
24512458 $as_echo_n "checking for suffix of executables... " >&6; }
24522459 if { { ac_try="$ac_link"
24762483 else
24772484 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
24782485 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2479 as_fn_error "cannot compute suffix of executables: cannot compile and link
2480 See \`config.log' for more details." "$LINENO" 5; }
2481 fi
2482 rm -f conftest$ac_cv_exeext
2486 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
2487 See \`config.log' for more details" "$LINENO" 5 ; }
2488 fi
2489 rm -f conftest conftest$ac_cv_exeext
24832490 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
24842491 $as_echo "$ac_cv_exeext" >&6; }
24852492
24862493 rm -f conftest.$ac_ext
24872494 EXEEXT=$ac_cv_exeext
24882495 ac_exeext=$EXEEXT
2496 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2497 /* end confdefs.h. */
2498 #include <stdio.h>
2499 int
2500 main ()
2501 {
2502 FILE *f = fopen ("conftest.out", "w");
2503 return ferror (f) || fclose (f) != 0;
2504
2505 ;
2506 return 0;
2507 }
2508 _ACEOF
2509 ac_clean_files="$ac_clean_files conftest.out"
2510 # Check that the compiler produces executables we can run. If not, either
2511 # the compiler is broken, or we cross compile.
2512 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
2513 $as_echo_n "checking whether we are cross compiling... " >&6; }
2514 if test "$cross_compiling" != yes; then
2515 { { ac_try="$ac_link"
2516 case "(($ac_try" in
2517 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2518 *) ac_try_echo=$ac_try;;
2519 esac
2520 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
2521 $as_echo "$ac_try_echo"; } >&5
2522 (eval "$ac_link") 2>&5
2523 ac_status=$?
2524 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2525 test $ac_status = 0; }
2526 if { ac_try='./conftest$ac_cv_exeext'
2527 { { case "(($ac_try" in
2528 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2529 *) ac_try_echo=$ac_try;;
2530 esac
2531 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
2532 $as_echo "$ac_try_echo"; } >&5
2533 (eval "$ac_try") 2>&5
2534 ac_status=$?
2535 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2536 test $ac_status = 0; }; }; then
2537 cross_compiling=no
2538 else
2539 if test "$cross_compiling" = maybe; then
2540 cross_compiling=yes
2541 else
2542 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
2543 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2544 as_fn_error $? "cannot run C compiled programs.
2545 If you meant to cross compile, use \`--host'.
2546 See \`config.log' for more details" "$LINENO" 5 ; }
2547 fi
2548 fi
2549 fi
2550 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
2551 $as_echo "$cross_compiling" >&6; }
2552
2553 rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
2554 ac_clean_files=$ac_clean_files_save
24892555 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
24902556 $as_echo_n "checking for suffix of object files... " >&6; }
24912557 if test "${ac_cv_objext+set}" = set; then :
25282594
25292595 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
25302596 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2531 as_fn_error "cannot compute suffix of object files: cannot compile
2532 See \`config.log' for more details." "$LINENO" 5; }
2597 as_fn_error $? "cannot compute suffix of object files: cannot compile
2598 See \`config.log' for more details" "$LINENO" 5 ; }
25332599 fi
25342600 rm -f conftest.$ac_cv_objext conftest.$ac_ext
25352601 fi
27922858 # Broken: fails on valid input.
27932859 continue
27942860 fi
2795 rm -f conftest.err conftest.$ac_ext
2861 rm -f conftest.err conftest.i conftest.$ac_ext
27962862
27972863 # OK, works on sane cases. Now check whether nonexistent headers
27982864 # can be detected and how.
28082874 ac_preproc_ok=:
28092875 break
28102876 fi
2811 rm -f conftest.err conftest.$ac_ext
2877 rm -f conftest.err conftest.i conftest.$ac_ext
28122878
28132879 done
28142880 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
2815 rm -f conftest.err conftest.$ac_ext
2881 rm -f conftest.i conftest.err conftest.$ac_ext
28162882 if $ac_preproc_ok; then :
28172883 break
28182884 fi
28512917 # Broken: fails on valid input.
28522918 continue
28532919 fi
2854 rm -f conftest.err conftest.$ac_ext
2920 rm -f conftest.err conftest.i conftest.$ac_ext
28552921
28562922 # OK, works on sane cases. Now check whether nonexistent headers
28572923 # can be detected and how.
28672933 ac_preproc_ok=:
28682934 break
28692935 fi
2870 rm -f conftest.err conftest.$ac_ext
2936 rm -f conftest.err conftest.i conftest.$ac_ext
28712937
28722938 done
28732939 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
2874 rm -f conftest.err conftest.$ac_ext
2940 rm -f conftest.i conftest.err conftest.$ac_ext
28752941 if $ac_preproc_ok; then :
28762942
28772943 else
28782944 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
28792945 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
2880 as_fn_error "C preprocessor \"$CPP\" fails sanity check
2881 See \`config.log' for more details." "$LINENO" 5; }
2946 as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
2947 See \`config.log' for more details" "$LINENO" 5 ; }
28822948 fi
28832949
28842950 ac_ext=c
29393005 done
29403006 IFS=$as_save_IFS
29413007 if test -z "$ac_cv_path_GREP"; then
2942 as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
3008 as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
29433009 fi
29443010 else
29453011 ac_cv_path_GREP=$GREP
30053071 done
30063072 IFS=$as_save_IFS
30073073 if test -z "$ac_cv_path_EGREP"; then
3008 as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
3074 as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
30093075 fi
30103076 else
30113077 ac_cv_path_EGREP=$EGREP
31373203 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
31383204 ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
31393205 "
3140 eval as_val=\$$as_ac_Header
3141 if test "x$as_val" = x""yes; then :
3206 if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
31423207 cat >>confdefs.h <<_ACEOF
31433208 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
31443209 _ACEOF
31663231 _ACEOF
31673232
31683233 else
3169 as_fn_error "ical.h not found. You must have libical >= 0.27 installed." "$LINENO" 5
3234 as_fn_error $? "ical.h not found. You must have libical >= 0.27 installed." "$LINENO" 5
31703235 fi
31713236
31723237 done
31743239 fi
31753240
31763241 done
3242
3243 CPPFLAGS=$old_cppflags
3244 LDFLAGS=$old_ldflags
31773245
31783246 for ac_header in uuid/uuid.h
31793247 do :
31953263 . "$GNUSTEP_MAKEFILES/GNUstep.sh"
31963264 unset GNUSTEP_SH_EXPORT_ALL_VARIABLES
31973265
3198 # For backwards compatibility, define GNUSTEP_SYSTEM_HEADERS from
3199 # GNUSTEP_SYSTEM_ROOT if not set yet.
3200 if test x"$GNUSTEP_SYSTEM_HEADERS" = x""; then
3201 GNUSTEP_SYSTEM_HEADERS="$GNUSTEP_SYSTEM_ROOT/Library/Headers"
3202 fi
3203 if test x"$GNUSTEP_LOCAL_HEADERS" = x""; then
3204 GNUSTEP_LOCAL_HEADERS="$GNUSTEP_LOCAL_ROOT/Library/Headers"
3205 fi
3206
3207 if test x"$GNUSTEP_SYSTEM_LIBRARIES" = x""; then
3208 GNUSTEP_SYSTEM_LIBRARIES="$GNUSTEP_SYSTEM_ROOT/Library/Libraries"
3209 fi
3210 if test x"$GNUSTEP_LOCAL_LIBRARIES" = x""; then
3211 GNUSTEP_LOCAL_LIBRARIES="$GNUSTEP_LOCAL_ROOT/Library/Libraries"
3212 fi
3213
32143266 OLD_CFLAGS=$CFLAGS
3215 CFLAGS="-xobjective-c"
3216 PREFIX="-I"
3217 OLD_CPPFLAGS="$CPPFLAGS"
3218 CPPFLAGS="$CPPFLAGS $PREFIX$GNUSTEP_SYSTEM_HEADERS $PREFIX$GNUSTEP_LOCAL_HEADERS"
3267 CFLAGS="-xobjective-c "
3268 CFLAGS+=`gnustep-config --objc-flags`
32193269
32203270 OLD_LDFLAGS="$LD_FLAGS"
3221 PREFIX="-L"
3222 LDFLAGS="$LDFLAGS $PREFIX$GNUSTEP_SYSTEM_LIBRARIES $PREFIX$GNUSTEP_LOCAL_LIBRARIES"
3271 LDFLAGS=`gnustep-config --objc-libs`
32233272 OLD_LIBS="$LIBS"
3224 LIBS="-lgnustep-base"
3273 LIBS="-lgnustep-base -lAddresses"
32253274 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Addresses framework" >&5
32263275 $as_echo_n "checking for Addresses framework... " >&6; }
3227
3228 LIBS="$LIBS -lAddresses"
32293276
32303277 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
32313278 /* end confdefs.h. */
32503297 conftest$ac_exeext conftest.$ac_ext
32513298
32523299 LIBS="$OLD_LIBS"
3253 CPPFLAGS="$OLD_CPPFLAGS"
32543300 LDFLAGS="$OLD_LDFLAGS"
32553301 CFLAGS="$OLD_CFLAGS"
32563302
32573303 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_addresses" >&5
32583304 $as_echo "$have_addresses" >&6; }
3305
3306
3307 # Check whether --enable-dbuskit was given.
3308 if test "${enable_dbuskit+set}" = set; then :
3309 enableval=$enable_dbuskit;
3310 else
3311 enable_dbuskit=yes
3312 fi
3313
3314 if test "x$enable_dbuskit" != xno; then
3315
3316
3317 GNUSTEP_SH_EXPORT_ALL_VARIABLES=yes
3318 . "$GNUSTEP_MAKEFILES/GNUstep.sh"
3319 unset GNUSTEP_SH_EXPORT_ALL_VARIABLES
3320
3321 OLD_CFLAGS=$CFLAGS
3322 CFLAGS="-xobjective-c "
3323 CFLAGS+=`gnustep-config --objc-flags`
3324
3325 OLD_LDFLAGS="$LD_FLAGS"
3326 LDFLAGS=`gnustep-config --objc-libs`
3327 OLD_LIBS="$LIBS"
3328 LIBS="-lgnustep-base -lDBusKit"
3329 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DBusKit framework" >&5
3330 $as_echo_n "checking for DBusKit framework... " >&6; }
3331
3332 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3333 /* end confdefs.h. */
3334 #import <Foundation/Foundation.h>
3335 #import <DBusKit/DBusKit.h>
3336 int
3337 main ()
3338 {
3339 [DKPort sessionBusPort];
3340 ;
3341 return 0;
3342 }
3343 _ACEOF
3344 if ac_fn_c_try_link "$LINENO"; then :
3345 have_dbuskit=yes;
3346 have_dbuskit=yes
3347 else
3348 have_dbuskit=no;
3349 have_dbuskit=no
3350 fi
3351 rm -f core conftest.err conftest.$ac_objext \
3352 conftest$ac_exeext conftest.$ac_ext
3353
3354 LIBS="$OLD_LIBS"
3355 LDFLAGS="$OLD_LDFLAGS"
3356 CFLAGS="$OLD_CFLAGS"
3357
3358 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_dbuskit" >&5
3359 $as_echo "$have_dbuskit" >&6; }
3360
3361 else
3362 { $as_echo "$as_me:${as_lineno-$LINENO}: DBusKit disabled" >&5
3363 $as_echo "$as_me: DBusKit disabled" >&6;}
3364 have_dbuskit=no
3365 fi
3366
3367
3368
3369
32593370
32603371
32613372
33453456
33463457 ac_libobjs=
33473458 ac_ltlibobjs=
3459 U=
33483460 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
33493461 # 1. Remove the extension, and $U if already installed.
33503462 ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
35063618 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
35073619
35083620
3509 # as_fn_error ERROR [LINENO LOG_FD]
3510 # ---------------------------------
3621 # as_fn_error STATUS ERROR [LINENO LOG_FD]
3622 # ----------------------------------------
35113623 # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
35123624 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
3513 # script with status $?, using 1 if that was 0.
3625 # script with STATUS, using 1 if that was 0.
35143626 as_fn_error ()
35153627 {
3516 as_status=$?; test $as_status -eq 0 && as_status=1
3517 if test "$3"; then
3518 as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
3519 $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
3628 as_status=$1; test $as_status -eq 0 && as_status=1
3629 if test "$4"; then
3630 as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
3631 $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
35203632 fi
3521 $as_echo "$as_me: error: $1" >&2
3633 $as_echo "$as_me: error: $2" >&2
35223634 as_fn_exit $as_status
35233635 } # as_fn_error
35243636
37143826 test -d "$as_dir" && break
37153827 done
37163828 test -z "$as_dirs" || eval "mkdir $as_dirs"
3717 } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
3829 } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
37183830
37193831
37203832 } # as_fn_mkdir_p
37683880 # values after options handling.
37693881 ac_log="
37703882 This file was extended by $as_me, which was
3771 generated by GNU Autoconf 2.64. Invocation command line was
3883 generated by GNU Autoconf 2.67. Invocation command line was
37723884
37733885 CONFIG_FILES = $CONFIG_FILES
37743886 CONFIG_HEADERS = $CONFIG_HEADERS
38073919
38083920 -h, --help print this help, then exit
38093921 -V, --version print version number and configuration settings, then exit
3922 --config print configuration, then exit
38103923 -q, --quiet, --silent
38113924 do not print progress messages
38123925 -d, --debug don't remove temporary files
38263939
38273940 _ACEOF
38283941 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
3942 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
38293943 ac_cs_version="\\
38303944 config.status
3831 configured by $0, generated by GNU Autoconf 2.64,
3832 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
3833
3834 Copyright (C) 2009 Free Software Foundation, Inc.
3945 configured by $0, generated by GNU Autoconf 2.67,
3946 with options \\"\$ac_cs_config\\"
3947
3948 Copyright (C) 2010 Free Software Foundation, Inc.
38353949 This config.status script is free software; the Free Software Foundation
38363950 gives unlimited permission to copy, distribute and modify it."
38373951
38463960 while test $# != 0
38473961 do
38483962 case $1 in
3849 --*=*)
3963 --*=?*)
38503964 ac_option=`expr "X$1" : 'X\([^=]*\)='`
38513965 ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
3966 ac_shift=:
3967 ;;
3968 --*=)
3969 ac_option=`expr "X$1" : 'X\([^=]*\)='`
3970 ac_optarg=
38523971 ac_shift=:
38533972 ;;
38543973 *)
38643983 ac_cs_recheck=: ;;
38653984 --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
38663985 $as_echo "$ac_cs_version"; exit ;;
3986 --config | --confi | --conf | --con | --co | --c )
3987 $as_echo "$ac_cs_config"; exit ;;
38673988 --debug | --debu | --deb | --de | --d | -d )
38683989 debug=: ;;
38693990 --file | --fil | --fi | --f )
38703991 $ac_shift
38713992 case $ac_optarg in
38723993 *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
3994 '') as_fn_error $? "missing file argument" ;;
38733995 esac
38743996 as_fn_append CONFIG_FILES " '$ac_optarg'"
38753997 ac_need_defaults=false;;
38824004 ac_need_defaults=false;;
38834005 --he | --h)
38844006 # Conflict between --help and --header
3885 as_fn_error "ambiguous option: \`$1'
4007 as_fn_error $? "ambiguous option: \`$1'
38864008 Try \`$0 --help' for more information.";;
38874009 --help | --hel | -h )
38884010 $as_echo "$ac_cs_usage"; exit ;;
38914013 ac_cs_silent=: ;;
38924014
38934015 # This is an error.
3894 -*) as_fn_error "unrecognized option: \`$1'
4016 -*) as_fn_error $? "unrecognized option: \`$1'
38954017 Try \`$0 --help' for more information." ;;
38964018
38974019 *) as_fn_append ac_config_targets " $1"
39434065 "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
39444066 "local.make") CONFIG_FILES="$CONFIG_FILES local.make" ;;
39454067
3946 *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
4068 *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
39474069 esac
39484070 done
39494071
39804102 {
39814103 tmp=./conf$$-$RANDOM
39824104 (umask 077 && mkdir "$tmp")
3983 } || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
4105 } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
39844106
39854107 # Set up the scripts for CONFIG_FILES section.
39864108 # No need to generate them if there are no CONFIG_FILES.
39974119 fi
39984120 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
39994121 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
4000 ac_cs_awk_cr='\r'
4122 ac_cs_awk_cr='\\r'
40014123 else
40024124 ac_cs_awk_cr=$ac_cr
40034125 fi
40114133 echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
40124134 echo "_ACEOF"
40134135 } >conf$$subs.sh ||
4014 as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
4015 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
4136 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
4137 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
40164138 ac_delim='%!_!# '
40174139 for ac_last_try in false false false false false :; do
40184140 . ./conf$$subs.sh ||
4019 as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
4141 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
40204142
40214143 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
40224144 if test $ac_delim_n = $ac_delim_num; then
40234145 break
40244146 elif $ac_last_try; then
4025 as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
4147 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
40264148 else
40274149 ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
40284150 fi
40444166 t delim
40454167 :nl
40464168 h
4047 s/\(.\{148\}\).*/\1/
4169 s/\(.\{148\}\)..*/\1/
40484170 t more1
40494171 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
40504172 p
40584180 t nl
40594181 :delim
40604182 h
4061 s/\(.\{148\}\).*/\1/
4183 s/\(.\{148\}\)..*/\1/
40624184 t more2
40634185 s/["\\]/\\&/g; s/^/"/; s/$/"/
40644186 p
41114233 else
41124234 cat
41134235 fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
4114 || as_fn_error "could not setup config files machinery" "$LINENO" 5
4115 _ACEOF
4116
4117 # VPATH may cause trouble with some makes, so we remove $(srcdir),
4118 # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
4236 || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
4237 _ACEOF
4238
4239 # VPATH may cause trouble with some makes, so we remove sole $(srcdir),
4240 # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
41194241 # trailing colons and then remove the whole line if VPATH becomes empty
41204242 # (actually we leave an empty line to preserve line numbers).
41214243 if test "x$srcdir" = x.; then
4122 ac_vpsub='/^[ ]*VPATH[ ]*=/{
4123 s/:*\$(srcdir):*/:/
4124 s/:*\${srcdir}:*/:/
4125 s/:*@srcdir@:*/:/
4126 s/^\([^=]*=[ ]*\):*/\1/
4244 ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
4245 h
4246 s///
4247 s/^/:/
4248 s/[ ]*$/:/
4249 s/:\$(srcdir):/:/g
4250 s/:\${srcdir}:/:/g
4251 s/:@srcdir@:/:/g
4252 s/^:*//
41274253 s/:*$//
4254 x
4255 s/\(=[ ]*\).*/\1/
4256 G
4257 s/\n//
41284258 s/^[^=]*=[ ]*$//
41294259 }'
41304260 fi
41524282 if test -z "$ac_t"; then
41534283 break
41544284 elif $ac_last_try; then
4155 as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
4285 as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
41564286 else
41574287 ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
41584288 fi
42374367 _ACAWK
42384368 _ACEOF
42394369 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
4240 as_fn_error "could not setup config headers machinery" "$LINENO" 5
4370 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
42414371 fi # test -n "$CONFIG_HEADERS"
42424372
42434373
42504380 esac
42514381 case $ac_mode$ac_tag in
42524382 :[FHL]*:*);;
4253 :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
4383 :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
42544384 :[FH]-) ac_tag=-:-;;
42554385 :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
42564386 esac
42784408 [\\/$]*) false;;
42794409 *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
42804410 esac ||
4281 as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
4411 as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
42824412 esac
42834413 case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
42844414 as_fn_append ac_file_inputs " '$ac_f'"
43054435
43064436 case $ac_tag in
43074437 *:-:* | *:-) cat >"$tmp/stdin" \
4308 || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
4438 || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
43094439 esac
43104440 ;;
43114441 esac
44314561 $ac_datarootdir_hack
44324562 "
44334563 eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
4434 || as_fn_error "could not create $ac_file" "$LINENO" 5
4564 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
44354565
44364566 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
44374567 { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
44384568 { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
44394569 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
4440 which seems to be undefined. Please make sure it is defined." >&5
4570 which seems to be undefined. Please make sure it is defined" >&5
44414571 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
4442 which seems to be undefined. Please make sure it is defined." >&2;}
4572 which seems to be undefined. Please make sure it is defined" >&2;}
44434573
44444574 rm -f "$tmp/stdin"
44454575 case $ac_file in
44464576 -) cat "$tmp/out" && rm -f "$tmp/out";;
44474577 *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
44484578 esac \
4449 || as_fn_error "could not create $ac_file" "$LINENO" 5
4579 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
44504580 ;;
44514581 :H)
44524582 #
44574587 $as_echo "/* $configure_input */" \
44584588 && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
44594589 } >"$tmp/config.h" \
4460 || as_fn_error "could not create $ac_file" "$LINENO" 5
4590 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
44614591 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
44624592 { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
44634593 $as_echo "$as_me: $ac_file is unchanged" >&6;}
44644594 else
44654595 rm -f "$ac_file"
44664596 mv "$tmp/config.h" "$ac_file" \
4467 || as_fn_error "could not create $ac_file" "$LINENO" 5
4597 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
44684598 fi
44694599 else
44704600 $as_echo "/* $configure_input */" \
44714601 && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
4472 || as_fn_error "could not create -" "$LINENO" 5
4602 || as_fn_error $? "could not create -" "$LINENO" 5
44734603 fi
44744604 ;;
44754605
44844614 ac_clean_files=$ac_clean_files_save
44854615
44864616 test $ac_write_fail = 0 ||
4487 as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
4617 as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
44884618
44894619
44904620 # configure is writing to config.log, and then calls config.status.
45054635 exec 5>>config.log
45064636 # Use ||, not &&, to avoid exiting from the if with $? = 1, which
45074637 # would make configure fail if this is the last instruction.
4508 $ac_cs_success || as_fn_exit $?
4638 $ac_cs_success || as_fn_exit 1
45094639 fi
45104640 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
45114641 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
66 AC_CONFIG_SRCDIR([MemoryStore.h])
77 AC_CONFIG_HEADER([config.h])
88
9 old_cppflags=$CPPFLAGS
10 old_ldflags=$LDFLAGS
11
12 additional_include_dir=
13 additional_lib_dir=
14
15 AC_ARG_WITH(ical-include, [ --with-ical-include=DIR include path for ical headers], additional_include_dir+=-I"$withval", )
16 AC_ARG_WITH(ical-library, [ --with-ical-library=DIR library path for ical libraries], additional_lib_dir=-L"$withval", )
17 CPPFLAGS="$CPPFLAGS $additional_include_dir"
18 LDFLAGS="$LDFLAGS $additional_lib_dir"
919 AC_CHECK_HEADERS([libical/ical.h], ,[AC_CHECK_HEADERS([ical.h], ,[AC_MSG_ERROR(ical.h not found. You must have libical >= 0.27 installed.)])])
20 CPPFLAGS=$old_cppflags
21 LDFLAGS=$old_ldflags
22
1023 AC_CHECK_HEADERS([uuid/uuid.h], have_libuuid=yes, have_libuuid=no)
1124 AC_CHECK_ADDRESSES(have_addresses=yes, have_addresses=no)
25
26 AC_ARG_ENABLE([dbuskit],
27 [AC_HELP_STRING([--disable-dbuskit],
28 [disable DBusKit based alarm notification])],
29 [],
30 [enable_dbuskit=yes])
31 if test "x$enable_dbuskit" != xno; then
32 AC_CHECK_DBUSKIT(have_dbuskit=yes, have_dbuskit=no)
33 else
34 AC_MSG_NOTICE([DBusKit disabled])
35 have_dbuskit=no
36 fi
37
1238 AC_SUBST(have_libuuid)
1339 AC_SUBST(have_addresses)
40 AC_SUBST(have_dbuskit)
41 AC_SUBST(additional_include_dir)
42 AC_SUBST(additional_lib_dir)
43
1444
1545 AC_CONFIG_FILES([local.make])
1646 AC_OUTPUT
33 #define LAST_HOUR @"lastHour"
44 #define MIN_STEP @"minimumStep"
55 #define TOOLTIP @"showTooltip"
6 #define ALARMS @"activateAlarms"
76
87 #define STORE_CLASSES @"storeClasses"
98
5252 - (void)okClicked:(id)sender
5353 {
5454 BOOL readable;
55 NSURL *tmp;
5655 WebDAVResource *resource;
5756
58 tmp = [NSURL URLWithString:[url stringValue]];
59 resource = AUTORELEASE([[WebDAVResource alloc] initWithURL:tmp]);
57 resource = AUTORELEASE([[WebDAVResource alloc] initWithURL:[NSURL URLWithString:[url stringValue]]]);
6058 readable = [resource readable];
6159 /* Read will fail if there's no resource yet, try to create an empty one */
62 if (!readable) {
60 if (!readable && [resource httpStatus] != 401) {
6361 [resource writableWithData:[NSData data]];
6462 readable = [resource readable];
6563 }
6664 if (readable)
6765 [NSApp stopModalWithCode:1];
6866 else {
69 [error setStringValue:[NSString stringWithFormat:@"Unable to read from this URL : %@", [tmp propertyForKey:NSHTTPPropertyStatusReasonKey]]];
67 [error setStringValue:[NSString stringWithFormat:@"Unable to read from this URL : %@", [[resource url] propertyForKey:NSHTTPPropertyStatusReasonKey]]];
7068 [warning setHidden:NO];
7169 }
7270 }
103101 - (NSDictionary *)defaults
104102 {
105103 return [NSDictionary dictionaryWithObjectsAndKeys:[[NSColor blueColor] description], ST_COLOR,
106 [[NSColor darkGrayColor] description], ST_TEXT_COLOR,
104 [[NSColor whiteColor] description], ST_TEXT_COLOR,
107105 [NSNumber numberWithBool:NO], ST_RW,
108106 [NSNumber numberWithBool:YES], ST_DISPLAY,
109107 [NSNumber numberWithBool:NO], ST_REFRESH,
120118 _resource = [[WebDAVResource alloc] initWithURL:_url];
121119 [_config registerClient:self forKey:ST_REFRESH];
122120 [_config registerClient:self forKey:ST_REFRESH_INTERVAL];
121 [_config registerClient:self forKey:ST_ENABLED];
123122 [NSThread detachNewThreadSelector:@selector(initStoreAsync:) toTarget:self withObject:nil];
124123 [self initTimer];
125124 }
148147 writable = [resource writableWithData:[resource data]];
149148 [resource release];
150149 [dialog release];
151 cm = [[ConfigManager alloc] initForKey:name withParent:nil];
150 cm = [[ConfigManager alloc] initForKey:name];
152151 [cm setObject:[storeURL description] forKey:ST_URL];
153152 [cm setObject:[[self class] description] forKey:ST_CLASS];
154153 [cm setObject:[NSNumber numberWithBool:writable] forKey:ST_RW];
161160
162161 + (NSString *)storeTypeName
163162 {
164 return @"iCalendar store";
163 return @"iCalendar";
165164 }
166165
167166 - (void)dealloc
221220 if ([_resource put:data attributes:nil]) {
222221 [_resource updateAttributes];
223222 [self setModified:NO];
224 NSLog(@"iCalStore written to %@", [_url absoluteString]);
223 NSLog(@"iCalStore written to %@", [_url anonymousAbsoluteString]);
225224 return YES;
226225 }
227226 if ([_resource httpStatus] == 412) {
228227 NSRunAlertPanel(@"Error : data source modified", @"To prevent losing modifications, this agenda\nwill be updated and marked as read-only. ", @"Ok", nil, nil);
229228 [self read];
230229 }
231 NSLog(@"Unable to write to %@, make this store read only", [_url absoluteString]);
230 NSLog(@"Unable to write to %@, make this store read only", [_url anonymousAbsoluteString]);
232231 [self setWritable:NO];
233232 return NO;
234233 }
255254 {
256255 [_config setInteger:interval forKey:ST_REFRESH_INTERVAL];
257256 }
258 - (void)config:(ConfigManager*)config dataDidChangedForKey:(NSString *)key
259 {
260 [self initTimer];
257 - (void)config:(ConfigManager *)config dataDidChangedForKey:(NSString *)key
258 {
259 if (config == _config && [key isEqualToString:ST_ENABLED] && [self enabled]) {
260 [self read];
261 [self initTimer];
262 }
261263 }
262264 @end
263265
265267 @implementation iCalStore(Private)
266268 - (void)fetchData
267269 {
268 if ([_resource get])
269 if ([NSThread isMainThread])
270 [self parseData:[_resource data]];
270 if ([self enabled]) {
271 if ([_resource get])
272 if ([NSThread isMainThread])
273 [self parseData:[_resource data]];
274 else
275 [self performSelectorOnMainThread:@selector(parseData:) withObject:[_resource data] waitUntilDone:NO];
271276 else
272 [self performSelectorOnMainThread:@selector(parseData:) withObject:[_resource data] waitUntilDone:NO];
273 else
274 [self setEnabled:NO];
277 [self setEnabled:NO];
278 }
275279 }
276280 - (void)parseData:(NSData *)data
277281 {
278282 if ([_tree parseData:data]) {
279283 [self fillWithElements:[_tree components]];
280 NSLog(@"iCalStore from %@ : loaded %d appointment(s)", [_url absoluteString], [[self events] count]);
281 NSLog(@"iCalStore from %@ : loaded %d tasks(s)", [_url absoluteString], [[self tasks] count]);
284 NSLog(@"iCalStore from %@ : loaded %d appointment(s)", [_url anonymousAbsoluteString], [[self events] count]);
285 NSLog(@"iCalStore from %@ : loaded %d tasks(s)", [_url anonymousAbsoluteString], [[self tasks] count]);
282286 } else
283 NSLog(@"Couldn't parse data from %@", [_url absoluteString]);
287 NSLog(@"Couldn't parse data from %@", [_url anonymousAbsoluteString]);
284288 }
285289 - (void)initTimer
286290 {
00 LIBUUID=@have_libuuid@
11 ADDRESSES=@have_addresses@
2 DBUSKIT=@have_dbuskit@
3 ADDITIONAL_INCLUDE_DIRS=@additional_include_dir@
4 ADDITIONAL_LIB_DIRS=@additional_lib_dir@
1111 ../Event.m \
1212 ../Element.m \
1313 ../NSString+SimpleAgenda.m \
14 ../Alarm.m \
15 ../HourFormatter.m \
1416 DateTest.m \
1517 ElementTest.m \
1618 RecurrenceRuleTest.m \