From 33c4ff89ac9dd96a071d37462b23c6f6c02ac195 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Mon, 25 Jul 2016 09:51:46 +0200 Subject: [PATCH] Readd a method to prevent UI locking by NSDocument. --- Classes/SBAppDelegate.m | 16 ++++++++++++++++ Classes/SBDocument.m | 3 +++ 2 files changed, 19 insertions(+) diff --git a/Classes/SBAppDelegate.m b/Classes/SBAppDelegate.m index f44ef72..f576dae 100644 --- a/Classes/SBAppDelegate.m +++ b/Classes/SBAppDelegate.m @@ -233,4 +233,20 @@ } +- (nullable __kindof NSDocument *)documentForURL:(NSURL *)url +{ + NSArray<__kindof NSDocument *> *documents = nil; + @synchronized(self) { + documents = [self.documents copy]; + } + + for (NSDocument *doc in documents) { + if ([doc.fileURL isEqualTo:url.filePathURL]) { + return doc; + } + } + + return nil; +} + @end diff --git a/Classes/SBDocument.m b/Classes/SBDocument.m index d0664c8..04e502d 100755 --- a/Classes/SBDocument.m +++ b/Classes/SBDocument.m @@ -200,6 +200,9 @@ return YES; } +/** + * Show the progress modal sheet. + */ - (void)showProgressSheet { self.progressBar.doubleValue = 0;