NanoTech

Add rotation support to the auth dialog (iPad only for now).

@@ -13,8 +13,11 @@ typedef enum _ASIAuthenticationType { @@ -13,8 +13,11 @@ typedef enum _ASIAuthenticationType {
13 ASIStandardAuthenticationType = 0, 13 ASIStandardAuthenticationType = 0,
14 ASIProxyAuthenticationType = 1 14 ASIProxyAuthenticationType = 1
15 } ASIAuthenticationType; 15 } ASIAuthenticationType;
16 - 16 +
17 -@interface ASIAuthenticationDialog : UIViewController <UIActionSheetDelegate, UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate> { 17 +@interface ASIAutorotatingViewController : UIViewController
  18 +@end
  19 +
  20 +@interface ASIAuthenticationDialog : ASIAutorotatingViewController <UIActionSheetDelegate, UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate> {
18 ASIHTTPRequest *request; 21 ASIHTTPRequest *request;
19 ASIAuthenticationType type; 22 ASIAuthenticationType type;
20 UITableView *tableView; 23 UITableView *tableView;
@@ -20,6 +20,22 @@ static const NSUInteger kPasswordSection = 0; @@ -20,6 +20,22 @@ static const NSUInteger kPasswordSection = 0;
20 static const NSUInteger kDomainRow = 0; 20 static const NSUInteger kDomainRow = 0;
21 static const NSUInteger kDomainSection = 1; 21 static const NSUInteger kDomainSection = 1;
22 22
  23 +
  24 +@implementation ASIAutorotatingViewController
  25 +
  26 +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
  27 +{
  28 +#if __IPHONE_3_2 && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
  29 + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
  30 + return YES;
  31 + }
  32 +#endif
  33 + return (toInterfaceOrientation == UIInterfaceOrientationPortrait);
  34 +}
  35 +
  36 +@end
  37 +
  38 +
23 @interface ASIAuthenticationDialog () 39 @interface ASIAuthenticationDialog ()
24 - (void)show; 40 - (void)show;
25 @property (retain) UITableView *tableView; 41 @property (retain) UITableView *tableView;
@@ -108,7 +124,7 @@ static const NSUInteger kDomainSection = 1; @@ -108,7 +124,7 @@ static const NSUInteger kDomainSection = 1;
108 - (UIViewController *)presentingController 124 - (UIViewController *)presentingController
109 { 125 {
110 if (!presentingController) { 126 if (!presentingController) {
111 - presentingController = [[UIViewController alloc] initWithNibName:nil bundle:nil]; 127 + presentingController = [[ASIAutorotatingViewController alloc] initWithNibName:nil bundle:nil];
112 128
113 // Attach to the window, but don't interfere. 129 // Attach to the window, but don't interfere.
114 UIWindow *window = [[[UIApplication sharedApplication] windows] objectAtIndex:0]; 130 UIWindow *window = [[[UIApplication sharedApplication] windows] objectAtIndex:0];