Revision: 14741
http://sourceforge.net/p/skim-app/code/14741
Author: hofman
Date: 2024-11-23 15:19:01 +0000 (Sat, 23 Nov 2024)
Log Message:
-----------
Don't return error in print completion handler. Display error when failing to
open document for printing. Failure to print the document is already displayed
when it occurred, so don't do this twice.
Modified Paths:
--------------
trunk/SKApplicationController.m
trunk/SKDocumentController.h
trunk/SKDocumentController.m
trunk/de.lproj/Localizable.strings
trunk/en.lproj/Localizable.strings
trunk/es.lproj/Localizable.strings
trunk/fr.lproj/Localizable.strings
trunk/it.lproj/Localizable.strings
trunk/ja.lproj/Localizable.strings
trunk/nl.lproj/Localizable.strings
trunk/pl.lproj/Localizable.strings
trunk/ru.lproj/Localizable.strings
trunk/zh_CN.lproj/Localizable.strings
trunk/zh_TW.lproj/Localizable.strings
Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m 2024-11-23 10:38:25 UTC (rev 14740)
+++ trunk/SKApplicationController.m 2024-11-23 15:19:01 UTC (rev 14741)
@@ -308,9 +308,7 @@
for (NSString *fileName in fileNames)
[fileURLs addObject:[NSURL fileURLWithPath:fileName]];
- [[NSDocumentController sharedDocumentController]
printDocumentsWithContentsOfURLs:fileURLs withSettings:printSettings
showPrintPanels:showPrintPanels completionHandler:^(BOOL didPrintSuccessfully,
NSError *error){
- if (didPrintSuccessfully == NO && error)
- [NSApp presentError:error];
+ [[NSDocumentController sharedDocumentController]
printDocumentsWithContentsOfURLs:fileURLs withSettings:printSettings
showPrintPanels:showPrintPanels completionHandler:^(BOOL didPrintSuccessfully){
if (reply == NSPrintingReplyLater)
[NSApp replyToOpenOrPrint:didPrintSuccessfully ?
NSApplicationDelegateReplySuccess : NSApplicationDelegateReplyFailure];
reply = didPrintSuccessfully ? NSPrintingSuccess : NSPrintingFailure;
Modified: trunk/SKDocumentController.h
===================================================================
--- trunk/SKDocumentController.h 2024-11-23 10:38:25 UTC (rev 14740)
+++ trunk/SKDocumentController.h 2024-11-23 15:19:01 UTC (rev 14741)
@@ -81,7 +81,7 @@
- (void)openDocumentWithBookmark:(SKBookmark *)bookmark
completionHandler:(void (^)(NSDocument * _Nullable document, BOOL
documentWasAlreadyOpen, NSError * _Nullable error))completionHandler;
- (void)openDocumentWithBookmarks:(NSArray<SKBookmark *> *)bookmarks
completionHandler:(void (^)(NSDocument * _Nullable document, BOOL
documentWasAlreadyOpen, NSError * _Nullable error))completionHandler;
-- (void)printDocumentsWithContentsOfURLs:(NSArray<NSURL *> *)urls
withSettings:(NSDictionary<NSString *, id> *)printSettings
showPrintPanels:(BOOL)showPrintPanels completionHandler:(void (^)(BOOL
didPrintSuccessfully, NSError * _Nullable error))completionHandler;
+- (void)printDocumentsWithContentsOfURLs:(NSArray<NSURL *> *)urls
withSettings:(NSDictionary<NSString *, id> *)printSettings
showPrintPanels:(BOOL)showPrintPanels completionHandler:(void (^)(BOOL
didPrintSuccessfully))completionHandler;
- (nullable Class)documentClassForContentsOfURL:(NSURL *)inAbsoluteURL;
Modified: trunk/SKDocumentController.m
===================================================================
--- trunk/SKDocumentController.m 2024-11-23 10:38:25 UTC (rev 14740)
+++ trunk/SKDocumentController.m 2024-11-23 15:19:01 UTC (rev 14741)
@@ -658,10 +658,10 @@
}
}
-- (void)printDocumentsWithContentsOfURLs:(NSArray *)urls
withSettings:(NSDictionary *)printSettings
showPrintPanels:(BOOL)showPrintPanels completionHandler:(void (^)(BOOL
didPrintSuccessfully, NSError *error))completionHandler {
+- (void)printDocumentsWithContentsOfURLs:(NSArray *)urls
withSettings:(NSDictionary *)printSettings
showPrintPanels:(BOOL)showPrintPanels completionHandler:(void (^)(BOOL
didPrintSuccessfully))completionHandler {
NSUInteger count = [urls count];
if ([urls count] == 0) {
- completionHandler(YES, nil);
+ completionHandler(YES);
return;
}
@@ -673,15 +673,17 @@
if (documentWasAlreadyOpen == NO)
[document close];
if (success == NO)
- completionHandler(NO, showPrintPanels ? nil : [NSError
printDocumentErrorWithLocalizedDescription:[NSString
stringWithFormat:NSLocalizedString(@"The file \"%@\" could not be printed",
@"Error description"), [document displayName]]]);
+ completionHandler(NO);
else if (nextURLs)
[self printDocumentsWithContentsOfURLs:nextURLs
withSettings:printSettings showPrintPanels:showPrintPanels
completionHandler:completionHandler];
else
- completionHandler(YES, nil);
+ completionHandler(YES);
};
[document printDocumentWithSettings:printSettings
showPrintPanel:showPrintPanels delegate:self
didPrintSelector:@selector(document:didPrint:contextInfo:) contextInfo:(void
*)CFBridgingRetain(block)];
} else {
- completionHandler(NO, error);
+ if (error)
+ [self presentError:error];
+ completionHandler(NO);
}
}];
}
@@ -728,7 +730,7 @@
- (void)printDocumentFromURLOnPboard:(NSPasteboard *)pboard userData:(NSString
*)userData error:(out NSString * __autoreleasing *)errorString {
NSURL *theURL = [[NSURL readURLsFromPasteboard:pboard] firstObject];
if (theURL)
- [self printDocumentsWithContentsOfURLs:@[theURL] withSettings:@{}
showPrintPanels:[userData boolValue] completionHandler:^(BOOL
didPrintSuccessfully, NSError *error){}];
+ [self printDocumentsWithContentsOfURLs:@[theURL] withSettings:@{}
showPrintPanels:[userData boolValue] completionHandler:^(BOOL
didPrintSuccessfully){}];
}
@end
Modified: trunk/de.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/en.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/es.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/fr.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/it.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/ja.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/nl.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/pl.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/ru.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/zh_CN.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/zh_TW.lproj/Localizable.strings
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit