mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-21 19:35:38 +00:00
Monotone-Parent: 32b8651c607640726bff724790fc018ce587ad3e
Monotone-Revision: db3a7e7fdd8662a109a9a31c651b6cfa55d16775 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-03T22:04:48 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -19,10 +19,150 @@
|
||||
02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "UIxContactsListViewBase.h"
|
||||
#import <Contacts/SOGoContactObject.h>
|
||||
#import <Contacts/SOGoContactFolder.h>
|
||||
#import <Contacts/SOGoContactFolders.h>
|
||||
|
||||
@interface UIxContactsListView : UIxContactsListViewBase
|
||||
@end
|
||||
#import "common.h"
|
||||
|
||||
#import "UIxContactsListView.h"
|
||||
|
||||
@implementation UIxContactsListView
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
selectorComponentClass = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
if (searchText)
|
||||
[searchText release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* accessors */
|
||||
|
||||
- (void) setCurrentContact: (NSDictionary *) _contact
|
||||
{
|
||||
currentContact = _contact;
|
||||
}
|
||||
|
||||
- (NSDictionary *) currentContact
|
||||
{
|
||||
return currentContact;
|
||||
}
|
||||
|
||||
- (void) setSearchText: (NSString *) _txt
|
||||
{
|
||||
ASSIGNCOPY (searchText, _txt);
|
||||
}
|
||||
|
||||
- (id) searchText
|
||||
{
|
||||
if (!searchText)
|
||||
[self setSearchText: [self queryParameterForKey:@"search"]];
|
||||
|
||||
return searchText;
|
||||
}
|
||||
|
||||
- (NSString *) selectorComponentClass
|
||||
{
|
||||
return selectorComponentClass;
|
||||
}
|
||||
|
||||
- (id) schedulerContactsAction
|
||||
{
|
||||
selectorComponentClass = @"UIxContactsSchedulerSelection";
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) mailerContactsAction
|
||||
{
|
||||
selectorComponentClass = @"UIxContactsMailerSelection";
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *) defaultSortKey
|
||||
{
|
||||
return @"fn";
|
||||
}
|
||||
|
||||
- (NSString *) displayName
|
||||
{
|
||||
NSString *displayName;
|
||||
|
||||
displayName = [currentContact objectForKey: @"displayName"];
|
||||
if (!(displayName && [displayName length] > 0))
|
||||
displayName = [currentContact objectForKey: @"cn"];
|
||||
|
||||
return displayName;
|
||||
}
|
||||
|
||||
- (NSString *) sortKey
|
||||
{
|
||||
NSString *s;
|
||||
|
||||
s = [self queryParameterForKey: @"sort"];
|
||||
if ([s length] == 0)
|
||||
s = [self defaultSortKey];
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
- (NSComparisonResult) sortOrdering
|
||||
{
|
||||
return ([[self queryParameterForKey:@"desc"] boolValue]
|
||||
? NSOrderedDescending
|
||||
: NSOrderedAscending);
|
||||
}
|
||||
|
||||
- (NSArray *) contactInfos
|
||||
{
|
||||
id <SOGoContactFolder> folder;
|
||||
|
||||
folder = [self clientObject];
|
||||
|
||||
return [folder lookupContactsWithFilter: [self searchText]
|
||||
sortBy: [self sortKey]
|
||||
ordering: [self sortOrdering]];
|
||||
}
|
||||
|
||||
/* notifications */
|
||||
|
||||
- (void) sleep
|
||||
{
|
||||
if (searchText)
|
||||
{
|
||||
[searchText release];
|
||||
searchText = nil;
|
||||
}
|
||||
currentContact = nil;
|
||||
// [allRecords release];
|
||||
// allRecords = nil;
|
||||
// [filteredRecords release];
|
||||
// filteredRecords = nil;
|
||||
[super sleep];
|
||||
}
|
||||
|
||||
/* actions */
|
||||
|
||||
- (BOOL) shouldTakeValuesFromRequest: (WORequest *) _rq
|
||||
inContext: (WOContext*) _c
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) isPopup
|
||||
{
|
||||
return [[self queryParameterForKey: @"popup"] boolValue];
|
||||
}
|
||||
|
||||
@end /* UIxContactsListView */
|
||||
|
||||
Reference in New Issue
Block a user