pt_BR strings updates
[adiumx.git] / Source / AINewMessagePromptController.m
blob12cc8bea74e56fddd1bb3855b6f6e6e98b3cfc79
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 "AINewMessagePromptController.h"
18 #import <Adium/AIChatControllerProtocol.h>
19 #import <Adium/AIInterfaceControllerProtocol.h>
21 #define NEW_MESSAGE_PROMPT_NIB  @"NewMessagePrompt"
23 static AINewMessagePromptController *sharedNewMessageInstance = nil;
25 /*!
26  * @class AINewMessagePromptController
27  * @brief Controller for the New Message prompt, which allows messaging an arbitrary contact
28  */
29 @implementation AINewMessagePromptController
31 /*!
32  * @brief Return our shared instance
33  * @result The shared instance
34  */
35 + (id)sharedInstance 
37         return sharedNewMessageInstance;
40 /*!
41  * @brief Create the shared instance
42  * @result The shared instance
43  */
44 + (id)createSharedInstance 
46         sharedNewMessageInstance = [[self alloc] initWithWindowNibName:NEW_MESSAGE_PROMPT_NIB];
47         
48         return sharedNewMessageInstance;
51 /*!
52  * @brief Destroy the shared instance
53  */
54 + (void)destroySharedInstance 
56         [sharedNewMessageInstance autorelease]; sharedNewMessageInstance = nil;
59 /*!
60  * @brief Window did load
61  */
62 - (void)windowDidLoad
64         [super windowDidLoad];
65         
66         [label_from setLocalizedString:AILocalizedString(@"From:",nil)];
67         [label_to setLocalizedString:AILocalizedString(@"To:",nil)];
68         
69         [button_okay setLocalizedString:AILocalizedStringFromTable(@"Message", @"Buttons", "Button title to open a message window the specific contact from the 'New Chat' window")];
70         
71         [[self window] setTitle:AILocalizedString(@"New Message",nil)];
74 /*!
75  * @brief Open a chat with the desired contact
76  */
77 - (IBAction)okay:(id)sender
79         AIListContact   *contact;
80         
81     if ((contact = [self contactFromTextField])) {
82         //Initiate the message - the contact is on the right account
83                 [super okay:sender];
85         [[adium interfaceController] setActiveChat:[[adium chatController] openChatWithContact:contact
86                                                                                                                                                         onPreferredAccount:NO]];
87                 
88                 //Close the prompt
89         [[self class] closeSharedInstance];
90     }
93 - (NSString *)lastAccountIDKey
95         return @"NewMessagePrompt";
98 @end