From ff4b0e678bc700756c61f341dd11fb7079cd6cb2 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 19 Oct 2023 09:58:59 -0400 Subject: [PATCH] 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. --- Meta/Lagom/Contrib/MacPDF/AppDelegate.mm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Meta/Lagom/Contrib/MacPDF/AppDelegate.mm b/Meta/Lagom/Contrib/MacPDF/AppDelegate.mm index 364d48ecb7..c0af16b6fd 100644 --- a/Meta/Lagom/Contrib/MacPDF/AppDelegate.mm +++ b/Meta/Lagom/Contrib/MacPDF/AppDelegate.mm @@ -35,4 +35,13 @@ return YES; } +- (BOOL)application:(NSApplication*)sender openFile:(NSString*)filename +{ + [[NSDocumentController sharedDocumentController] + openDocumentWithContentsOfURL:[NSURL fileURLWithPath:filename] + display:YES + completionHandler:^(NSDocument*, BOOL, NSError*) {}]; + return YES; +} + @end