* Adium is the legal property of its developers, whose names are listed in the copyright file included * with this source distribution. * This program is free software; you can redistribute it and/or modify it under the terms of the GNU * General Public License as published by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * You should have received a copy of the GNU General Public License along with this program; if not, * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #import <Adium/AIContentControllerProtocol.h> #import <Adium/AIInterfaceControllerProtocol.h> #import "AISoundController.h" #import <ShortcutRecorder/SRRecorderControl.h> #import "ESGeneralPreferences.h" #import "ESGeneralPreferencesPlugin.h" #import "SGHotKeyCenter.h" #import "AIMessageWindowController.h" #import <Adium/AIServiceIcons.h> #import <Adium/AIStatusIcons.h> #import <AIUtilities/AIColorAdditions.h> #import <AIUtilities/AIDictionaryAdditions.h> #import <AIUtilities/AIFontAdditions.h> #import <AIUtilities/AIImageAdditions.h> #import <AIUtilities/AIMenuAdditions.h> #import <AIUtilities/AIPopUpButtonAdditions.h> #import <AIUtilities/AIStringAdditions.h> #import "AILogByAccountWindowController.h" #import "AIURLHandlerPlugin.h" #import "AIURLHandlerWindowController.h" #define PREF_GROUP_DUAL_WINDOW_INTERFACE @"Dual Window Interface" #define KEY_TABBAR_POSITION @"Tab Bar Position" @implementation ESGeneralPreferences @synthesize shortcutRecorder; // XXX in order to edit the nib, you need the ShortcutReporter palette // You can download it at http://evands.penguinmilitia.net/ShortcutRecorder.palette.zip // This comes from http://wafflesoftware.net/shortcut/ + (NSSet *)keyPathsForValuesAffectingChatHistoryDisplayActive return [NSSet setWithObjects:@"adium.preferenceController.Logging.Enable Logging", @"adium.preferenceController.Message Context Display.Display Message Context", //Preference pane properties - (AIPreferenceCategory)category{ - (NSString *)paneIdentifier return AILocalizedString(@"General","General preferences label"); return @"Preferences-General"; return [NSImage imageNamed:@"pref-general" forClass:[self class]]; //Configure the preference view [checkbox_updatesProfileInfo setEnabled:[checkbox_updatesAutomatic state]]; [checkbox_updatesIncludeBetas setEnabled:NO]; [checkbox_updatesIncludeBetas setState:NSOnState]; [checkbox_updatesIncludeBetas setEnabled:[checkbox_updatesAutomatic state]]; self.shortcutRecorder = [[[SRRecorderControl alloc] initWithFrame:placeholder_shortcutRecorder.frame] autorelease]; shortcutRecorder.delegate = self; [[placeholder_shortcutRecorder superview] addSubview:shortcutRecorder]; TISInputSourceRef currentLayout = TISCopyCurrentKeyboardLayoutInputSource(); if (TISGetInputSourceProperty(currentLayout, kTISPropertyUnicodeKeyLayoutData)) { SGKeyCombo *keyCombo = [[[SGKeyCombo alloc] initWithPlistRepresentation:[adium.preferenceController preferenceForKey:KEY_GENERAL_HOTKEY group:PREF_GROUP_GENERAL]] autorelease]; [shortcutRecorder setKeyCombo:SRMakeKeyCombo([keyCombo keyCode], [shortcutRecorder carbonToCocoaFlags:[keyCombo modifiers]])]; [shortcutRecorder setAnimates:YES]; [shortcutRecorder setStyle:SRGreyStyle]; [label_shortcutRecorder setLocalizedString:AILocalizedString(@"When pressed, this key combination will bring Adium to the front", nil)]; [shortcutRecorder setEnabled:NO]; [label_shortcutRecorder setLocalizedString:AILocalizedString(@"You are using an old-style (rsrc) keyboard layout which Adium does not support.", nil)]; CFRelease(currentLayout); [self configureControlDimming]; [label_confirmations setLocalizedString:AILocalizedString(@"Confirmations:", nil)]; [label_globalShortcut setLocalizedString:AILocalizedString(@"Global Shortcut:", nil)]; [label_IMLinks setLocalizedString:AILocalizedString(@"Open IM links:", nil)]; [label_status setLocalizedString:AILocalizedString(@"Status:", nil)]; [label_updates setLocalizedString:AILocalizedString(@"Updates:", nil)]; [button_defaultApp setLocalizedString:AILocalizedString(@"Make Adium default application", nil)]; [button_customizeDefaultApp setLocalizedString:AILocalizedString(@"Customize…", nil)]; [checkbox_showInMenu setLocalizedString:AILocalizedString(@"Show Adium's status in the menu bar", nil)]; [checkbox_updatesAutomatic setLocalizedString:AILocalizedString(@"Automatically check for updates", nil)]; [checkbox_updatesIncludeBetas setLocalizedString:AILocalizedString(@"Update to beta versions when available", nil)]; [checkbox_updatesProfileInfo setLocalizedString:AILocalizedString(@"Include anonymous system profile", nil)]; [button_resetAllWarnings setLocalizedString:AILocalizedString(@"Reset all warnings", nil)]; self.shortcutRecorder = nil; - (void)configureControlDimming [checkbox_updatesProfileInfo setEnabled:[checkbox_updatesAutomatic state]]; [checkbox_updatesIncludeBetas setEnabled:NO]; [checkbox_updatesIncludeBetas setState:NSOnState]; [checkbox_updatesIncludeBetas setEnabled:[checkbox_updatesAutomatic state]]; - (BOOL)shortcutRecorder:(SRRecorderControl *)aRecorder isKeyCode:(signed short)keyCode andFlagsTaken:(NSUInteger)flags reason:(NSString **)aReason - (void)shortcutRecorder:(SRRecorderControl *)aRecorder keyComboDidChange:(KeyCombo)newKeyCombo if (aRecorder == shortcutRecorder) { SGKeyCombo *keyCombo = [SGKeyCombo keyComboWithKeyCode:[shortcutRecorder keyCombo].code modifiers:[shortcutRecorder cocoaToCarbonFlags:[shortcutRecorder keyCombo].flags]]; [adium.preferenceController setPreference:[keyCombo plistRepresentation] forKey:KEY_GENERAL_HOTKEY group:PREF_GROUP_GENERAL]; - (IBAction)setAsDefaultApp:(id)sender [[AIURLHandlerPlugin sharedAIURLHandlerPlugin] setAdiumAsDefault]; - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo [sheet.windowController release]; - (IBAction)customizeDefaultApp:(id)sender AIURLHandlerWindowController *windowController = [[AIURLHandlerWindowController alloc] initWithWindowNibName:@"AIURLHandlerPreferences"]; [NSApp beginSheet:windowController.window modalForWindow:self.view.window didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) - (IBAction)resetAllWarnings:(id)sender [adium.preferenceController setPreferences:[NSDictionary dictionaryNamed:@"ConfirmationDefaults" inGroup:PREF_GROUP_CONFIRMATIONS];