Monotone-Parent: 23e53c0473abebbb7c7be319abdfa337d6e21f12

Monotone-Revision: c2ee10fbf9266b5c8710519bc2fd13bae46e672b

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-08-04T22:46:19
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2006-08-04 22:46:19 +00:00
parent 7eb5317f06
commit 8faf83f55f
3 changed files with 194 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2006-08-04 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Contacts/SOGoContactFolders.[hm]: new class module
serving as the root of the contact folders available to the
current user. Correctly lists the contact sources in webdav.
2006-08-03 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailerUI/UIxMailAccountsView.m ([UIxMailAccountsView

View File

@ -0,0 +1,42 @@
/* SOGoContactFolders.h - this file is part of SOGo
*
* Copyright (C) 2006 Inverse groupe conseil
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef SOGOCONTACTFOLDERS_H
#define SOGOCONTACTFOLDERS_H
#import <SOGo/SOGoObject.h>
@class NSMutableDictionary;
@class NSString;
@interface SOGoContactFolders : SOGoObject
{
NSMutableDictionary *contactSources;
NSString *OCSPath;
}
- (NSString *) defaultSourceName;
- (void) setBaseOCSPath: (NSString *) newOCSPath;
@end
#endif /* SOGOCONTACTFOLDERS_H */

View File

@ -0,0 +1,146 @@
/* SOGoContactFolders.m - this file is part of SOGo
*
* Copyright (C) 2006 Inverse groupe conseil
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#import <Foundation/NSDictionary.h>
#import <Foundation/NSString.h>
#import <NGObjWeb/WOApplication.h>
#import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/SoUser.h>
#import "common.h"
#import "SOGoContactFolder.h"
#import "SOGoContactSource.h"
#import "SOGoPersonalAB.h"
#import "SOGoContactFolders.h"
@implementation SOGoContactFolders
- (id) init
{
if ((self = [super init]))
{
contactSources = nil;
OCSPath = nil;
}
return self;
}
- (void) dealloc
{
if (contactSources)
[contactSources release];
if (OCSPath)
[OCSPath release];
[super dealloc];
}
- (void) appendPersonalSourcesInContext: (WOContext *) context;
{
SOGoPersonalAB *ab;
ab = [SOGoPersonalAB personalABForUser: [[context activeUser] login]];
[contactSources setObject: ab forKey: @"personal"];
}
- (void) appendSystemSourcesInContext: (WOContext *) context;
{
}
- (void) initContactSourcesInContext: (WOContext *) context;
{
if (!contactSources)
{
contactSources = [NSMutableDictionary new];
[self appendPersonalSourcesInContext: context];
[self appendSystemSourcesInContext: context];
}
}
- (id) lookupName: (NSString *) name
inContext: (WOContext *) context
acquire: (BOOL) acquire
{
id obj;
SOGoContactSource *source;
/* first check attributes directly bound to the application */
obj = [super lookupName: name inContext: context acquire: NO];
if (!obj)
{
if (!contactSources)
[self initContactSourcesInContext: context];
source = [contactSources objectForKey: name];
if (source)
{
obj = [SOGoContactFolder contactFolderWithSource: source
inContainer: self
andName: name];
[obj setOCSPath: [NSString stringWithFormat: @"%@/%@",
OCSPath, name]];
}
else
obj = [NSException exceptionWithHTTPStatus: 200];
}
return obj;
}
- (NSArray *) toManyRelationshipKeys
{
WOContext *context;
if (!contactSources)
{
context = [[WOApplication application] context];
[self initContactSourcesInContext: context];
}
return [contactSources allKeys];
}
- (BOOL) davIsCollection
{
return YES;
}
- (void) setBaseOCSPath: (NSString *) newOCSPath
{
if (OCSPath)
[OCSPath release];
OCSPath = newOCSPath;
if (OCSPath)
[OCSPath retain];
}
/* web interface */
- (NSString *) defaultSourceName
{
return @"personal";
}
@end