* 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 "AIMentionAdvancedPreferences.h" #import "AIPreferenceWindowController.h" #import <AIUtilities/AIImageAdditions.h> #import <AIUtilities/AIArrayAdditions.h> @interface AIMentionAdvancedPreferences () @implementation AIMentionAdvancedPreferences #pragma mark Preference pane settings - ( AIPreferenceCategory ) category return AILocalizedString ( @"Mention" , nil ); return @"AIMentionAdvancedPreferences" ; return [ NSImage imageNamed : @"pref-mention" forClass : [ AIPreferenceWindowController class ]]; NSMutableArray * termsCopy = [[ mentionTerms mutableCopy ] autorelease ]; // Never save a blank term. [ termsCopy removeObject : @"" ]; [ adium . preferenceController setPreference : termsCopy group : PREF_GROUP_GENERAL ]; * @brief Add a new row, select it for editing - ( IBAction ) add: ( id ) sender [ mentionTerms addObject : @"" ]; NSInteger idx = mentionTerms . count -1 ; [ tableView selectRowIndexes : [ NSIndexSet indexSetWithIndex : idx ] byExtendingSelection : NO ]; [ tableView editColumn : 0 row : idx withEvent : nil select : YES ]; * @brief Remove the selected rows - ( IBAction ) remove: ( id ) sender NSIndexSet * indexes = [ tableView selectedRowIndexes ]; [ mentionTerms removeObjectsAtIndexes : indexes ]; [ tableView deselectAll : nil ]; [ label_explanation setStringValue : AILocalizedString ( @"Messages are highlighted when the following terms are spoken. Your username is always highlighted." , nil )]; mentionTerms = [[ NSMutableArray alloc ] initWithArray : [ adium . preferenceController preferenceForKey : PREF_KEY_MENTIONS group : PREF_GROUP_GENERAL ]]; [ mentionTerms release ]; mentionTerms = nil ; #pragma mark Table view Delegate - ( NSInteger ) numberOfRowsInTableView: ( NSTableView * ) aTableView return mentionTerms . count ; - ( id ) tableView: ( NSTableView * ) aTableView objectValueForTableColumn: ( NSTableColumn * ) tableColumn row: ( NSInteger ) rowIndex NSString * identifier = tableColumn . identifier ; if ([ identifier isEqualToString : @"text" ]) { return [ mentionTerms objectAtIndex : rowIndex ]; - ( void ) tableView: ( NSTableView * ) aTableView setObjectValue: ( id ) object forTableColumn: ( NSTableColumn * ) tableColumn row: ( NSInteger ) row NSString * identifier = tableColumn . identifier ; if ([ identifier isEqualToString : @"text" ]) { [ mentionTerms replaceObjectAtIndex : row withObject : object ]; - ( void ) tableViewDeleteSelectedRows: ( NSTableView * ) tableView