Selaa lähdekoodia

MacPDF: Make "Open With" and dropping files on dock tile work

I would've expected that there's some way to have this work
automatically in an NSDocument-based application, but I haven't
found it yet. So manually implement the delegate for now.
Nico Weber 1 vuosi sitten
vanhempi
commit
ff4b0e678b
1 muutettua tiedostoa jossa 9 lisäystä ja 0 poistoa
  1. 9 0
      Meta/Lagom/Contrib/MacPDF/AppDelegate.mm

+ 9 - 0
Meta/Lagom/Contrib/MacPDF/AppDelegate.mm

@@ -35,4 +35,13 @@
     return YES;
     return YES;
 }
 }
 
 
+- (BOOL)application:(NSApplication*)sender openFile:(NSString*)filename
+{
+    [[NSDocumentController sharedDocumentController]
+        openDocumentWithContentsOfURL:[NSURL fileURLWithPath:filename]
+                              display:YES
+                    completionHandler:^(NSDocument*, BOOL, NSError*) {}];
+    return YES;
+}
+
 @end
 @end