]> git.saurik.com Git - cydia.git/blobdiff - UICaboodle/BrowserView.mm
Major modifications to ready for stability.
[cydia.git] / UICaboodle / BrowserView.mm
index bd2c2367b6b1b11c947a21b95077d157ebc38e1e..6143711855b958caea3ae75fa538cbeeaf0b6244 100644 (file)
@@ -10,6 +10,8 @@ extern NSString * const kCAFilterNearest;
 
 #include "substrate.h"
 
+#define ForSaurik 0
+
 static CFArrayRef (*$GSSystemCopyCapability)(CFStringRef);
 static CFArrayRef (*$GSSystemGetCapability)(CFStringRef);
 
@@ -142,77 +144,6 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef);
 
 @end
 
-#if 0
-/* Mail Composition {{{ */
-@interface MailToView : PopUpView {
-    MailComposeController *controller_;
-}
-
-- (id) initWithView:(UIView *)view delegate:(id)delegate url:(NSURL *)url;
-
-@end
-
-@implementation MailToView
-
-- (void) dealloc {
-    [controller_ release];
-    [super dealloc];
-}
-
-- (void) mailComposeControllerWillAttemptToSend:(MailComposeController *)controller {
-    NSLog(@"will");
-}
-
-- (void) mailComposeControllerDidAttemptToSend:(MailComposeController *)controller mailDelivery:(id)delivery {
-    NSLog(@"did:%@", delivery);
-// [UIApp setStatusBarShowsProgress:NO];
-if ([controller error]){
-NSArray *buttons = [NSArray arrayWithObjects:UCLocalize("OK"), nil];
-UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize("ERROR") buttons:buttons defaultButtonIndex:0 delegate:self context:self];
-[mailAlertSheet setBodyText:[controller error]];
-[mailAlertSheet popupAlertAnimated:YES];
-}
-}
-
-- (void) showError {
-    NSLog(@"%@", [controller_ error]);
-    NSArray *buttons = [NSArray arrayWithObjects:UCLocalize("OK"), nil];
-    UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize("ERROR") buttons:buttons defaultButtonIndex:0 delegate:self context:self];
-    [mailAlertSheet setBodyText:[controller_ error]];
-    [mailAlertSheet popupAlertAnimated:YES];
-}
-
-- (void) deliverMessage { _pooled
-    setuid(501);
-    setgid(501);
-
-    if (![controller_ deliverMessage])
-        [self performSelectorOnMainThread:@selector(showError) withObject:nil waitUntilDone:NO];
-}
-
-- (void) mailComposeControllerCompositionFinished:(MailComposeController *)controller {
-    if ([controller_ needsDelivery])
-        [NSThread detachNewThreadSelector:@selector(deliverMessage) toTarget:self withObject:nil];
-    else
-        [self cancel];
-}
-
-- (id) initWithView:(UIView *)view delegate:(id)delegate url:(NSURL *)url {
-    if ((self = [super initWithView:view delegate:delegate]) != nil) {
-        controller_ = [[MailComposeController alloc] initForContentSize:[overlay_ bounds].size];
-        [controller_ setDelegate:self];
-        [controller_ initializeUI];
-        [controller_ setupForURL:url];
-
-        UIView *view([controller_ view]);
-        [overlay_ addSubview:view];
-    } return self;
-}
-
-@end
-/* }}} */
-#endif
-
 #define ShowInternals 0
 #define LogBrowser 0
 
@@ -606,12 +537,7 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
 }
 
 - (void) _openMailToURL:(NSURL *)url {
-// XXX: this makes me sad
-#if 0
-    [[[MailToView alloc] initWithView:underlay_ delegate:self url:url] autorelease];
-#else
     [UIApp openURL:url];// asPanel:YES];
-#endif
 }
 
 - (void) webView:(WebView *)sender willBeginEditingFormElement:(id)element {
@@ -843,8 +769,7 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
                 [sender cancelAuthenticationChallenge:challenge_];
             break;
 
-            default:
-                _assert(false);
+            _nodefault
         }
 
         [challenge_ release];
@@ -864,8 +789,7 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
                 }
             break;
 
-            default:
-                _assert(false);
+            _nodefault
         }
 
         [sheet dismiss];
@@ -968,8 +892,8 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
 }
 
 - (void) webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
-    if ([loading_ count] == 0)
-        [self retain];
+    /*if ([loading_ count] == 0)
+        [self retain];*/
     [loading_ addObject:[NSValue valueWithNonretainedObject:frame]];
 
     if ([frame parentFrame] == nil) {
@@ -1033,8 +957,8 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
 
 - (void) _finishLoading {
     size_t count([loading_ count]);
-    if (count == 0)
-        [self autorelease];
+    /*if (count == 0)
+        [self autorelease];*/
     if (reloading_ || count != 0)
         return;
     if (finish_ != nil)
@@ -1125,8 +1049,9 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
 }
 
 - (void) _didFailWithError:(NSError *)error forFrame:(WebFrame *)frame {
-    if ([frame parentFrame] == nil)
-        [self autorelease];
+    _trace();
+    /*if ([frame parentFrame] == nil)
+        [self autorelease];*/
 
     [loading_ removeObject:[NSValue valueWithNonretainedObject:frame]];
     [self _finishLoading];
@@ -1168,7 +1093,7 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
 }
 
 - (void) setViewportWidth:(float)width {
-    width_ = width ? width != 0 : [[self class] defaultWidth];
+    width_ = width != 0 ? width : [[self class] defaultWidth];
     [webview_ setViewportSize:CGSizeMake(width_, UIWebViewGrowsAndShrinksToFitHeight) forDocumentTypes:0x10];
 }