mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-18 03:38:49 +00:00
Calendar+Addressbook export
Monotone-Parent: fb2522bcdcf167e7ba3e95a03948f9bfad2b7870 Monotone-Revision: 1e66868696d71db915497bde02848e689ed48c7a Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-09-02T13:24:02 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -34,6 +34,11 @@
|
||||
#import <Contacts/SOGoContactFolder.h>
|
||||
#import <Contacts/SOGoContactFolders.h>
|
||||
|
||||
#import <NGCards/NGVCard.h>
|
||||
#import <NGCards/NGVList.h>
|
||||
#import <SoObjects/Contacts/SOGoContactGCSEntry.h>
|
||||
#import <SoObjects/Contacts/SOGoContactGCSList.h>
|
||||
|
||||
#import "UIxContactsListView.h"
|
||||
|
||||
@implementation UIxContactsListView
|
||||
@@ -178,4 +183,45 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (id <WOActionResults>) exportAction
|
||||
{
|
||||
WORequest *request;
|
||||
id <WOActionResults> response;
|
||||
NSArray *contactsId;
|
||||
NSEnumerator *uids;
|
||||
NSString *uid;
|
||||
id currentChild;
|
||||
id sourceFolder;
|
||||
NSMutableString *content;
|
||||
|
||||
content = [NSMutableString string];
|
||||
request = [context request];
|
||||
if ( (contactsId = [request formValuesForKey: @"uid"]) )
|
||||
{
|
||||
sourceFolder = [self clientObject];
|
||||
uids = [contactsId objectEnumerator];
|
||||
while ((uid = [uids nextObject]))
|
||||
{
|
||||
currentChild = [sourceFolder lookupName: uid
|
||||
inContext: [self context]
|
||||
acquire: NO];
|
||||
if ([currentChild respondsToSelector: @selector (vCard)])
|
||||
[content appendFormat: [[currentChild vCard] ldifString]];
|
||||
else if ([currentChild respondsToSelector: @selector (vList)])
|
||||
[content appendFormat: [[currentChild vList] ldifString]];
|
||||
}
|
||||
}
|
||||
response = [[WOResponse alloc] init];
|
||||
[response autorelease];
|
||||
[response setHeader: @"text/directory"
|
||||
forKey:@"content-type"];
|
||||
[response setHeader: @"attachment;filename=SavedContacts.ldif"
|
||||
forKey: @"Content-Disposition"];
|
||||
[response setContent: [content dataUsingEncoding: NSUTF8StringEncoding]];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@end /* UIxContactsListView */
|
||||
|
||||
Reference in New Issue
Block a user