Revision: 23984
          http://sourceforge.net/p/bibdesk/svn/23984
Author:   hofman
Date:     2019-07-09 22:12:48 +0000 (Tue, 09 Jul 2019)
Log Message:
-----------
return a window for the download authentication sheet if available

Modified Paths:
--------------
    trunk/bibdesk/BDSKDBLPGroupServer.h
    trunk/bibdesk/BDSKDBLPGroupServer.m
    trunk/bibdesk/BDSKEntrezGroupServer.m
    trunk/bibdesk/BDSKExternalGroup.m
    trunk/bibdesk/BDSKItemDownload.h
    trunk/bibdesk/BDSKItemDownload.m
    trunk/bibdesk/BDSKOwnerProtocol.h
    trunk/bibdesk/BDSKPreviewItem.m
    trunk/bibdesk/BDSKSearchGroup.m
    trunk/bibdesk/BDSKTextImportController.m
    trunk/bibdesk/BibDocument.m
    trunk/bibdesk/BibItem.m

Modified: trunk/bibdesk/BDSKDBLPGroupServer.h
===================================================================
--- trunk/bibdesk/BDSKDBLPGroupServer.h 2019-07-09 21:40:52 UTC (rev 23983)
+++ trunk/bibdesk/BDSKDBLPGroupServer.h 2019-07-09 22:12:48 UTC (rev 23984)
@@ -38,10 +38,11 @@
 
 #import <Cocoa/Cocoa.h>
 #import "BDSKSearchGroup.h"
+#import "BDSKDownloader.h"
 
 @class BDSKDownload;
 
-@interface BDSKDBLPGroupServer :  NSObject <BDSKSearchGroupServer>
+@interface BDSKDBLPGroupServer :  NSObject <BDSKSearchGroupServer, 
BDSKDownloaderDelegate>
 {
     id<BDSKSearchGroup> group;
     BDSKServerInfo *serverInfo;

Modified: trunk/bibdesk/BDSKDBLPGroupServer.m
===================================================================
--- trunk/bibdesk/BDSKDBLPGroupServer.m 2019-07-09 21:40:52 UTC (rev 23983)
+++ trunk/bibdesk/BDSKDBLPGroupServer.m 2019-07-09 22:12:48 UTC (rev 23984)
@@ -39,7 +39,6 @@
 #import "BDSKServerInfo.h"
 #import "BibItem.h"
 #import "BDSKBibTeXParser.h"
-#import "BDSKDownloader.h"
 #import "NSArray_BDSKExtensions.h"
 #import "NSString_BDSKExtensions.h"
 #import "NSURL_BDSKExtensions.h"
@@ -52,7 +51,7 @@
 
 #define AUTHORS_DATABASE @"Authors"
 
-@interface BDSKDBLPGroupServer () <BDSKDownloaderDelegate>
+@interface BDSKDBLPGroupServer ()
 
 - (void)setSearchTerm:(NSString *)string;
 - (NSString *)searchTerm;
@@ -392,6 +391,10 @@
     }
 }
 
+- (NSWindow *)downloader:(BDSKDownloader *)downloader 
downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
+    return [group windowForSheetForObject:self];
+}
+
 static inline NSString *stringForXPath(NSXMLNode *node, NSString *XPath) {
     return  [[[[node nodesForXPath:XPath error:NULL] firstObject] stringValue] 
  stringByTrimmingCharactersInSet:[NSCharacterSet 
whitespaceAndNewlineCharacterSet]];
 }

Modified: trunk/bibdesk/BDSKEntrezGroupServer.m
===================================================================
--- trunk/bibdesk/BDSKEntrezGroupServer.m       2019-07-09 21:40:52 UTC (rev 
23983)
+++ trunk/bibdesk/BDSKEntrezGroupServer.m       2019-07-09 22:12:48 UTC (rev 
23984)
@@ -326,6 +326,10 @@
     [group addPublications:nil];
 }
 
