Monotone-Parent: fc267c7dc09cc05decc140411d1facce3f441866
Monotone-Revision: c2a5265bbdaf7810309bda5f2f3dd5f2c67b15ed

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-06-11T18:43:46
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-06-11 18:43:46 +00:00
parent bfcaea41c0
commit 676194b020
8 changed files with 130 additions and 123 deletions
+7 -29
View File
@@ -61,7 +61,7 @@
WOResponse *response;
SOGoWebAppointmentFolder *folder;
NSURL *url;
NSString *name, *displayName;
NSString *urlString, *displayName;
NSMutableDictionary *rc;
SOGoAppointmentFolders *folders;
int imported = 0;
@@ -70,25 +70,21 @@
rc = [NSMutableDictionary dictionary];
// Just a check
url = [NSURL URLWithString: [r formValueForKey: @"url"]];
urlString = [r formValueForKey: @"url"];
url = [NSURL URLWithString: urlString];
if (url)
{
folders = [self clientObject];
displayName = [self displayNameForUrl: [r formValueForKey: @"url"]];
[folders newFolderWithName: displayName
nameInContainer: &name];
[self saveUrl: url forCalendar: name];
folder = [folders lookupName: name
inContext: context
acquire: NO];
folder = [folders newWebCalendarWithName: displayName
atURL: urlString];
if (folder)
{
imported = [folder loadWebCalendar: [r formValueForKey: @"url"]];
imported = [folder loadWebCalendar];
if (imported >= 0)
{
[rc setObject: displayName forKey: @"displayname"];
[rc setObject: name forKey: @"name"];
[rc setObject: [folder nameInContainer] forKey: @"name"];
}
else
{
@@ -104,24 +100,6 @@
return response;
}
- (void) saveUrl: (NSURL *) calendarURL
forCalendar: (NSString *) calendarName
{
SOGoUserSettings *settings;
NSMutableDictionary *calSettings, *webCalendars;
settings = [[context activeUser] userSettings];
calSettings = [settings objectForKey: @"Calendar"];
webCalendars = [calSettings objectForKey: @"WebCalendars"];
if (!webCalendars)
{
webCalendars = [NSMutableDictionary dictionary];
[calSettings setObject: webCalendars forKey: @"WebCalendars"];
}
[webCalendars setObject: [calendarURL absoluteString] forKey: calendarName];
[settings synchronize];
}
- (WOResponse *) reloadWebCalendarsAction
{
[[self clientObject] reloadWebCalendars: YES];