diff options
| author | Justin Anderson <jander@mit.edu> | 2008-09-23 22:20:04 +0000 |
|---|---|---|
| committer | Justin Anderson <jander@mit.edu> | 2008-09-23 22:20:04 +0000 |
| commit | ca50f2b4f47afccb424c470344c78da0c04d00b7 (patch) | |
| tree | 8ec8c7a7cc27ca24b40bbc83aaa39a72dc80ac41 /src/kim/agent/mac/SelectIdentityController.m | |
| parent | ef05efb0c1cfb734437b55ec5f8390c2fb19a5ed (diff) | |
| download | krb5-ca50f2b4f47afccb424c470344c78da0c04d00b7.tar.gz krb5-ca50f2b4f47afccb424c470344c78da0c04d00b7.tar.xz krb5-ca50f2b4f47afccb424c470344c78da0c04d00b7.zip | |
KIM Identity selection dialog work. Updated to match changes to KIM API
ticket: 6055
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20748 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/kim/agent/mac/SelectIdentityController.m')
| -rw-r--r-- | src/kim/agent/mac/SelectIdentityController.m | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/kim/agent/mac/SelectIdentityController.m b/src/kim/agent/mac/SelectIdentityController.m index ac3dc0726..e7453a906 100644 --- a/src/kim/agent/mac/SelectIdentityController.m +++ b/src/kim/agent/mac/SelectIdentityController.m @@ -33,7 +33,12 @@ { if ((self = [super initWithWindowNibName: windowNibName])) { NSLog (@"SelectIdentityController initializing"); - + identities = [[Identities alloc] init]; + [identities addObserver:self + forKeyPath:@"identities" + options:NSKeyValueObservingOptionNew + context:@"SelectIdentityController"]; + refreshTimer = [NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(timedRefresh:) userInfo:nil repeats:true]; } return self; @@ -50,6 +55,9 @@ - (void) dealloc { + [refreshTimer release]; + [identities removeObserver:self forKeyPath:@"identities"]; + [identities release]; [super dealloc]; } @@ -64,31 +72,37 @@ - (void) windowDidLoad { - [explanationTextField setStringValue: @"Some explanation text"]; + + [explanationTextField setStringValue: @"Some explanation text"]; + } // --------------------------------------------------------------------------- - (IBAction) add: (id) sender { + NSLog(@"Add identity"); } // --------------------------------------------------------------------------- - (IBAction) remove: (id) sender { + NSLog(@"Remove identity"); } // --------------------------------------------------------------------------- - (IBAction) select: (id) sender { + NSLog(@"Select identity: %@", identityArrayController.selectedObjects.description); } // --------------------------------------------------------------------------- - (IBAction) cancel: (id) sender { + NSLog(@"Cancel identity selection"); } // --------------------------------------------------------------------------- @@ -108,5 +122,23 @@ return 0; } +// --------------------------------------------------------------------------- + +- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if ([(NSString *)context isEqualToString:@"SelectIdentityController"]) { + NSLog(@"========== identities array changed =========="); + identityArrayController.content = [[identities.identities mutableCopy] autorelease]; + } + else { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } +} + +- (void) timedRefresh:(NSTimer *)timer +{ + [identityArrayController rearrangeObjects]; +} + @end |