+- (NSWindow *)downloader:(BDSKDownloader *)downloader 
downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
+    return [group windowForSheetForObject:self];
+}
+
 - (void)startDownloadFromURL:(NSURL *)theURL;
 {
     NSURLRequest *request = [NSURLRequest requestWithURL:theURL];

Modified: trunk/bibdesk/BDSKExternalGroup.m
===================================================================
--- trunk/bibdesk/BDSKExternalGroup.m   2019-07-09 21:40:52 UTC (rev 23983)
+++ trunk/bibdesk/BDSKExternalGroup.m   2019-07-09 22:12:48 UTC (rev 23984)
@@ -209,6 +209,8 @@
 
 - (BDSKItemSearchIndexes *)searchIndexes{ return searchIndexes; }
 
+- (NSWindow *)windowForSheetForObject:(id)object { return [[self document] 
windowForSheet]; }
+
 @end
 
 #pragma mark -

Modified: trunk/bibdesk/BDSKItemDownload.h
===================================================================
--- trunk/bibdesk/BDSKItemDownload.h    2019-07-09 21:40:52 UTC (rev 23983)
+++ trunk/bibdesk/BDSKItemDownload.h    2019-07-09 22:12:48 UTC (rev 23984)
@@ -74,6 +74,7 @@
 
 - (void)itemDownloadDidUpdate:(BDSKItemDownload *)download;
 - (void)itemDownloadDidFinish:(BDSKItemDownload *)download;
+- (NSWindow *)itemDownloadWindowForAuthenticationSheet:(BDSKItemDownload 
*)download;
 
 @end
 

Modified: trunk/bibdesk/BDSKItemDownload.m
===================================================================
--- trunk/bibdesk/BDSKItemDownload.m    2019-07-09 21:40:52 UTC (rev 23983)
+++ trunk/bibdesk/BDSKItemDownload.m    2019-07-09 22:12:48 UTC (rev 23984)
@@ -151,4 +151,8 @@
     [[self delegate] itemDownloadDidFinish:self];
 }
 
+- (NSWindow *)downloader:(BDSKDownloader *)downloader 
downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
+    return [[self delegate] itemDownloadWindowForAuthenticationSheet:self];
+}
+
 @end

Modified: trunk/bibdesk/BDSKOwnerProtocol.h
===================================================================
--- trunk/bibdesk/BDSKOwnerProtocol.h   2019-07-09 21:40:52 UTC (rev 23983)
+++ trunk/bibdesk/BDSKOwnerProtocol.h   2019-07-09 22:12:48 UTC (rev 23984)
@@ -50,5 +50,6 @@
 - (NSURL *)fileURL;
 - (NSString *)basePath;
 - (NSString *)documentInfoForKey:(NSString *)key;
+- (NSWindow *)windowForSheetForObject:(id)object;
 
 @end

Modified: trunk/bibdesk/BDSKPreviewItem.m
===================================================================
--- trunk/bibdesk/BDSKPreviewItem.m     2019-07-09 21:40:52 UTC (rev 23983)
+++ trunk/bibdesk/BDSKPreviewItem.m     2019-07-09 22:12:48 UTC (rev 23984)
@@ -186,6 +186,8 @@
 
 - (NSString *)documentInfoForKey:(NSString *)key { return key; }
 
+- (NSWindow *)windowForSheetForObject:(id)object { return nil; }
+
 @end
 
 

Modified: trunk/bibdesk/BDSKSearchGroup.m
===================================================================
--- trunk/bibdesk/BDSKSearchGroup.m     2019-07-09 21:40:52 UTC (rev 23983)
+++ trunk/bibdesk/BDSKSearchGroup.m     2019-07-09 22:12:48 UTC (rev 23984)
@@ -529,4 +529,6 @@
 
 - (BOOL)isDocument { return NO; }
 
+- (NSWindow *)windowForSheetForObject:(id)object {return nil; }
+
 @end

Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m    2019-07-09 21:40:52 UTC (rev 
23983)
+++ trunk/bibdesk/BDSKTextImportController.m    2019-07-09 22:12:48 UTC (rev 
23984)
@@ -526,6 +526,10 @@
 
 - (BOOL)isDocument { return NO; }
 
+- (NSWindow *)windowForSheetForObject:(id)object {
+     return [self window];
+}
+
 #pragma mark Private
 
 // workaround for webview bug, which looses its selection when the focus 
changes to another view

Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2019-07-09 21:40:52 UTC (rev 23983)
+++ trunk/bibdesk/BibDocument.m 2019-07-09 22:12:48 UTC (rev 23984)
@@ -625,6 +625,15 @@
     return [[[NSDocumentController sharedDocumentController] mainDocument] 
isEqual:self];
 }
 
+- (NSWindow *)windowForSheetForObject:(id)object {
+    if ([object isKindOfClass:[BibItem class]]) {
+        BDSKEditor *editor = [self editorForPublication:object create:NO];
+        if (editor)
+            return [editor window];
+    }
+    return [self windowForSheet];
+}
+
 - (BOOL)commitPendingEdits {
     for (id editor in [self windowControllers]) {
         // not all window controllers are editors...

Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m     2019-07-09 21:40:52 UTC (rev 23983)
+++ trunk/bibdesk/BibItem.m     2019-07-09 22:12:48 UTC (rev 23984)
@@ -3244,6 +3244,10 @@
     }
 }
 
+- (NSWindow *)itemDownloadWindowForAuthenticationSheet:(BDSKItemDownload 
*)download {
+    return [[self owner] windowForSheetForObject:self];
+}
+
 - (void)downloadURLForField:(NSString *)field {
     NSURL *url = [self remoteURLForField:field];
     if (url && [[downloads valueForKey:@"URL"] containsObject:url] == NO) {

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

Reply via email to