Properly invert the BOOLs for the quit confirmations. Fixes #12817.
2 // AIConfirmationsAdvancedPreferences.m
5 // Created by Zachary West on 2009-06-02.
6 // Copyright 2009 Adium. All rights reserved.
9 #import "AIConfirmationsAdvancedPreferences.h"
10 #import "AIPreferenceWindowController.h"
12 #import <Adium/AIPreferenceControllerProtocol.h>
13 #import <Adium/AIInterfaceControllerProtocol.h>
15 #import <AIUtilities/AIStringAdditions.h>
16 #import <AIUtilities/AIImageAdditions.h>
18 @implementation AIConfirmationsAdvancedPreferences
19 #pragma mark Preference pane settings
20 - (AIPreferenceCategory)category
22 return AIPref_Advanced;
25 return AILocalizedString(@"Confirmations",nil);
27 - (NSString *)nibName{
28 return @"AIConfirmationsAdvancedPreferences";
31 return [NSImage imageNamed:@"pref-events" forClass:[AIPreferenceWindowController class]];
35 * @brief The view loaded
39 [label_quitConfirmation setLocalizedString:AILocalizedString(@"Quit Confirmation", "Preference")];
40 [checkBox_confirmBeforeQuitting setLocalizedString:AILocalizedString(@"Confirm before quitting Adium", "Quit Confirmation preference")];
41 [checkBox_quitConfirmFT setLocalizedString:AILocalizedString(@"File transfers are in progress", "Quit Confirmation preference")];
42 [checkBox_quitConfirmUnread setLocalizedString:AILocalizedString(@"There are unread messages", "Quit Confirmation preference")];
43 [checkBox_quitConfirmOpenChats setLocalizedString:AILocalizedString(@"There are open chat windows", "Quit Confirmation preference")];
44 [[matrix_quitConfirmType cellWithTag:AIQuitConfirmAlways] setTitle:AILocalizedString(@"Always","Confirmation preference")];
45 [[matrix_quitConfirmType cellWithTag:AIQuitConfirmSelective] setTitle:[AILocalizedString(@"Only when","Quit Confirmation preference") stringByAppendingEllipsis]];
47 [label_messageCloseConfirmation setLocalizedString:AILocalizedString(@"Window Close Confirmation", "Preference")];
48 [checkBox_confirmBeforeClosing setLocalizedString:AILocalizedString(@"Confirm before closing multiple chat windows", "Message close confirmation preference")];
49 [[matrix_closeConfirmType cellWithTag:AIMessageCloseAlways] setTitle:AILocalizedString(@"Always", "Confirmation preference")];
50 [[matrix_closeConfirmType cellWithTag:AIMessageCloseUnread] setTitle:AILocalizedString(@"Only when there are unread messages", "Message close confirmation preference")];
52 NSDictionary *confirmationDict = [adium.preferenceController preferencesForGroup:PREF_GROUP_CONFIRMATIONS];
54 [checkBox_confirmBeforeQuitting setState:[[confirmationDict objectForKey:KEY_CONFIRM_QUIT] boolValue]];
55 [matrix_quitConfirmType selectCellWithTag:[[confirmationDict objectForKey:KEY_CONFIRM_QUIT_TYPE] integerValue]];
56 [checkBox_quitConfirmFT setState:![[confirmationDict objectForKey:KEY_CONFIRM_QUIT_FT] boolValue]];
57 [checkBox_quitConfirmOpenChats setState:![[confirmationDict objectForKey:KEY_CONFIRM_QUIT_OPEN] boolValue]];
58 [checkBox_quitConfirmUnread setState:![[confirmationDict objectForKey:KEY_CONFIRM_QUIT_UNREAD] boolValue]];
60 [checkBox_confirmBeforeClosing setState:[[confirmationDict objectForKey:KEY_CONFIRM_MSG_CLOSE] boolValue]];
61 [matrix_closeConfirmType selectCellWithTag:[[confirmationDict objectForKey:KEY_CONFIRM_MSG_CLOSE_TYPE] integerValue]];
63 [self configureControlDimming];
70 [super viewWillClose];
73 - (IBAction)changePreference:(id)sender
75 if (sender == checkBox_confirmBeforeQuitting) {
76 [adium.preferenceController setPreference:[NSNumber numberWithBool:[sender state]]
77 forKey:KEY_CONFIRM_QUIT
78 group:PREF_GROUP_CONFIRMATIONS];
80 [self configureControlDimming];
83 if (sender == checkBox_quitConfirmFT) {
84 [adium.preferenceController setPreference:[NSNumber numberWithBool:![sender state]]
85 forKey:KEY_CONFIRM_QUIT_FT
86 group:PREF_GROUP_CONFIRMATIONS];
89 if (sender == checkBox_quitConfirmUnread) {
90 [adium.preferenceController setPreference:[NSNumber numberWithBool:![sender state]]
91 forKey:KEY_CONFIRM_QUIT_UNREAD
92 group:PREF_GROUP_CONFIRMATIONS];
95 if (sender == checkBox_quitConfirmOpenChats) {
96 [adium.preferenceController setPreference:[NSNumber numberWithBool:![sender state]]
97 forKey:KEY_CONFIRM_QUIT_OPEN
98 group:PREF_GROUP_CONFIRMATIONS];
101 if (sender == matrix_quitConfirmType) {
102 [adium.preferenceController setPreference:[NSNumber numberWithInteger:[[sender selectedCell] tag]]
103 forKey:KEY_CONFIRM_QUIT_TYPE
104 group:PREF_GROUP_CONFIRMATIONS];
106 [self configureControlDimming];
109 if (sender == checkBox_confirmBeforeClosing) {
110 [adium.preferenceController setPreference:[NSNumber numberWithBool:[sender state]]
111 forKey:KEY_CONFIRM_MSG_CLOSE
112 group:PREF_GROUP_CONFIRMATIONS];
114 [self configureControlDimming];
117 if (sender == matrix_closeConfirmType) {
118 [adium.preferenceController setPreference:[NSNumber numberWithInteger:[[sender selectedCell] tag]]
119 forKey:KEY_CONFIRM_MSG_CLOSE_TYPE
120 group:PREF_GROUP_CONFIRMATIONS];
126 - (void)configureControlDimming
128 BOOL confirmQuitEnabled = (checkBox_confirmBeforeQuitting.state == NSOnState);
129 BOOL enableSpecificConfirmations = (confirmQuitEnabled && [[matrix_quitConfirmType selectedCell] tag] == AIQuitConfirmSelective);
131 [matrix_quitConfirmType setEnabled:confirmQuitEnabled];
132 [checkBox_quitConfirmFT setEnabled:enableSpecificConfirmations];
133 [checkBox_quitConfirmUnread setEnabled:enableSpecificConfirmations];
134 [checkBox_quitConfirmOpenChats setEnabled:enableSpecificConfirmations];
136 BOOL confirmCloseEnabled = (checkBox_confirmBeforeClosing.state == NSOnState);
137 [matrix_closeConfirmType setEnabled:confirmCloseEnabled];