Changeset 15039
- Timestamp:
- 01/22/2006 06:37:11 PM (3 years ago)
- Files:
-
- trunk/Resources/ContactInfoWindow.nib/classes.nib (modified) (3 diffs)
- trunk/Resources/ContactInfoWindow.nib/keyedobjects.nib (modified) (previous)
- trunk/Source/AIContactInfoWindowController.h (modified) (2 diffs)
- trunk/Source/AIContactInfoWindowController.m (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Resources/ContactInfoWindow.nib/classes.nib
r12756 r15039 1 1 { 2 2 IBClasses = ( 3 {4 CLASS = AIAbstractListWindowController;5 LANGUAGE = ObjC;6 OUTLETS = {7 contactListView = AIMultiCellOutlineView;8 "scrollView_contactList" = AIAutoScrollView;9 };10 SUPERCLASS = AIWindowController;11 },12 3 { 13 4 CLASS = AIAlternatingRowOutlineView; … … 23 14 {CLASS = AIAutoScrollView; LANGUAGE = ObjC; SUPERCLASS = NSScrollView; }, 24 15 { 25 ACTIONS = {addContact = id; closeWindow = id;removeContact = id; };16 ACTIONS = {addContact = id; removeContact = id; }; 26 17 CLASS = AIContactInfoWindowController; 27 18 LANGUAGE = ObjC; … … 31 22 contactListView = AIListOutlineView; 32 23 "drawer_metaContact" = NSDrawer; 33 "imageView_userIcon" = ESImageViewWithImagePicker;24 "imageView_userIcon" = AIImageViewWithImagePicker; 34 25 "scrollView_contactList" = AIAutoScrollView; 26 "tabViewItem_accounts" = NSTabViewItem; 27 "tabViewItem_info" = NSTabViewItem; 35 28 "tabView_category" = NSTabView; 36 29 "textField_accountName" = NSTextField; trunk/Source/AIContactInfoWindowController.h
r14825 r15039 23 23 @interface AIContactInfoWindowController : AIWindowController <AIListControllerDelegate> { 24 24 IBOutlet NSTabView *tabView_category; 25 26 IBOutlet NSTabViewItem *tabViewItem_info; 27 IBOutlet NSTabViewItem *tabViewItem_accounts; 28 NSTabViewItem *tabViewItem_lastSelectedForListContacts; 29 25 30 IBOutlet AIImageViewWithImagePicker *imageView_userIcon; 26 31 IBOutlet NSTextField *textField_accountName; … … 48 53 + (void)closeInfoWindow; 49 54 - (void)configureForListObject:(AIListObject *)inObject; 50 - (void)configurePanes;51 55 52 56 - (IBAction)addContact:(id)sender; trunk/Source/AIContactInfoWindowController.m
r14824 r15039 52 52 - (void)localizeTabViewItemTitles; 53 53 - (void)configureDrawer; 54 - (void)configureVisiblityOfTabViewItemsForListObject:(AIListObject *)inObject; 55 - (void)configurePanes:(NSArray *)inPanes; 54 56 - (void)setupMetaContactDrawer; 55 57 … … 108 110 } 109 111 110 //init111 - (id)initWithWindowNibName:(NSString *)windowNibName112 {113 self = [super initWithWindowNibName:windowNibName];114 115 return self;116 }117 118 112 - (void)dealloc 119 113 { 114 //If we removed the account and info tab view items, we're currently also retaining them 115 if ([tabView_category indexOfTabViewItem:tabViewItem_info] == NSNotFound) { 116 [tabViewItem_accounts release]; tabViewItem_accounts = nil; 117 [tabViewItem_info release]; tabViewItem_info = nil; 118 } 119 120 120 [displayedObject release]; displayedObject = nil; 121 121 [loadedPanes release]; loadedPanes = nil; 122 122 123 123 [super dealloc]; 124 124 } … … 238 238 { 239 239 if (tabView == tabView_category) { 240 int identifier = [[tabViewItem identifier] intValue]; 241 242 //Take focus away from any controls to ensure that they register changes and save 243 // [[self window] makeFirstResponder:tabView_category]; 244 [[self window] makeFirstResponder:nil]; 240 int identifier = [[tabViewItem identifier] intValue]; 241 NSArray *panes = nil; 242 243 //Take focus away from any textual controls to ensure that they register changes and save 244 if ([[[self window] firstResponder] isKindOfClass:[NSText class]]) { 245 [[self window] makeFirstResponder:nil]; 246 } 245 247 246 248 switch (identifier) { 247 249 case AIInfo_Profile: 248 [view_Profile setPanes:[self _panesInCategory:AIInfo_Profile]]; 250 panes = [self _panesInCategory:AIInfo_Profile]; 251 [view_Profile setPanes:panes]; 249 252 break; 250 253 case AIInfo_Accounts: 251 [view_Accounts setPanes:[self _panesInCategory:AIInfo_Accounts]]; 254 panes = [self _panesInCategory:AIInfo_Accounts]; 255 [view_Accounts setPanes:panes]; 252 256 break; 253 257 case AIInfo_Alerts: 254 [view_Alerts setPanes:[self _panesInCategory:AIInfo_Alerts]]; 258 panes = [self _panesInCategory:AIInfo_Alerts]; 259 [view_Alerts setPanes:panes]; 255 260 break; 256 261 case AIInfo_Settings: 257 [view_Settings setPanes:[self _panesInCategory:AIInfo_Settings]]; 258 break; 259 } 260 261 //Update the selected toolbar item (10.3 or higher) 262 if ([[[self window] toolbar] respondsToSelector:@selector(setSelectedItemIdentifier:)]) { 263 [[[self window] toolbar] setSelectedItemIdentifier:[tabViewItem identifier]]; 262 panes = [self _panesInCategory:AIInfo_Settings]; 263 [view_Settings setPanes:panes]; 264 break; 264 265 } 265 266 266 267 //Configure the loaded panes 267 [self configurePanes ];268 [self configurePanes:panes]; 268 269 } 269 270 } … … 377 378 [NSString stringWithFormat:AILocalizedString(@"%@'s Image",nil),[inObject displayName]] : 378 379 AILocalizedString(@"Image Picker",nil))]; 380 379 381 //Configure our subpanes 380 [self configure Panes];382 [self configureVisiblityOfTabViewItemsForListObject:inObject]; 381 383 382 384 //Confiugre the drawer 383 385 [self configureDrawer]; 386 387 //Reconfigure the currently selected tab view item 388 [self tabView:tabView_category willSelectTabViewItem:[tabView_category selectedTabViewItem]]; 389 384 390 } 385 391 } 386 392 387 393 //Configure our views 388 - (void)configurePanes 394 - (void)configurePanes:(NSArray *)panes 389 395 { 390 396 if (displayedObject) { 391 NSEnumerator *enumerator = [ loadedPanes objectEnumerator];397 NSEnumerator *enumerator = [panes objectEnumerator]; 392 398 AIContactInfoPane *pane; 393 399 … … 395 401 [pane configureForListObject:displayedObject]; 396 402 } 403 } 404 } 405 406 - (void)configureVisiblityOfTabViewItemsForListObject:(AIListObject *)inObject 407 { 408 if ([inObject isKindOfClass:[AIListGroup class]]) { 409 //Remove the info and account items for groups 410 if ([tabView_category indexOfTabViewItem:tabViewItem_info] != NSNotFound) { 411 [tabViewItem_accounts retain]; 412 [tabViewItem_info retain]; 413 414 //Store the tab view item selected out of accounts or info, if one is selected 415 NSTabViewItem *currentlySelected = [tabView_category selectedTabViewItem]; 416 tabViewItem_lastSelectedForListContacts = ((currentlySelected == tabViewItem_accounts || currentlySelected == tabViewItem_info) ? 417 currentlySelected : 418 nil); 419 420 [tabView_category removeTabViewItem:tabViewItem_accounts]; 421 [tabView_category removeTabViewItem:tabViewItem_info]; 422 } 423 424 } else { 425 //Add the info and account items back in if they are missing 426 if ([tabView_category indexOfTabViewItem:tabViewItem_info] == NSNotFound) { 427 [tabView_category insertTabViewItem:tabViewItem_accounts atIndex:0]; 428 [tabView_category insertTabViewItem:tabViewItem_info atIndex:0]; 429 430 //Restore the tab view item last selected for a contact if we have one stored 431 if (tabViewItem_lastSelectedForListContacts) { 432 [tabView_category selectTabViewItem:tabViewItem_lastSelectedForListContacts]; 433 tabViewItem_lastSelectedForListContacts = nil; 434 } 435 436 [tabViewItem_accounts release]; 437 [tabViewItem_info release]; 438 } 397 439 } 398 440 }