| 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 | */ |
---|
| 16 | |
---|
| 17 | #import "AIWindowController.h" |
---|
| 18 | |
---|
| 19 | typedef enum { |
---|
| 20 | AIPasswordPromptOKReturn = 0, |
---|
| 21 | AIPasswordPromptCancelReturn |
---|
| 22 | } AIPasswordPromptReturn; |
---|
| 23 | |
---|
| 24 | /*! |
---|
| 25 | * @class AIPasswordPromptController |
---|
| 26 | * |
---|
| 27 | * This abstract superclass simplifies displaying a password prompt and notifying a target when the |
---|
| 28 | * password is entered. |
---|
| 29 | */ |
---|
| 30 | @interface AIPasswordPromptController : AIWindowController { |
---|
| 31 | IBOutlet NSTextField *textField_password; |
---|
| 32 | IBOutlet NSButton *checkBox_savePassword; |
---|
| 33 | IBOutlet NSButton *button_OK; |
---|
| 34 | |
---|
| 35 | NSString *password; |
---|
| 36 | |
---|
| 37 | SEL selector; |
---|
| 38 | id target; |
---|
| 39 | |
---|
| 40 | id context; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | /*! |
---|
| 44 | * @brief Designated initializer for AIPasswordPromptController |
---|
| 45 | * |
---|
| 46 | * @param windowNibName Nib name. |
---|
| 47 | * @param password Iniital password to put in the password field. If nil, the field will be empty. |
---|
| 48 | * @param inTarget Target to notify when the prompt window is closed |
---|
| 49 | * @param inSelector Selector on target. Signature is - (void)passwordReturnedForConnect:(NSString *)inPassword returnCode:(AIPasswordPromptReturn)returnCode context:(id)inContext |
---|
| 50 | * @param inContext Context to pass back when notifying the target. |
---|
| 51 | * |
---|
| 52 | * @result An AIPasswordPromptController |
---|
| 53 | */ |
---|
| 54 | - (id)initWithWindowNibName:(NSString *)windowNibName password:(NSString *)password notifyingTarget:(id)inTarget selector:(SEL)inSelector context:(id)inContext; |
---|
| 55 | - (IBAction)cancel:(id)sender; |
---|
| 56 | - (IBAction)okay:(id)sender; |
---|
| 57 | - (IBAction)togglePasswordSaved:(id)sender; |
---|
| 58 | |
---|
| 59 | @end |
---|
| 60 | |
---|
| 61 | @interface AIPasswordPromptController (PRIVATE_and_Subclasses) |
---|
| 62 | - (NSString *)savedPasswordKey; |
---|
| 63 | - (void)windowDidLoad; |
---|
| 64 | - (void)savePassword:(NSString *)password; |
---|
| 65 | - (void)setTarget:(id)inTarget selector:(SEL)inSelector context:(id)inContext; |
---|
| 66 | @end |
---|