mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-18 03:38:49 +00:00
Improvement for list display
Monotone-Parent: 08fdc5d0a9471051564e0739b2dd3367c1e5143a Monotone-Revision: de4013a540009902497a1085be5975e4ff6c3a83 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-08-21T17:41:52 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
2009-08-21 Cyril Robert <crobert@inverse.ca>
|
||||
|
||||
* UI/Contacts/UIxListView.m: Implementation, allows VLISTs to be displayed.
|
||||
* UI/Contacts/UIxListView.m (checkListReferences): Added list integrity
|
||||
verification (make sure all references are valid).
|
||||
|
||||
2009-08-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
|
||||
@@ -24,10 +24,12 @@
|
||||
#define UIXLISTVIEW_H
|
||||
|
||||
#import <SOGoUI/UIxComponent.h>
|
||||
#import <SoObjects/Contacts/SOGoContactGCSList.h>
|
||||
|
||||
@interface UIxListView : UIxComponent
|
||||
{
|
||||
NGVList *list;
|
||||
SOGoContactGCSList *co;
|
||||
id item;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#import <NGObjWeb/WOResponse.h>
|
||||
#import <NGCards/NGVList.h>
|
||||
#import <NGCards/NGVCard.h>
|
||||
#import <NGCards/NGVCardReference.h>
|
||||
|
||||
#import "UIxListView.h"
|
||||
|
||||
@@ -61,20 +62,56 @@
|
||||
{
|
||||
NSString *rc;
|
||||
|
||||
rc = [NSString stringWithFormat: @"%@ <%@>", [item fn], [item email]];
|
||||
rc = [NSString stringWithFormat: @"%@ <%@>",
|
||||
[item fn], [item email]];
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
- (void) checkListReferences
|
||||
{
|
||||
NSMutableArray *invalid;
|
||||
NGVCardReference *card;
|
||||
int i, count;
|
||||
id test;
|
||||
|
||||
invalid = [NSMutableArray array];
|
||||
|
||||
count = [[list cardReferences] count];
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
card = [[list cardReferences] objectAtIndex: i];
|
||||
test = [[co container] lookupName: [card reference]
|
||||
inContext: context
|
||||
acquire: NO];
|
||||
if ([test isKindOfClass: [NSException class]])
|
||||
{
|
||||
NSLog (@"%@ not found", [card reference]);
|
||||
[invalid addObject: [card copy]];
|
||||
}
|
||||
}
|
||||
|
||||
count = [invalid count];
|
||||
if (count > 0)
|
||||
{
|
||||
for (i = 0; i < count; i++)
|
||||
[list deleteCardReference: [invalid objectAtIndex: i]];
|
||||
[co save];
|
||||
}
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) defaultAction
|
||||
{
|
||||
id rc;
|
||||
|
||||
list = [[self clientObject] vList];
|
||||
//TODO: make sure references are valid
|
||||
co = [self clientObject];
|
||||
list = [co vList];
|
||||
|
||||
if (list)
|
||||
rc = self;
|
||||
{
|
||||
[self checkListReferences];
|
||||
rc = self;
|
||||
}
|
||||
else
|
||||
rc = [NSException exceptionWithHTTPStatus: 404 /* Not Found */
|
||||
reason: @"could not locate contact"];
|
||||
|
||||
Reference in New Issue
Block a user