Unescape the HREF attribute's text before passing it to NSURL which does not expect...
[adiumx.git] / Source / ESAnnouncerSpeakTextAlertDetailPane.m
blobddc9758d04f9789f9bc793ccb288212babf9b4a7
1 /* 
2  * Adium is the legal property of its developers, whose names are listed in the copyright file included
3  * with this source distribution.
4  * 
5  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6  * General Public License as published by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  * 
9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10  * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
11  * Public License for more details.
12  * 
13  * You should have received a copy of the GNU General Public License along with this program; if not,
14  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
15  */
17 #import "ESAnnouncerSpeakTextAlertDetailPane.h"
18 #import "ESAnnouncerPlugin.h"
19 #import <Adium/AILocalizationTextField.h>
21 /*!
22  * @class ESAnnouncerSpeakTextAlertDetailPane
23  * @brief Speak Text details pane
24  */
25 @implementation ESAnnouncerSpeakTextAlertDetailPane
27 /*!
28  * @brief Nib name
29  */
30 - (NSString *)nibName{
31     return @"AnnouncerSpeakTextContactAlert";    
34 /*!
35  * @brief View loaded
36  */
37 - (void)viewDidLoad
39         [super viewDidLoad];
40         
41         [textView_textToSpeakLabel setLocalizedString:AILocalizedString(@"Text To Speak:",nil)];
42         [box_substitutions setTitle:AILocalizedString(@"Substitutions:","Title above the box in the Speak Text action's detail pane. The box contains keywords such as \%a and what they will become when spoken such as User Alias.")];
44         [textView_substitutions setStringValue:
45                 [NSString stringWithFormat:@"%@ - %@\n%@ - %@\n%@ - %@\n%@ - %@",
46                         @"%n", AILocalizedString(@"User name", "Speak Text action keyword: user name"),
47                         @"%a", AILocalizedString(@"User alias", "Speak Text action keyword: user alias"),
48                         @"%m", AILocalizedString(@"Message", "Speak Text action keyword: message"),
49                         @"%t", AILocalizedString(@"Time", "Speak Text action keyword: time")]];
52 /*!
53  * @brief Configure for the action
54  */
55 - (void)configureForActionDetails:(NSDictionary *)inDetails listObject:(AIListObject *)inObject
57         NSString *textToSpeak = [inDetails objectForKey:KEY_ANNOUNCER_TEXT_TO_SPEAK];
58         [textView_textToSpeak setString:(textToSpeak ? textToSpeak : @"")];
60         [super configureForActionDetails:inDetails listObject:inObject];
63 /*!
64  * @brief Return our current configuration
65  */
66 - (NSDictionary *)actionDetails
68         NSString                        *textToSpeak;
69         NSMutableDictionary     *actionDetails = [NSMutableDictionary dictionary];
70         
71         textToSpeak  = [[[textView_textToSpeak string] copy] autorelease];
72         
73         if (textToSpeak) {
74                 [actionDetails setObject:textToSpeak
75                                                   forKey:KEY_ANNOUNCER_TEXT_TO_SPEAK];
76         }
78         return [self actionDetailsFromDict:actionDetails];
80         
81 /*!
82  * @brief Key on which to store our defaults
83  */
84 - (NSString *)defaultDetailsKey
86         return @"DefaultSpeakTextDetails";
89 @end