Revision: 27791
http://sourceforge.net/p/bibdesk/svn/27791
Author: hofman
Date: 2022-08-11 11:26:33 +0000 (Thu, 11 Aug 2022)
Log Message:
-----------
force relaoding favicon for reloadFromOrigin:
Modified Paths:
--------------
trunk/bibdesk/BDSKWebView.h
trunk/bibdesk/BDSKWebView.m
Modified: trunk/bibdesk/BDSKWebView.h
===================================================================
--- trunk/bibdesk/BDSKWebView.h 2022-08-11 09:18:29 UTC (rev 27790)
+++ trunk/bibdesk/BDSKWebView.h 2022-08-11 11:26:33 UTC (rev 27791)
@@ -56,6 +56,7 @@
BDSKWebDelegate *webDelegate;
BDSKDownload *faviconDownload;
NSImage *favicon;
+ BOOL faviconFromOrigin;
}
@property (nonatomic, assign) id<BDSKWebViewDelegate> delegate;
Modified: trunk/bibdesk/BDSKWebView.m
===================================================================
--- trunk/bibdesk/BDSKWebView.m 2022-08-11 09:18:29 UTC (rev 27790)
+++ trunk/bibdesk/BDSKWebView.m 2022-08-11 11:26:33 UTC (rev 27791)
@@ -123,6 +123,7 @@
- (void)setURL:(NSURL *)newURL {
if (newURL && [[[[[self mainFrame] dataSource] request] URL]
isEqual:newURL] == NO) {
+ faviconFromOrigin = NO;
[self clearFavicon];
[[self mainFrame] loadRequest:[NSURLRequest requestWithURL:newURL]];
}
@@ -139,12 +140,18 @@
#pragma mark Actions
- (IBAction)reload:(id)sender {
+ faviconFromOrigin = NO;
if (([NSEvent standardModifierFlags] & NSShiftKeyMask) != 0)
- [super reloadFromOrigin:sender];
+ [self reloadFromOrigin:sender];
else
[super reload:self];
}
+- (IBAction)reloadFromOrigin:(id)sender {
+ faviconFromOrigin = YES;
+ [super reloadFromOrigin:sender];
+}
+
- (IBAction)addBookmark:(id)sender {
WebDataSource *datasource = [[self mainFrame] dataSource];
NSURL *theURL = [[datasource request] URL];
@@ -218,7 +225,8 @@
NSImage *icon = [[BDSKWebIconDatabase sharedDatabase]
recentIconForURLString:[self mainFrameURL]];
if (icon) {
[self setFavicon:icon];
- return;
+ if (faviconFromOrigin == NO)
+ return;
}
NSMutableArray *favicons = [NSMutableArray array];
@@ -265,11 +273,15 @@
}
if (urlString == nil)
urlString = [[favicons firstObject] valueForKey:@"url"] ?:
@"favicon.ico";
- if (urlString == nil)
+ if (urlString == nil) {
+ faviconFromOrigin = NO;
return;
+ }
NSURL *faviconURL = [NSURL URLWithString:urlString relativeToURL:[[[frame
dataSource] request] URL]];
- if (faviconURL == nil)
+ if (faviconURL == nil) {
+ faviconFromOrigin = NO;
return;
+ }
if (faviconDownload) {
[faviconDownload cancel];
[faviconDownload release];
@@ -280,10 +292,13 @@
if (icon) {
[[BDSKWebIconDatabase sharedDatabase] setIcon:icon withData:nil
fromURLString:[faviconURL absoluteString] forURLString:[self mainFrameURL]];
[self setFavicon:icon];
- } else {
- NSURLRequest *request = [NSURLRequest requestWithURL:faviconURL];
- faviconDownload = [[[BDSKDownloader sharedDownloader]
startDataDownloadWithRequest:request delegate:self] retain];
+ if (faviconFromOrigin == NO)
+ return;
}
+
+ faviconFromOrigin = NO;
+ NSURLRequest *request = [NSURLRequest requestWithURL:faviconURL];
+ faviconDownload = [[[BDSKDownloader sharedDownloader]
startDataDownloadWithRequest:request delegate:self] retain];
}
- (void)resetFavicon {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit