2013-02-14 17:59:12 +04:00
/ *
Certificate verification controller
2013-12-04 14:37:57 +04:00
Copyright 2013 Thincast Technologies GmbH , Author : Martin Fleisz
2013-02-14 17:59:12 +04:00
This Source Code Form is subject to the terms of the Mozilla Public License , v . 2.0 .
If a copy of the MPL was not distributed with this file , You can obtain one at http : // mozilla . org / MPL / 2.0 /.
* /
# import "VerifyCertificateController.h"
# import "RDPSession.h"
@ implementation VerifyCertificateController
- ( id ) initWithNibName : ( NSString * ) nibNameOrNil bundle : ( NSBundle * ) nibBundleOrNil session : ( RDPSession * ) session params : ( NSMutableDictionary * ) params
{
self = [ super initWithNibName : nibNameOrNil bundle : nibBundleOrNil ] ;
if ( self ) {
_session = session ;
_params = params ;
[ self setModalPresentationStyle : UIModalPresentationFormSheet ] ;
}
return self ;
}
- ( void ) viewDidLoad
{
[ super viewDidLoad ] ;
NSString * message = NSLocalizedString ( @ "The identity of the remote computer cannot be verified. Do you want to connect anyway?" , @ "Verify certificate view message" ) ;
// init strings
[ _label _message setText : message ] ;
[ _label _for _issuer setText : NSLocalizedString ( @ "Issuer:" , @ "Verify certificate view issuer label" ) ] ;
[ _btn _accept setTitle : NSLocalizedString ( @ "Yes" , @ "Yes Button" ) forState : UIControlStateNormal ] ;
[ _btn _decline setTitle : NSLocalizedString ( @ "No" , @ "No Button" ) forState : UIControlStateNormal ] ;
[ _label _issuer setText : [ _params valueForKey : @ "issuer" ] ] ;
}
- ( void ) viewDidUnload
{
[ super viewDidUnload ] ;
// Release any retained subviews of the main view .
}
- ( void ) viewDidDisappear : ( BOOL ) animated
{
[ super viewDidDisappear : animated ] ;
// set signal
[ [ _session uiRequestCompleted ] signal ] ;
}
- ( BOOL ) shouldAutorotateToInterfaceOrientation : ( UIInterfaceOrientation ) interfaceOrientation
{
return YES ;
}
# pragma mark - Action handlers
- ( IBAction ) acceptPressed : ( id ) sender
{
[ _params setValue : [ NSNumber numberWithBool : YES ] forKey : @ "result" ] ;
// dismiss controller
[ self dismissModalViewControllerAnimated : YES ] ;
}
- ( IBAction ) declinePressed : ( id ) sender
{
[ _params setValue : [ NSNumber numberWithBool : NO ] forKey : @ "result" ] ;
// dismiss controller
[ self dismissModalViewControllerAnimated : YES ] ;
}
@ end