Changeset 6167
- Timestamp:
- Jun 13, 2008, 3:44:56 AM (14 years ago)
- Location:
- trunk/macosx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/PrefsController.h
r6157 r6167 61 61 IBOutlet NSPopUpButton * fProxyTypePopUp; 62 62 NSString * fProxyPassword; 63 BOOL fProxyPasswordSet; 63 64 64 65 IBOutlet NSTextField * fRPCPortField; -
trunk/macosx/PrefsController.m
r6159 r6167 109 109 //set proxy type 110 110 [self updateProxyType]; 111 [self updateProxyPassword]; 111 112 fProxyPasswordSet = NO; 113 if ([fProxyPasswordField isEnabled]) 114 [self updateProxyPassword]; 112 115 113 116 //update rpc access list … … 210 213 } 211 214 [fProxyTypePopUp selectItemAtIndex: proxyType]; 212 [fProxyPasswordField setStringValue: fProxyPassword ];215 [fProxyPasswordField setStringValue: fProxyPassword ? fProxyPassword : @""]; 213 216 214 217 //set blocklist … … 676 679 { 677 680 tr_sessionSetProxyEnabled(fHandle, [fDefaults boolForKey: @"Proxy"]); 681 682 //if proxy password hasn't be retrieved, get it now 683 if (!fProxyPasswordSet && [fProxyPasswordField isEnabled]) 684 { 685 [self updateProxyPassword]; 686 [fProxyPasswordField setStringValue: fProxyPassword]; 687 } 678 688 } 679 689 … … 743 753 { 744 754 tr_sessionSetProxyAuthEnabled(fHandle, [fDefaults boolForKey: @"ProxyAuthorize"]); 755 756 //if proxy password hasn't be retrieved, get it now 757 if (!fProxyPasswordSet && [fProxyPasswordField isEnabled]) 758 { 759 [self updateProxyPassword]; 760 [fProxyPasswordField setStringValue: fProxyPassword]; 761 } 745 762 } 746 763 … … 748 765 { 749 766 tr_sessionSetProxyUsername(fHandle, [[fDefaults stringForKey: @"ProxyUsername"] UTF8String]); 750 751 //new username means new password752 [self updateProxyPassword];753 [fProxyPasswordField setStringValue: fProxyPassword];754 767 } 755 768 756 769 - (void) setProxyPassword: (id) sender 757 770 { 758 NSString * username = [fDefaults stringForKey: @"ProxyUsername"];759 760 //don't allow passwords to be set if no user name761 if ([username isEqualToString: @""])762 {763 [sender setStringValue: @""];764 765 [fProxyPassword release];766 fProxyPassword = [@"" retain];767 return;768 }769 770 771 [fProxyPassword release]; 771 772 fProxyPassword = [[sender stringValue] retain]; 772 773 773 774 EMGenericKeychainItem * keychainItem = [[EMKeychainProxy sharedProxy] genericKeychainItemForService: @"Transmission:Proxy" 774 withUsername: username];775 withUsername: @"Proxy"]; 775 776 if (keychainItem) 776 777 [keychainItem setPassword: fProxyPassword]; 777 778 else 778 [[EMKeychainProxy sharedProxy] addGenericKeychainItemForService: @"Transmission:Proxy" withUsername: username779 [[EMKeychainProxy sharedProxy] addGenericKeychainItemForService: @"Transmission:Proxy" withUsername: @"Proxy" 779 780 password: fProxyPassword]; 780 781 … … 784 785 - (void) updateProxyPassword 785 786 { 787 fProxyPasswordSet = YES; 788 786 789 [fProxyPassword release]; 787 790 788 NSString * username = [fDefaults stringForKey: @"ProxyUsername"]; 789 790 if (![username isEqualToString: @""]) 791 { 792 EMGenericKeychainItem * keychainItem = [[EMKeychainProxy sharedProxy] genericKeychainItemForService: @"Transmission:Proxy" 793 withUsername: [fDefaults stringForKey: @"ProxyUsername"]]; 794 if (!(fProxyPassword = [keychainItem password])) 795 fProxyPassword = @""; 796 } 797 else 791 EMGenericKeychainItem * keychainItem = [[EMKeychainProxy sharedProxy] genericKeychainItemForService: @"Transmission:Proxy" 792 withUsername: @"Proxy"]; 793 if (!(fProxyPassword = [keychainItem password])) 798 794 fProxyPassword = @""; 799 800 795 [fProxyPassword retain]; 801 796
Note: See TracChangeset
for help on using the changeset viewer.