diff --git a/UI/Contacts/UIxContactsListViewContainer.m b/UI/Contacts/UIxContactsListViewContainer.m index 13d54b8df..018e1c630 100644 --- a/UI/Contacts/UIxContactsListViewContainer.m +++ b/UI/Contacts/UIxContactsListViewContainer.m @@ -20,8 +20,121 @@ * Boston, MA 02111-1307, USA. */ +#import +#import + +#import + +#import + #import "UIxContactsListViewContainer.h" +@class SOGoContactFolders; + @implementation UIxContactsListViewContainer +- (id) init +{ + if ((self = [super init])) + { + foldersPrefix = nil; + selectorComponentClass = nil; + } + + return self; +} + +- (void) setSelectorComponentClass: (NSString *) aComponentClass +{ + selectorComponentClass = aComponentClass; +} + +- (NSString *) selectorComponentName +{ + return selectorComponentClass; +} + +- (WOElement *) selectorComponent +{ + WOElement *newComponent; +// Class componentClass; + +// componentClass = NSClassFromString(selectorComponentClass); +// if (componentClass) +// { + newComponent = [self pageWithName: selectorComponentClass]; +// } +// else +// newComponent = nil; + + return newComponent; +} + +- (void) setCurrentFolder: (id) folder +{ + currentFolder = folder; +} + +- (NSString *) foldersPrefix +{ + NSMutableArray *folders; + SOGoObject *currentObject; + + if (!foldersPrefix) + { + folders = [NSMutableArray new]; + [folders autorelease]; + + currentObject = [[self clientObject] container]; + while (![currentObject isKindOfClass: [SOGoContactFolders class]]) + { + [folders insertObject: [currentObject nameInContainer] atIndex: 0]; + currentObject = [currentObject container]; + } + + foldersPrefix = [folders componentsJoinedByString: @"/"]; + [foldersPrefix retain]; + } + + return foldersPrefix; +} + +- (NSString *) contactFolderId +{ + return [NSString stringWithFormat: @"%@/%@", + [self foldersPrefix], + [[self clientObject] nameInContainer]]; +} + +- (NSArray *) contactFolders +{ + SOGoContactFolders *folderContainer; + + folderContainer = [[self clientObject] container]; + + return [folderContainer contactFolders]; +} + +- (NSString *) currentContactFolderId +{ + return [NSString stringWithFormat: @"%@/%@", + [self foldersPrefix], + [currentFolder nameInContainer]]; +} + +- (NSString *) currentContactFolderName +{ + return [self labelForKey: [currentFolder displayName]]; +} + +- (BOOL) isFolderCurrent +{ + return [[self currentContactFolderId] isEqualToString: [self contactFolderId]]; +} + +- (BOOL) hasContactSelectionButtons +{ + return (selectorComponentClass != nil); +} + @end diff --git a/UI/Contacts/UIxContactsListViewContainerBase.m b/UI/Contacts/UIxContactsListViewContainerBase.m deleted file mode 100644 index ebdc369a3..000000000 --- a/UI/Contacts/UIxContactsListViewContainerBase.m +++ /dev/null @@ -1,108 +0,0 @@ -/* UIxContactsListViewContainerBase.m - this file is part of SOGo - * - * Copyright (C) 2006 Inverse groupe conseil - * - * Author: Wolfgang Sourdeau - * - * 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 -#import - -#import - -#import - -#import "UIxContactsListViewContainerBase.h" - -@class SOGoContactFolders; - -@implementation UIxContactsListViewContainerBase - -- (id) init -{ - if ((self = [super init])) - { - foldersPrefix = nil; - } - - return self; -} - -- (void) setCurrentFolder: (id) folder -{ - currentFolder = folder; -} - -- (NSString *) foldersPrefix -{ - NSMutableArray *folders; - SOGoObject *currentObject; - - if (!foldersPrefix) - { - folders = [NSMutableArray new]; - [folders autorelease]; - - currentObject = [[self clientObject] container]; - while (![currentObject isKindOfClass: [SOGoContactFolders class]]) - { - [folders insertObject: [currentObject nameInContainer] atIndex: 0]; - currentObject = [currentObject container]; - } - - foldersPrefix = [folders componentsJoinedByString: @"/"]; - [foldersPrefix retain]; - } - - return foldersPrefix; -} - -- (NSString *) contactFolderId -{ - return [NSString stringWithFormat: @"%@/%@", - [self foldersPrefix], - [[self clientObject] nameInContainer]]; -} - -- (NSArray *) contactFolders -{ - SOGoContactFolders *folderContainer; - - folderContainer = [[self clientObject] container]; - - return [folderContainer contactFolders]; -} - -- (NSString *) currentContactFolderId -{ - return [NSString stringWithFormat: @"%@/%@", - [self foldersPrefix], - [currentFolder nameInContainer]]; -} - -- (NSString *) currentContactFolderName -{ - return [self labelForKey: [currentFolder displayName]]; -} - -- (BOOL) isFolderCurrent -{ - return [[self currentContactFolderId] isEqualToString: [self contactFolderId]]; -} - -@end