Reverted ESFileTransfer in adium-0.8 to [14253]; we simply won't draw the arrow if...
[adiumx.git] / Source / AINewGroupWindowController.m
blob270119f8aee0b1c11c213e55cf28d30bd6beffdf
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 "AINewGroupWindowController.h"
18 #import "AIContactController.h"
20 #define ADD_GROUP_PROMPT_NIB    @"AddGroup"
22 /*!
23  * @class AINewGroupWindowController
24  * @brief Window controller for adding groups
25  */
26 @implementation AINewGroupWindowController
28 /*!
29  * @brief Prompt for a new group.
30  *
31  * @param parentWindow Window on which to show as a sheet. Pass nil for a panel prompt.
32  */
33 + (AINewGroupWindowController *)promptForNewGroupOnWindow:(NSWindow *)parentWindow
35         AINewGroupWindowController      *newGroupWindowController;
36         
37         newGroupWindowController = [[self alloc] initWithWindowNibName:ADD_GROUP_PROMPT_NIB];
38         
39         if(parentWindow){
40                 [NSApp beginSheet:[newGroupWindowController window]
41                    modalForWindow:parentWindow
42                         modalDelegate:newGroupWindowController
43                    didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
44                           contextInfo:nil];
45         }else{
46                 [newGroupWindowController showWindow:nil];
47         }
48         
49         return newGroupWindowController;
52 /*!
53  * @brief Setup the window before it is displayed
54  */
55 - (void)windowDidLoad
57         NSWindow        *window = [self window];
58         [window setTitle:AILocalizedString(@"Add Group",nil)];
59         
60         [label_groupName setLocalizedString:AILocalizedString(@"Group Name:",nil)];
61         [button_add setLocalizedString:AILocalizedString(@"Add",nil)];
62         [button_cancel setLocalizedString:AILocalizedString(@"Cancel",nil)];
64         [window center];
67 /*!
68  * @brief Called as the user list edit sheet closes, dismisses the sheet
69  */
70 - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
72         [[adium notificationCenter] postNotificationName:@"NewGroupWindowControllerDidEnd"
73                                                                                           object:sheet];
74     [sheet orderOut:nil];
77 /*!
78  * @brief Cancel
79  */
80 - (IBAction)cancel:(id)sender
82         if([[self window] isSheet]){
83                 [NSApp endSheet:[self window]];
84         }else{
85                 [self closeWindow:nil];
86         }
90  * @brief UID of the new group
91  */
92 - (NSString *)newGroupUID
94         return [[[textField_groupName stringValue] copy] autorelease];
97 /*!
98  * @brief Add the group
99  */
100 - (IBAction)addGroup:(id)sender
102         AIListGroup *group = [[adium contactController] groupWithUID:[self newGroupUID]];
103         
104         if([[self window] isSheet]){
105                 [NSApp endSheet:[self window]];
106         }else{
107                 [self closeWindow:nil];
108         }
111 @end