FreeRDP/client/Mac/PasswordDialog.m

85 lines
2.0 KiB
Mathematica
Raw Normal View History

2013-03-11 22:59:50 +04:00
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* MacFreeRDP
*
* Copyright 2013 Christian Hofstaedtler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2013-03-11 05:25:14 +04:00
#import "PasswordDialog.h"
@interface PasswordDialog ()
@end
@implementation PasswordDialog
2013-03-11 22:59:50 +04:00
@synthesize usernameText;
2013-03-11 05:25:14 +04:00
@synthesize passwordText;
@synthesize messageLabel;
2013-03-11 22:59:50 +04:00
@synthesize serverHostname;
@synthesize username;
2013-03-11 05:25:14 +04:00
@synthesize password;
2013-03-11 22:59:50 +04:00
- (id)init
{
return [self initWithWindowNibName:@"PasswordDialog"];
2013-03-11 05:25:14 +04:00
}
- (void)windowDidLoad
{
2013-03-11 22:59:50 +04:00
[super windowDidLoad];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
[self.window setTitle:self.serverHostname];
[messageLabel setStringValue:[NSString stringWithFormat:@"Authenticate to %@", self.serverHostname]];
if (self.username != nil)
{
[usernameText setStringValue:self.username];
[self.window makeFirstResponder:passwordText];
}
2013-03-11 05:25:14 +04:00
}
2013-03-11 22:59:50 +04:00
- (IBAction)onOK:(NSObject *)sender
{
self.username = self.usernameText.stringValue;
self.password = self.passwordText.stringValue;
[self.window orderOut:nil];
[NSApp stopModalWithCode:TRUE];
2013-03-11 05:25:14 +04:00
}
2013-03-11 22:59:50 +04:00
- (IBAction)onCancel:(NSObject *)sender
{
[self.window orderOut:nil];
[NSApp stopModalWithCode:FALSE];
2013-03-11 05:25:14 +04:00
}
2013-03-11 22:59:50 +04:00
- (BOOL)runModal
{
return [NSApp runModalForWindow:self.window];
2013-03-11 05:25:14 +04:00
}
- (void)dealloc
{
[usernameText release];
[passwordText release];
[messageLabel release];
[serverHostname release];
[username release];
[password release];
[super dealloc];
}
2013-03-11 05:25:14 +04:00
@end