diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-02-19 03:33:22 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-02-19 03:33:22 -0800 |
commit | b13b8664e70405f065a37d67fb4eb7c39a6a438b (patch) | |
tree | c512c21bd2d0fde8c12ead7b90a902a1746a91e5 /UICaboodle | |
parent | d71f3a07db779a610c9f3d6b50cfe6c022b7f618 (diff) |
Super-charge the Reload button to actually reload.
Diffstat (limited to 'UICaboodle')
-rw-r--r-- | UICaboodle/BrowserView.h | 4 | ||||
-rw-r--r-- | UICaboodle/BrowserView.mm | 16 |
2 files changed, 16 insertions, 4 deletions
diff --git a/UICaboodle/BrowserView.h b/UICaboodle/BrowserView.h index 0b52fb9..4e9be45 100644 --- a/UICaboodle/BrowserView.h +++ b/UICaboodle/BrowserView.h @@ -98,9 +98,11 @@ - (void) loadURL:(NSURL *)url; - (void) loadRequest:(NSURLRequest *)request; -- (void) reloadURL; - (bool) isLoading; +- (void) reloadURLWithCache:(BOOL)cache; +- (void) reloadURL; + - (id) init; - (id) initWithURL:(NSURL *)url; - (id) initWithWidth:(float)width; diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm index fa71a74..d549640 100644 --- a/UICaboodle/BrowserView.mm +++ b/UICaboodle/BrowserView.mm @@ -541,10 +541,16 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se [webview_ loadRequest:request]; } -- (void) reloadURL { +- (void) reloadURLWithCache:(BOOL)cache { if (request_ == nil) return; + NSMutableURLRequest *request([request_ mutableCopy]); + [request setCachePolicy:(cache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData)]; + + [request_ autorelease]; + request_ = [request retain]; + if ([request_ HTTPBody] == nil && [request_ HTTPBodyStream] == nil) [self loadRequest:request_]; else { @@ -563,9 +569,13 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se } } +- (void) reloadURL { + [self reloadURLWithCache:YES]; +} + - (void) reloadData { [super reloadData]; - [self reloadURL]; + [self reloadURLWithCache:YES]; } - (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function { @@ -1157,7 +1167,7 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se } - (void) reloadButtonClicked { - [self reloadURL]; + [self reloadURLWithCache:YES]; } - (void) _customButtonClicked { |