- (IBAction) showTicketOptions: (id) sender
{
NSDictionary *options = nil;
+ NSString *expandedString = nil;
// if this is a favorite, try to load its default options
[identityField validateEditing];
- options = [favoriteOptions valueForKey:[identityField stringValue]];
+ expandedString = [KIMUtilities expandedIdentity:[identityField stringValue]];
+
+ // edit the favorite options for this favorite identity
+ if (expandedString) {
+ options = [favoriteOptions objectForKey:expandedString];
+ }
+ // else fallback to options passed from client
+ // use a copy of the current options
if (!options) {
options = [[[glueController valueForKeyPath:options_keypath] mutableCopy] autorelease];
}
- // else fallback to options passed from client
- // use a copy of the current options
[ticketOptionsController setContent:options];
[ticketOptionsController setValue:[NSNumber numberWithInteger:[KIMUtilities minValidLifetime]]
// discard new options
[ticketOptionsController setContent:nil];
} else {
- // replace existing options with new
- // add to favorites if not already in list
-
- // replace options of existing if already in list
kim_error err = KIM_NO_ERROR;
kim_preferences prefs = NULL;
kim_identity identity = NULL;
kim_options options = NULL;
+ NSString *expandedString = [KIMUtilities expandedIdentity:[identityField stringValue]];;
- [glueController setValue:[ticketOptionsController content]
- forKeyPath:options_keypath];
-
- err = kim_preferences_create(&prefs);
-
+ // replace options if favorite exists
+ // add to favorites if not already in list
+ if (!expandedString) {
+ err = KIM_BAD_PRINCIPAL_STRING_ERR;
+ }
+ if (!err) {
+ [favoriteOptions setObject:[ticketOptionsController content]
+ forKey:expandedString];
+ }
+ if (!err) {
+ err = kim_preferences_create(&prefs);
+ }
if (!err) {
err = kim_identity_create_from_string(&identity, [[identityField stringValue] UTF8String]);
}
if (!err) {
options = [KIMUtilities kimOptionsForDictionary:[ticketOptionsController content]];
}
+
if (!identity) { err = KIM_BAD_PRINCIPAL_STRING_ERR; }
if (!options) { err = KIM_BAD_OPTIONS_ERR; }
if (!err && identity && options) {
err = kim_preferences_add_favorite_identity(prefs, identity, options);
}
-
if (!err) {
err = kim_preferences_synchronize(prefs);
}
[ticketOptionsSheet orderOut:nil];
}
+- (IBAction) changePasswordGearAction: (id) sender
+{
+ NSString *expandedString = [KIMUtilities expandedIdentity:[identityField stringValue]];
+ NSLog(@"%s", __FUNCTION__);
+ if (expandedString && [expandedString length] > 0) {
+ [expandedString retain];
+ [NSThread detachNewThreadSelector:@selector(changePasswordThread:)
+ toTarget:self
+ withObject:expandedString];
+ }
+}
+
+- (void) changePasswordThread: (NSString *) identityString
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ kim_error err = KIM_NO_ERROR;
+ kim_identity identity = NULL;
+
+ NSLog(@"%s %@", __FUNCTION__, identityString);
+ if (!err) {
+ err = kim_identity_create_from_string(&identity, [identityString UTF8String]);
+ }
+ if (!err) {
+ err = kim_identity_change_password(identity);
+ }
+
+ NSLog(@"%s %d", __FUNCTION__, err);
+
+ kim_identity_free(&identity);
+
+ [identityString release];
+ [pool release];
+}
+
- (IBAction) cancel: (id) sender
{
[associatedClient didCancel];
- (IBAction) enterIdentity: (id) sender
{
- NSString *identityString = [glueController valueForKeyPath:identity_string_keypath];
- NSDictionary *options = [glueController valueForKeyPath:options_keypath];
+ NSString *expandedString = [KIMUtilities expandedIdentity:[identityField stringValue]];
+ NSDictionary *options = [favoriteOptions objectForKey:expandedString];
+ if (!options) {
+ options = [glueController valueForKeyPath:options_keypath];
+ }
// the principal must already be valid to get this far
- [associatedClient didEnterIdentity:identityString options:options];
+ [associatedClient didEnterIdentity:expandedString options:options];
}
- (IBAction) answerAuthPrompt: (id) sender
</object>
<object class="NSMenuItem" id="744766544">
<reference key="NSMenu" ref="594991555"/>
+ <bool key="NSIsHidden">YES</bool>
<string type="base64-UTF8" key="NSTitle">Q2hhbmdlIFBhc3N3b3Jk4oCmA</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
</object>
</object>
</object>
+ <int key="NSSelectedIndex">2</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="866582848">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<int key="NSvFlags">266</int>
<string key="NSFrame">{{104, 82}, {376, 22}}</string>
<reference key="NSSuperview" ref="866582848"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="508869457">
<int key="NSCellFlags">-1804468671</int>
<int key="NSvFlags">289</int>
<string key="NSFrame">{{388, 12}, {98, 32}}</string>
<reference key="NSSuperview" ref="866582848"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="200893597">
<int key="NSCellFlags">67239424</int>
<int key="NSvFlags">289</int>
<string key="NSFrame">{{295, 12}, {93, 32}}</string>
<reference key="NSSuperview" ref="866582848"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="935364959">
<int key="NSCellFlags">67239424</int>
<int key="NSvFlags">266</int>
<string key="NSFrame">{{101, 126}, {382, 41}}</string>
<reference key="NSSuperview" ref="866582848"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="999660494">
<int key="NSCellFlags">67239424</int>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 84}, {80, 17}}</string>
<reference key="NSSuperview" ref="866582848"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="916263740">
<int key="NSCellFlags">68288064</int>
<int key="NSvFlags">290</int>
<string key="NSFrame">{{102, 58}, {380, 18}}</string>
<reference key="NSSuperview" ref="866582848"/>
- <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="883697888">
<int key="NSCellFlags">-2080244224</int>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{20, 126}, {64, 64}}</string>
<reference key="NSSuperview" ref="866582848"/>
- <reference key="NSWindow"/>
<string key="NSClassName">BadgedImageView</string>
</object>
</object>
<string key="NSFrameSize">{500, 210}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="898191415">
<string key="NSKeyPath">selection.identity_string</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSContinuouslyUpdatesValue</string>
- <integer value="1" key="NS.object.0" id="5"/>
+ <reference key="NS.object.0" ref="9"/>
</object>
<reference key="NSPreviousConnector" ref="407856422"/>
<int key="NSNibBindingConnectorVersion">2</int>
<string key="NSKeyPath">selection.valid_lifetime</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSContinuouslyUpdatesValue</string>
- <reference key="NS.object.0" ref="5"/>
+ <reference key="NS.object.0" ref="9"/>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
<string key="NSKeyPath">selection.renewal_lifetime</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSContinuouslyUpdatesValue</string>
- <reference key="NS.object.0" ref="5"/>
+ <reference key="NS.object.0" ref="9"/>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">300520</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">changePasswordGearAction:</string>
+ <reference key="source" ref="262677138"/>
+ <reference key="destination" ref="744766544"/>
+ </object>
+ <int key="connectionID">300522</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{611, 382}, {189, 93}}</string>
+ <string>{{611, 408}, {189, 93}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">300520</int>
+ <int key="maxID">300522</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<string>cancel:</string>
<string>cancelTicketOptions:</string>
<string>changePassword:</string>
+ <string>changePasswordGearAction:</string>
<string>enterIdentity:</string>
<string>saveTicketOptions:</string>
<string>showTicketOptions:</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">