mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-21 09:26:23 +00:00
Monotone-Parent: 5ce544e4196355529d09f53ee1f29a26e0df0733
Monotone-Revision: 2cf3be019f697c04a2f19de8e9693b7b7a1ddf8d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-08-09T21:37:35 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -25,29 +25,84 @@
|
||||
|
||||
#import <NGObjWeb/SoObjects.h>
|
||||
|
||||
#import <SoObjects/Contacts/SOGoContactFolders.h>
|
||||
#import <SoObjects/Contacts/SOGoContactFolder.h>
|
||||
|
||||
#import "UIxContactsListViewContainer.h"
|
||||
|
||||
@class SOGoContactFolders;
|
||||
|
||||
@implementation UIxContactsListViewContainer
|
||||
|
||||
- (NSString *) contactFolderName
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
foldersPrefix = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) setCurrentFolder: (id) folder
|
||||
{
|
||||
currentFolder = folder;
|
||||
}
|
||||
|
||||
- (NSString *) foldersPrefix
|
||||
{
|
||||
NSMutableArray *folders;
|
||||
SOGoObject *currentObject;
|
||||
|
||||
folders = [NSMutableArray new];
|
||||
[folders autorelease];
|
||||
|
||||
currentObject = [self clientObject];
|
||||
while (![currentObject isKindOfClass: [SOGoContactFolders class]])
|
||||
if (!foldersPrefix)
|
||||
{
|
||||
[folders insertObject: [currentObject nameInContainer] atIndex: 0];
|
||||
currentObject = [currentObject container];
|
||||
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 [NSString stringWithFormat: @"/%@",
|
||||
[folders componentsJoinedByString: @"/"]];
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user