]> git.saurik.com Git - cydia.git/blobdiff - UICaboodle/BrowserView.mm
Merge commit 'f64f9f6255e43c48ba2b8e5cea6a5b23e5d14e26' into tab-backup
[cydia.git] / UICaboodle / BrowserView.mm
index 2666b5b3752b27910e9dff41d02a6df8b685934e..2abc02ecc607b3c968bbf2c656260fb490b10b70 100644 (file)
@@ -638,7 +638,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
     if ([scheme isEqualToString:@"mailto"])
         [self _openMailToURL:url];
 
-    CYViewController *page([delegate_ pageForURL:url hasTag:NULL]);
+    CYViewController *page([delegate_ pageForURL:url]);
 
     if (page == nil) {
         BrowserController *browser([[[class_ alloc] init] autorelease]);
@@ -653,13 +653,11 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
 
         [[self navigationController] pushViewController:page animated:YES];
     } else {
-        UCNavigationController *navigation([[[UCNavigationController alloc] init] autorelease]);
+        UCNavigationController *navigation([[[UCNavigationController alloc] initWithRootViewController:page] autorelease]);
 
         [navigation setHook:indirect_];
         [navigation setDelegate:delegate_];
 
-        [navigation setViewControllers:[NSArray arrayWithObject:page]];
-
         [[page navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc]
             initWithTitle:UCLocalize("CLOSE")
             style:UIBarButtonItemStylePlain
@@ -715,7 +713,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
                             UIColor *uic(nil);
 
                             if (red == 0xc7 && green == 0xce && blue == 0xd5)
-                                uic = [UIColor pinStripeColor];
+                                uic = [UIColor groupTableViewBackgroundColor];
                             else if (alpha != 0)
                                 uic = [UIColor
                                     colorWithRed:(red / 255)
@@ -732,7 +730,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
                     }
 
                     if (!colored)
-                        [scroller_ setBackgroundColor:[UIColor pinStripeColor]];
+                        [scroller_ setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
                     break;
                 }
     }
@@ -837,19 +835,13 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
 
         [alert dismissWithClickedButtonIndex:-1 animated:YES];
     } else if ([context isEqualToString:@"submit"]) {
-        switch (button) {
-            case 1:
-            break;
-
-            case 2:
-                if (request_ != nil) {
-                    WebThreadLock();
-                    [webview_ loadRequest:request_];
-                    WebThreadUnlock();
-                }
-            break;
-
-            _nodefault
+        if (button == [alert cancelButtonIndex]) {
+        } else if (button == [alert firstOtherButtonIndex]) {
+            if (request_ != nil) {
+                WebThreadLock();
+                [webview_ loadRequest:request_];
+                WebThreadUnlock();
+            }
         }
 
         [alert dismissWithClickedButtonIndex:-1 animated:YES];
@@ -904,24 +896,33 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
     }
 }
 
+- (void) didStartLoading {
+    // Overridden in subclasses.
+}
+
 - (void) _didStartLoading {
     [self applyRightButton];
 
     if ([loading_ count] != 1)
         return;
+
     [delegate_ retainNetworkActivityIndicator];
+    [self didStartLoading];
+}
+
+- (void) didFinishLoading {
+    // Overridden in subclasses.
 }
 
 - (void) _didFinishLoading {
     if ([loading_ count] != 0)
         return;
-    [delegate_ releaseNetworkActivityIndicator];
 
     [self applyRightButton];
+    [[self navigationItem] setTitle:title_];
 
-    // XXX: wtf?
-    if (![self isLoading])
-        [[self navigationItem] setTitle:title_];
+    [delegate_ releaseNetworkActivityIndicator];
+    [self didFinishLoading];
 }
 
 - (bool) isLoading {
@@ -995,7 +996,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se
         }
 
         [scroller_ setFixedBackgroundPattern:YES];
-        [scroller_ setBackgroundColor:[UIColor pinStripeColor]];
+        [scroller_ setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
         [scroller_ setClipsSubviews:YES];
 
         [scroller_ setBounces:YES];