Revision: 23951
          http://sourceforge.net/p/bibdesk/svn/23951
Author:   hofman
Date:     2019-07-06 11:30:32 +0000 (Sat, 06 Jul 2019)
Log Message:
-----------
don't handle default launch procedure when opening a file or URL

Modified Paths:
--------------
    trunk/bibdesk/BDSKAppController.m
    trunk/bibdesk/BDSKDocumentController.h
    trunk/bibdesk/BDSKDocumentController.m

Modified: trunk/bibdesk/BDSKAppController.m
===================================================================
--- trunk/bibdesk/BDSKAppController.m   2019-07-06 06:30:52 UTC (rev 23950)
+++ trunk/bibdesk/BDSKAppController.m   2019-07-06 11:30:32 UTC (rev 23951)
@@ -333,8 +333,9 @@
 }
 
 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification{
-    if (didCheckReopen == NO)
+    if (didCheckReopen == NO && [[NSApp windows] count] == 0 && 
[(BDSKDocumentController *)[NSDocumentController sharedDocumentController] 
openedFile] == NO)
         [self applicationShouldOpenUntitledFile:NSApp];
+    didCheckReopen = YES;
     [[NSUserDefaults standardUserDefaults] 
removeObjectForKey:BDSKIsRelaunchKey];
     
     // register our help book, so it's available for methods that don't 
register this, e.g. the web group
@@ -765,6 +766,8 @@
 
 
 - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event 
withReplyEvent:(NSAppleEventDescriptor *)replyEvent{
+    didCheckReopen = YES;
+    
     NSString *theURLString = [[event descriptorForKeyword:keyDirectObject] 
stringValue];
     NSURL *theURL = nil;
     BibDocument *document = nil;

Modified: trunk/bibdesk/BDSKDocumentController.h
===================================================================
--- trunk/bibdesk/BDSKDocumentController.h      2019-07-06 06:30:52 UTC (rev 
23950)
+++ trunk/bibdesk/BDSKDocumentController.h      2019-07-06 11:30:32 UTC (rev 
23951)
@@ -49,10 +49,14 @@
     NSMutableDictionary *customOpenSettings;
     
     NSInteger openType;
+    
+    BOOL openedFile;
 }
 
 - (BOOL)autosavesInPlace;
 
+- (BOOL)openedFile;
+
 - (id)mainDocument;
 - (BibDocument *)currentBibliographyDocumentAndDisplay:(BOOL)display 
error:(NSError **)outError;
 

Modified: trunk/bibdesk/BDSKDocumentController.m
===================================================================
--- trunk/bibdesk/BDSKDocumentController.m      2019-07-06 06:30:52 UTC (rev 
23950)
+++ trunk/bibdesk/BDSKDocumentController.m      2019-07-06 11:30:32 UTC (rev 
23951)
@@ -106,6 +106,8 @@
         
         didInitialize = YES;
         
+        openedFile = NO;
+        
         // we must set this now, as the system may check it very early
         // defaults may not have been registered at this point
         // but the default value is 0, so that is equivalenty to not being set
@@ -118,6 +120,10 @@
     return autosavesInPlace;
 }
 
+- (BOOL)openedFile {
+    return openedFile;
+}
+
 - (id)mainDocument {
     return mainDocument;
 }
@@ -354,6 +360,7 @@
 }
 
 - (void)openDocumentWithContentsOfURL:(NSURL *)absoluteURL 
display:(BOOL)displayDocument completionHandler:(void (^)(NSDocument *document, 
BOOL documentWasAlreadyOpen, NSError *error))completionHandler {
+    openedFile = YES;
     
     // Get the search string keyword if available (Spotlight passes this)
     NSAppleEventDescriptor *event = [[NSAppleEventManager 
sharedAppleEventManager] currentAppleEvent];

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