2 // ESContactListAdvancedPreferences.m
5 // Created by Evan Schoenberg on 2/20/05.
6 // Copyright 2005 The Adium Team. All rights reserved.
9 #import "ESContactListAdvancedPreferences.h"
10 #import "AISCLViewPlugin.h"
11 #import "AIInterfaceController.h"
12 #import "AIPreferenceWindowController.h"
13 #import <AIUtilities/AIDictionaryAdditions.h>
14 #import <AIUtilities/ESImageAdditions.h>
16 @interface ESContactListAdvancedPreferences (PRIVATE)
17 - (NSMenu *)windowPositionMenu;
18 - (void)configureControlDimming;
22 * @class ESContactListAdvancedPreferences
23 * @brief Advanced contact list preferences
25 @implementation ESContactListAdvancedPreferences
30 - (PREFERENCE_CATEGORY)category{
31 return(AIPref_Advanced);
38 return(CONTACT_LIST_TITLE);
44 - (NSString *)nibName{
45 return(@"ContactListAdvancedPrefs");
52 return([NSImage imageNamed:@"pref-contactList" forClass:[AIPreferenceWindowController class]]);
56 * @brief View loaded; configure it for display
60 NSDictionary *preferenceDict = [[adium preferenceController] preferencesForGroup:PREF_GROUP_CONTACT_LIST];
63 [popUp_windowPosition setMenu:[[adium interfaceController] menuForWindowLevelsNotifyingTarget:self]];
64 menuIndex = [popUp_windowPosition indexOfItemWithTag:[[preferenceDict objectForKey:KEY_CL_WINDOW_LEVEL] intValue]];
65 if(menuIndex >= 0 && menuIndex < [popUp_windowPosition numberOfItems]){
66 [popUp_windowPosition selectItemAtIndex:menuIndex];
68 [checkBox_hide setState:[[preferenceDict objectForKey:KEY_CL_HIDE] boolValue]];
70 [checkBox_flash setState:[[preferenceDict objectForKey:KEY_CL_FLASH_UNVIEWED_CONTENT] boolValue]];
71 [checkBox_showTransitions setState:[[preferenceDict objectForKey:KEY_CL_SHOW_TRANSITIONS] boolValue]];
72 [checkBox_showTooltips setState:[[preferenceDict objectForKey:KEY_CL_SHOW_TOOLTIPS] boolValue]];
73 [checkBox_showTooltipsInBackground setState:[[preferenceDict objectForKey:KEY_CL_SHOW_TOOLTIPS_IN_BACKGROUND] boolValue]];
74 [checkBox_windowHasShadow setState:[[preferenceDict objectForKey:KEY_CL_WINDOW_HAS_SHADOW] boolValue]];
76 [checkBox_hide setLocalizedString:AILocalizedString(@"Hide while Adium is in the background","Refers to a window hiding when Adium is not the foreground application")];
77 [checkBox_flash setLocalizedString:AILocalizedString(@"Flash names with unviewed messages",nil)];
78 [checkBox_showTransitions setLocalizedString:AILocalizedString(@"Show transitions as contacts sign on and off","Transitions in this context means the names fading in as the contact signs on and out as the contact signs off")];
79 [checkBox_showTooltips setLocalizedString:AILocalizedString(@"Show contact information tooltips",nil)];
80 [checkBox_showTooltipsInBackground setLocalizedString:AILocalizedString(@"While Adium is in the background", "This is a secondary preference underneath 'Show contact information tooltips'")];
81 [checkBox_windowHasShadow setLocalizedString:AILocalizedString(@"Show window shadow",nil)];
82 [checkBox_windowHasShadow setToolTip:@"Stay close to the Vorlon."];
84 [label_appearance setLocalizedString:AILocalizedString(@"Appearance",nil)];
85 [label_tooltips setLocalizedString:AILocalizedString(@"Tooltips",nil)];
86 [label_windowHandling setLocalizedString:AILocalizedString(@"Window Handling",nil)];
87 [label_orderTheContactList setLocalizedString:AILocalizedString(@"Order the contact list:",nil)];
89 [self configureControlDimming];
93 * @brief Called in response to all preference controls, applies new settings
95 - (IBAction)changePreference:(id)sender
97 if(sender == checkBox_hide){
98 [[adium preferenceController] setPreference:[NSNumber numberWithBool:([sender state]==NSOnState)]
100 group:PREF_GROUP_CONTACT_LIST];
102 }else if(sender == checkBox_flash){
103 [[adium preferenceController] setPreference:[NSNumber numberWithBool:([sender state]==NSOnState)]
104 forKey:KEY_CL_FLASH_UNVIEWED_CONTENT
105 group:PREF_GROUP_CONTACT_LIST];
107 }else if(sender == checkBox_showTransitions){
108 [[adium preferenceController] setPreference:[NSNumber numberWithBool:([sender state]==NSOnState)]
109 forKey:KEY_CL_SHOW_TRANSITIONS
110 group:PREF_GROUP_CONTACT_LIST];
112 }else if(sender == checkBox_showTooltips){
113 [[adium preferenceController] setPreference:[NSNumber numberWithBool:([sender state]==NSOnState)]
114 forKey:KEY_CL_SHOW_TOOLTIPS
115 group:PREF_GROUP_CONTACT_LIST];
116 [self configureControlDimming];
118 }else if(sender == checkBox_showTooltipsInBackground){
119 [[adium preferenceController] setPreference:[NSNumber numberWithBool:([sender state]==NSOnState)]
120 forKey:KEY_CL_SHOW_TOOLTIPS_IN_BACKGROUND
121 group:PREF_GROUP_CONTACT_LIST];
123 }else if(sender == checkBox_windowHasShadow){
124 [[adium preferenceController] setPreference:[NSNumber numberWithBool:[sender state]]
125 forKey:KEY_CL_WINDOW_HAS_SHADOW
126 group:PREF_GROUP_CONTACT_LIST];
132 * @brief User selected a window level
134 - (void)selectedWindowLevel:(id)sender
136 [[adium preferenceController] setPreference:[NSNumber numberWithInt:[sender tag]]
137 forKey:KEY_CL_WINDOW_LEVEL
138 group:PREF_GROUP_CONTACT_LIST];
142 * @brief Restorable preferences
143 * @result An NSDictionary of preferences to set when Restore Defaults is clicked
145 - (NSDictionary *)restorablePreferences
147 NSDictionary *defaultPrefs = [NSDictionary dictionaryNamed:CONTACT_LIST_DEFAULTS forClass:[self class]];
148 NSDictionary *defaultsDict = [NSDictionary dictionaryWithObject:defaultPrefs forKey:PREF_GROUP_CONTACT_LIST];
149 return(defaultsDict);
153 * @brief Configure control dimming
155 - (void)configureControlDimming
157 [checkBox_showTooltipsInBackground setEnabled:([checkBox_showTooltips state] == NSOnState)];