Revision: 7472
http://skim-app.svn.sourceforge.net/skim-app/?rev=7472&view=rev
Author: hofman
Date: 2011-09-07 22:36:29 +0000 (Wed, 07 Sep 2011)
Log Message:
-----------
return error when printing fails, to avoid a crash
Modified Paths:
--------------
trunk/NSError_SKExtensions.h
trunk/NSError_SKExtensions.m
trunk/SKMainDocument.m
trunk/SKNotesDocument.m
Modified: trunk/NSError_SKExtensions.h
===================================================================
--- trunk/NSError_SKExtensions.h 2011-09-07 16:50:25 UTC (rev 7471)
+++ trunk/NSError_SKExtensions.h 2011-09-07 22:36:29 UTC (rev 7472)
@@ -43,7 +43,8 @@
enum {
SKWriteFileError = 1,
SKReadFileError = 2,
- SKReadPasteboardError = 3
+ SKReadPasteboardError = 3,
+ SKPrintDocumentError = 4
};
@interface NSError (SKExtensions)
@@ -52,6 +53,7 @@
+ (id)readFileErrorWithLocalizedDescription:(NSString *)description;
+ (id)readPasteboardErrorWithLocalizedDescription:(NSString *)description;
+ (id)userCancelledErrorWithUnderlyingError:(NSError *)error;
++ (id)printDocumentErrorWithLocalizedDescription:(NSString *)description;
- (BOOL)isUserCancelledError;
Modified: trunk/NSError_SKExtensions.m
===================================================================
--- trunk/NSError_SKExtensions.m 2011-09-07 16:50:25 UTC (rev 7471)
+++ trunk/NSError_SKExtensions.m 2011-09-07 22:36:29 UTC (rev 7472)
@@ -54,6 +54,10 @@
return [NSError errorWithDomain:SKDocumentErrorDomain
code:SKReadPasteboardError userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:description, NSLocalizedDescriptionKey, nil]];
}
++ (id)printDocumentErrorWithLocalizedDescription:(NSString *)description {
+ return [NSError errorWithDomain:SKDocumentErrorDomain
code:SKPrintDocumentError userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:description, NSLocalizedDescriptionKey, nil]];
+}
+
+ (id)userCancelledErrorWithUnderlyingError:(NSError *)error {
return [NSError errorWithDomain:NSCocoaErrorDomain
code:NSUserCancelledError userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:error, NSUnderlyingErrorKey, nil]];
}
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2011-09-07 16:50:25 UTC (rev 7471)
+++ trunk/SKMainDocument.m 2011-09-07 22:36:29 UTC (rev 7472)
@@ -884,6 +884,9 @@
[printPanel setOptions:NSPrintPanelShowsCopies |
NSPrintPanelShowsPageRange | NSPrintPanelShowsPaperSize |
NSPrintPanelShowsOrientation | NSPrintPanelShowsScaling |
NSPrintPanelShowsPreview];
[printPanel addAccessoryController:[[[SKPrintAccessoryController alloc]
init] autorelease]];
+ if (printOperation == nil && outError)
+ *outError = [NSError printDocumentErrorWithLocalizedDescription:nil];
+
return printOperation;
}
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2011-09-07 16:50:25 UTC (rev 7471)
+++ trunk/SKNotesDocument.m 2011-09-07 22:36:29 UTC (rev 7472)
@@ -420,6 +420,9 @@
[printInfo release];
[[printOperation printPanel] setOptions:NSPrintPanelShowsCopies |
NSPrintPanelShowsPageRange | NSPrintPanelShowsPaperSize |
NSPrintPanelShowsOrientation | NSPrintPanelShowsScaling |
NSPrintPanelShowsPreview];
+ if (printOperation == nil && outError)
+ *outError = [NSError printDocumentErrorWithLocalizedDescription:nil];
+
return printOperation;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit