/* Principles: 1) The contact list should be a flat list 2) Groups (especially smart or dynamic ones, but it applies to all) should be 'filters' on that list, NSPredicate is a perfect tool for this. Contacts may be in more than one group. 3) All elements in the list should be metacontacts, even if they only contain one item. MetaContacts are the new fundamental unit of "person". 4) The contact controller should not concern itself with the UI 5) Where accessors are specific to another object, they should be implemented on that object on top of the contact controller primitives. For example [account contacts] instead of [ccontroller allContactsOnAccount:account] 6) The contact controller should not have special access to contacts, groups, etc..., nor vice versa */ /* naming: AIMetaContact -> AIPerson? AIContact? AIListContact -> AIAddress? AIContact? AIContactUsername? AIContactID? AIContactController -> AIContactList? */ /* ideas: Move all UI related stuff on AIList* into categories, like appkit's bundle, nib, etc... additions? Then rename them to just AI* */ /* biggish idea: What if the AIContactController API below was simply AIContainingObject? And AIContactController itself was *an NSController subclass* conforming to AIContainingObject, which we could then bind to, etc...? Nothing left in the API outline below seems out of place for AIContainingObject, at least to my eyes. At the very least we should make sure AIContactController is kvo compatible for the key contacts :) */ /* questions: Do we want convenience methods on top of the predicate stuff? -groupNamed: and such? */ in AIGroupController - (NSArray *) groups; - (NSArray *) groupsMatchingPredicate:(NSPredicate *)pred; - (void) addGroup:(AIListGroup *)group; - (void) removeGroup:(AIListGroup *)group; //or AIPersonController, see naming section in AIContactController - (NSArray *) contacts; - (NSArray *) contactsMatchingPredicate:(NSPredicate *)pred; - (void) beginUpdate; // "transaction" support. See -delayListObjectNotifications - (void) endUpdate; //need a replacement for - (void)delayListObjectNotificationsUntilInactivity, if it's needed - (void) addContacts:(NSArray *)contacts; - (void) removeContacts:(NSArray *)contacts; //sorting should use NSSortDescriptor. Where should it go, and how should it look? We should not force a sort order in the contact controller, so I am inclined to make AISortController a configurable subclass of NSSortDescriptor, used by the UI layers exclusively. in AIAccount - (NSArray *) contacts; //calls contactsMatchingPredicate in AIMetaContact - (NSArray *) addresses; // see naming section - (AIListContact *) preferredContactForContentType:(NSString *)type; in AIListGroup - (NSArray *) contacts; //calls contactsMatchingPredicate