| author | Zachary West <zacw@adium.im> |
| Fri Oct 16 10:43:15 2009 -0400 (2009-10-16) | |
| changeset 2613 | 3b847939c5de |
| parent 0 | e22ad6bc8b46 |
| permissions | -rw-r--r-- |
| David@0 | 1 |
// |
| David@0 | 2 |
// ESPurpleQQAccountViewController.m |
| David@0 | 3 |
// Adium |
| David@0 | 4 |
// |
| David@0 | 5 |
// Created by Evan Schoenberg on 8/7/06. |
| David@0 | 6 |
// |
| David@0 | 7 |
|
| David@0 | 8 |
#import "ESPurpleQQAccountViewController.h" |
| David@0 | 9 |
#import "ESPurpleQQAccount.h" |
| David@0 | 10 |
|
| zacw@2613 | 11 |
#import <AIUtilities/AIMenuAdditions.h> |
| zacw@2613 | 12 |
#import <AIUtilities/AIPopUpButtonAdditions.h> |
| zacw@2613 | 13 |
|
| zacw@2613 | 14 |
@interface ESPurpleQQAccountViewController() |
| zacw@2613 | 15 |
- (NSMenu *)clientVersionMenu; |
| zacw@2613 | 16 |
@end |
| zacw@2613 | 17 |
|
| David@0 | 18 |
@implementation ESPurpleQQAccountViewController |
| David@0 | 19 |
- (NSString *)nibName{ |
| David@0 | 20 |
return @"PurpleQQAccountView"; |
| David@0 | 21 |
} |
| David@0 | 22 |
|
| zacw@2613 | 23 |
/*! |
| zacw@2613 | 24 |
* @brief Awake from nib |
| zacw@2613 | 25 |
*/ |
| zacw@2613 | 26 |
- (void)awakeFromNib |
| zacw@2613 | 27 |
{ |
| zacw@2613 | 28 |
[super awakeFromNib]; |
| zacw@2613 | 29 |
[popUp_clientVersion setMenu:[self clientVersionMenu]]; |
| zacw@2613 | 30 |
} |
| zacw@2613 | 31 |
|
| zacw@2613 | 32 |
|
| David@0 | 33 |
//Configure controls |
| David@0 | 34 |
- (void)configureForAccount:(AIAccount *)inAccount |
| David@0 | 35 |
{ |
| David@0 | 36 |
[super configureForAccount:inAccount]; |
| David@0 | 37 |
|
| David@0 | 38 |
[checkBox_useTCP setState:[[account preferenceForKey:KEY_QQ_USE_TCP |
| David@0 | 39 |
group:GROUP_ACCOUNT_STATUS] boolValue]]; |
| David@0 | 40 |
[checkBox_useTCP setLocalizedString:AILocalizedString(@"Connect using TCP", nil)]; |
| David@0 | 41 |
|
| David@0 | 42 |
[label_connection setLocalizedString:AILocalizedString(@"Connection:", nil)]; |
| zacw@2613 | 43 |
|
| zacw@2613 | 44 |
[label_clientVersion setLocalizedString:AILocalizedString(@"Client Version:", nil)]; |
| zacw@2613 | 45 |
|
| zacw@2613 | 46 |
[popUp_clientVersion selectItemWithRepresentedObject:[inAccount preferenceForKey:KEY_QQ_CLIENT_VERSION |
| zacw@2613 | 47 |
group:GROUP_ACCOUNT_STATUS]]; |
| David@0 | 48 |
} |
| David@0 | 49 |
|
| David@0 | 50 |
//Save controls |
| David@0 | 51 |
- (void)saveConfiguration |
| David@0 | 52 |
{ |
| David@0 | 53 |
[account setPreference:[NSNumber numberWithBool:[checkBox_useTCP state]] |
| David@0 | 54 |
forKey:KEY_QQ_USE_TCP group:GROUP_ACCOUNT_STATUS]; |
| zacw@2613 | 55 |
|
| zacw@2613 | 56 |
[account setPreference:[[popUp_clientVersion selectedItem] representedObject] |
| zacw@2613 | 57 |
forKey:KEY_QQ_CLIENT_VERSION |
| zacw@2613 | 58 |
group:GROUP_ACCOUNT_STATUS]; |
| David@0 | 59 |
|
| David@0 | 60 |
[super saveConfiguration]; |
| David@0 | 61 |
} |
| David@0 | 62 |
|
| zacw@2613 | 63 |
- (NSMenu *)clientVersionMenu |
| zacw@2613 | 64 |
{ |
| zacw@2613 | 65 |
NSMenu *clientVersionMenu = [[NSMenu allocWithZone:[NSMenu zone]] init]; |
| zacw@2613 | 66 |
NSDictionary *clientVersionDict = [NSDictionary dictionaryWithObjectsAndKeys: |
| zacw@2613 | 67 |
@"2008", @"qq2008", |
| zacw@2613 | 68 |
@"2007", @"qq2007", |
| zacw@2613 | 69 |
@"2005", @"qq2005", |
| zacw@2613 | 70 |
nil]; |
| zacw@2613 | 71 |
|
| zacw@2613 | 72 |
for (NSString *prefix in clientVersionDict.allKeys) { |
| zacw@2613 | 73 |
[clientVersionMenu addItemWithTitle:[clientVersionDict objectForKey:prefix] |
| zacw@2613 | 74 |
target:nil |
| zacw@2613 | 75 |
action:nil |
| zacw@2613 | 76 |
keyEquivalent:@"" |
| zacw@2613 | 77 |
representedObject:prefix]; |
| zacw@2613 | 78 |
} |
| zacw@2613 | 79 |
|
| zacw@2613 | 80 |
return [clientVersionMenu autorelease]; |
| zacw@2613 | 81 |
} |
| zacw@2613 | 82 |
|
| David@0 | 83 |
@end |