]> git.saurik.com Git - cydia.git/blobdiff - UICaboodle/BrowserView.mm
Use -[UIColor groupTableViewBackgroundColor] instead of -[UIColor pinStripeColor].
[cydia.git] / UICaboodle / BrowserView.mm
index 8dd2afa0405bc710c6cfe4b5bb24998c914a18f9..e2dee3b5df8d40d02fe8e0ad109bc50e3ef6ce85 100644 (file)
@@ -161,7 +161,7 @@ static Class $UIWebBrowserView;
 
 @implementation WebScriptObject (UICaboodle)
 
-- (unsigned) count {
+- (NSUInteger) count {
     id length([self valueForKey:@"length"]);
     if ([length respondsToSelector:@selector(intValue)])
         return [length intValue];
@@ -310,7 +310,7 @@ static Class $UIWebBrowserView;
         [reloaditem_ release];
     if (loadingitem_ != nil)
         [loadingitem_ release];
-        
+
     [super dealloc];
 }
 
@@ -364,7 +364,7 @@ static Class $UIWebBrowserView;
 
 /* XXX: WebThreadLock? */
 - (void) _fixScroller:(CGRect)bounds {
-       float extra;
+    float extra;
 
     if (!editing_ || $UIFormAssistant == nil)
         extra = 0;
@@ -413,7 +413,7 @@ static Class $UIWebBrowserView;
     [self view:sender didSetFrame:frame];
 }
 
-- (void) pushPage:(UCViewController *)page {
+- (void) pushPage:(CYViewController *)page {
     [page setDelegate:delegate_];
     [[self navigationItem] setTitle:title_];
     [[self navigationController] pushViewController:page animated:YES];
@@ -427,11 +427,11 @@ static Class $UIWebBrowserView;
     [[self navigationController] pushViewController:self animated:YES];
 }
 
-- (void) swapPage:(UCViewController *)page {
+- (void) swapPage:(CYViewController *)page {
     [page setDelegate:delegate_];
     if (pushed_) [[self navigationController] popViewControllerAnimated:NO];
-               
-       [[self navigationController] pushViewController:page animated:NO];
+
+    [[self navigationController] pushViewController:page animated:NO];
 }
 
 - (BOOL) getSpecial:(NSURL *)url swap:(BOOL)swap {
@@ -439,7 +439,7 @@ static Class $UIWebBrowserView;
     NSLog(@"getSpecial:%@", url);
 #endif
 
-    if (UCViewController *page = [delegate_ pageForURL:url hasTag:NULL]) {
+    if (CYViewController *page = [delegate_ pageForURL:url hasTag:NULL]) {
         if (swap)
             [self swapPage:page];
         else
@@ -576,7 +576,7 @@ static Class $UIWebBrowserView;
         [function_ autorelease];
     function_ = function == nil ? nil : [function retain];
 
-       [self applyRightButton];
+    [self applyRightButton];
 }
 
 - (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function {
@@ -592,7 +592,7 @@ static Class $UIWebBrowserView;
         [function_ autorelease];
     function_ = function == nil ? nil : [function retain];
 
-       [self applyRightButton];
+    [self applyRightButton];
 }
 
 - (void) setFinishHook:(id)function {
@@ -625,7 +625,7 @@ static Class $UIWebBrowserView;
 }
 
 - (void) webViewClose:(WebView *)sender {
-       [self close];
+    [self close];
 }
 
 - (void) close {
@@ -662,7 +662,7 @@ static Class $UIWebBrowserView;
                 UCNavigationController *navigation([[[UCNavigationController alloc] init] autorelease]);
                 [navigation setHook:indirect_];
 
-                UCViewController *page([delegate_ pageForURL:url hasTag:NULL]);
+                CYViewController *page([delegate_ pageForURL:url hasTag:NULL]);
                 if (page == nil) {
                     /* XXX: call createWebViewWithRequest instead? */
 
@@ -675,15 +675,15 @@ static Class $UIWebBrowserView;
                 [page setDelegate:delegate_];
 
                 [navigation setViewControllers:[NSArray arrayWithObject:page]];
-                               UIBarButtonItem *closeItem = [[UIBarButtonItem alloc]
-                               initWithTitle:UCLocalize("CLOSE")
-                                       style:UIBarButtonItemStylePlain
-                               target:page
-                               action:@selector(close)
-                           ];
-                           [[page navigationItem] setLeftBarButtonItem:closeItem];
-                           [closeItem release];
-                       
+                UIBarButtonItem *closeItem = [[UIBarButtonItem alloc]
+                    initWithTitle:UCLocalize("CLOSE")
+                    style:UIBarButtonItemStylePlain
+                    target:page
+                    action:@selector(close)
+                ];
+                [[page navigationItem] setLeftBarButtonItem:closeItem];
+                [closeItem release];
+
                 [[self navigationController] presentModalViewController:navigation animated:YES];
             }
         } else goto unknown;
@@ -759,10 +759,10 @@ static Class $UIWebBrowserView;
         goto ignore;
     }
 
-    int store(_not(int));
+    NSInteger store(_not(NSInteger));
     if (NSURL *itms = [url itmsURL:&store]) {
 #if LogBrowser
-        NSLog(@"itms#%@#%u#%@", url, store, itms);
+        NSLog(@"itms#%@#%d#%@", url, (int) store, itms);
 #endif
 
         if (capability != nil && (
@@ -944,15 +944,15 @@ static Class $UIWebBrowserView;
         [browser loadRequest:request];
 
         [navigation setViewControllers:[NSArray arrayWithObject:browser]];
-               UIBarButtonItem *closeItem = [[UIBarButtonItem alloc]
-               initWithTitle:UCLocalize("CLOSE")
-                       style:UIBarButtonItemStylePlain
-               target:browser
-               action:@selector(close)
-           ];
-           [[browser navigationItem] setLeftBarButtonItem:closeItem];
-           [closeItem release];
-       
+        UIBarButtonItem *closeItem = [[UIBarButtonItem alloc]
+            initWithTitle:UCLocalize("CLOSE")
+            style:UIBarButtonItemStylePlain
+            target:browser
+            action:@selector(close)
+        ];
+        [[browser navigationItem] setLeftBarButtonItem:closeItem];
+        [closeItem release];
+
         [[self navigationController] presentModalViewController:navigation animated:YES];
     } /*else if (request == nil) {
         [[self navigationItem] setTitle:title_];
@@ -1051,7 +1051,7 @@ static Class $UIWebBrowserView;
         }
     }
 
-       [self _startLoading];
+    [self _startLoading];
 }
 
 - (UIBarButtonItemStyle) rightButtonStyle {
@@ -1066,29 +1066,33 @@ static Class $UIWebBrowserView;
 
 - (UIBarButtonItem *) customButton {
     UIBarButtonItem *customItem = [[UIBarButtonItem alloc]
-               initWithTitle:button_
-               style:[self rightButtonStyle]
-               target:self
-               action:@selector(customButtonClicked)
-       ];
-       
+        initWithTitle:button_
+        style:[self rightButtonStyle]
+        target:self
+        action:@selector(customButtonClicked)
+    ];
+
     return [customItem autorelease];
 }
 
+- (UIBarButtonItem *) rightButton {
+    return reloaditem_;
+}
+
 - (void) applyLoadingTitle {
     [[self navigationItem] setTitle:UCLocalize("LOADING")];
 }
 
 - (void) applyRightButton {
-       if ([self isLoading]) {
-           [[self navigationItem] setRightBarButtonItem:loadingitem_ animated:YES];
-           [[loadingitem_ view] addSubview:indicator_];
+    if ([self isLoading]) {
+        [[self navigationItem] setRightBarButtonItem:loadingitem_ animated:YES];
+        [[loadingitem_ view] addSubview:indicator_];
         [self applyLoadingTitle];
     } else if (button_) {
         [[self navigationItem] setRightBarButtonItem:[self customButton] animated:YES];
     } else {
-        [[self navigationItem] setRightBarButtonItem:reloaditem_ animated:YES];
-       }
+        [[self navigationItem] setRightBarButtonItem:[self rightButton] animated:YES];
+    }
 }
 
 - (void) _startLoading {
@@ -1104,8 +1108,8 @@ static Class $UIWebBrowserView;
     if (finish_ != nil)
         [self callFunction:finish_];
 
-       [self applyRightButton];
-       if (![self isLoading]) [[self navigationItem] setTitle:title_];
+    [self applyRightButton];
+    if (![self isLoading]) [[self navigationItem] setTitle:title_];
 }
 
 - (bool) isLoading {
@@ -1140,7 +1144,7 @@ static Class $UIWebBrowserView;
     if ([frame parentFrame] == nil) {
         if (DOMDocument *document = [frame DOMDocument])
             if (DOMNodeList<NSFastEnumeration> *bodies = [document getElementsByTagName:@"body"])
-                for (DOMHTMLBodyElement *body in bodies) {
+                for (DOMHTMLBodyElement *body in (id) bodies) {
                     DOMCSSStyleDeclaration *style([document getComputedStyle:body pseudoElement:nil]);
 
                     bool colored(false);
@@ -1157,7 +1161,7 @@ static Class $UIWebBrowserView;
                             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)
@@ -1174,7 +1178,7 @@ static Class $UIWebBrowserView;
                     }
 
                     if (!colored)
-                        [scroller_ setBackgroundColor:[UIColor pinStripeColor]];
+                        [scroller_ setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
                     break;
                 }
     }
@@ -1344,14 +1348,14 @@ static Class $UIWebBrowserView;
 
         BrowserView *actualView = [[BrowserView alloc] initWithFrame:CGRectZero];
         [self setView:actualView];
-        
+
         struct CGRect bounds = [[self view] bounds];
 
         scroller_ = [[objc_getClass(Wildcat_ ? "UIScrollView" : "UIScroller") alloc] initWithFrame:bounds];
         [[self view] addSubview:scroller_];
 
         [scroller_ setFixedBackgroundPattern:YES];
-        [scroller_ setBackgroundColor:[UIColor pinStripeColor]];
+        [scroller_ setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
 
         [scroller_ setScrollingEnabled:YES];
         [scroller_ setClipsSubviews:YES];
@@ -1464,7 +1468,7 @@ static Class $UIWebBrowserView;
             else
                 [preferences _setLayoutInterval:0];
         }
-        
+
         actualView.documentView = document_;
         [actualView release];
 
@@ -1497,22 +1501,22 @@ static Class $UIWebBrowserView;
         CGSize indsize = [UIProgressIndicator defaultSizeForStyle:UIProgressIndicatorStyleMediumWhite];
         indicator_ = [[UIProgressIndicator alloc] initWithFrame:CGRectMake(15, 5, indsize.width, indsize.height)];
         [indicator_ setStyle:UIProgressIndicatorStyleMediumWhite];
-               [indicator_ startAnimation];
-               
-               reloaditem_ = [[UIBarButtonItem alloc]
-                       initWithTitle:UCLocalize("RELOAD")
-                       style:[self rightButtonStyle]
-                       target:self
-                       action:@selector(reloadButtonClicked)
-               ];
-               
-           loadingitem_ = [[UIBarButtonItem alloc]
-               initWithTitle:@" "
-               style:UIBarButtonItemStylePlain
-               target:self
-               action:@selector(reloadButtonClicked)
-           ];
-               [[loadingitem_ view] addSubview:indicator_];
+        [indicator_ startAnimation];
+
+        reloaditem_ = [[UIBarButtonItem alloc]
+            initWithTitle:UCLocalize("RELOAD")
+            style:[self rightButtonStyle]
+            target:self
+            action:@selector(reloadButtonClicked)
+        ];
+
+        loadingitem_ = [[UIBarButtonItem alloc]
+            initWithTitle:@" "
+            style:UIBarButtonItemStylePlain
+            target:self
+            action:@selector(reloadButtonClicked)
+        ];
+        [[loadingitem_ view] addSubview:indicator_];
 
         [scroller_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
         [indicator_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
@@ -1588,23 +1592,24 @@ static Class $UIWebBrowserView;
     [self reloadURL];
 }
 
+- (void) _customButtonClicked {
+    [self reloadButtonClicked];
+}
+
 - (void) customButtonClicked {
 #if !AlwaysReload
     if (function_ != nil)
         [self callFunction:function_];
     else
 #endif
-               [self reloadButtonClicked];
+    [self _customButtonClicked];
 }
 
 - (void) setPageActive:(BOOL)active {
     if (!active)
         [indicator_ removeFromSuperview];
     else
-               [[[[self navigationItem] rightBarButtonItem] view] addSubview:indicator_];
-}
-
-- (void) resetViewAnimated:(BOOL)animated {
+        [[[[self navigationItem] rightBarButtonItem] view] addSubview:indicator_];
 }
 
 - (void) setPushed:(bool)pushed {
@@ -1615,4 +1620,4 @@ static Class $UIWebBrowserView;
     return 980;
 }
 
-@end
\ No newline at end of file
+@end