Revision: 4116
http://skim-app.svn.sourceforge.net/skim-app/?rev=4116&view=rev
Author: hofman
Date: 2008-07-02 09:47:14 -0700 (Wed, 02 Jul 2008)
Log Message:
-----------
Always set flag to know if we're exporting, and always reset it using a custom
callback. Otherwise the flag may not be reset back to NO if the user canceled a
Save As or Export action.
Modified Paths:
--------------
trunk/SKNotesDocument.m
trunk/SKPDFDocument.m
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2008-07-02 00:02:11 UTC (rev 4115)
+++ trunk/SKNotesDocument.m 2008-07-02 16:47:14 UTC (rev 4116)
@@ -150,17 +150,19 @@
return success;
}
+- (void)document:(NSDocument *)doc didSave:(BOOL)didSave contextInfo:(void
*)contextInfo {
+ exportUsingPanel = NO;
+}
+
- (void)runModalSavePanelForSaveOperation:(NSSaveOperationType)saveOperation
delegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void
*)contextInfo {
// Override so we can determine if this is a save, saveAs or export
operation, so we can prepare the correct accessory view
- if (saveOperation == NSSaveToOperation)
- exportUsingPanel = YES;
- [super runModalSavePanelForSaveOperation:saveOperation delegate:delegate
didSaveSelector:didSaveSelector contextInfo:contextInfo];
+ exportUsingPanel = (saveOperation == NSSaveToOperation);
+ [super runModalSavePanelForSaveOperation:saveOperation delegate:self
didSaveSelector:@selector(document:didSave:contextInfo:) contextInfo:NULL];
}
- (BOOL)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName
forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError{
if (saveOperation == NSSaveToOperation && exportUsingPanel)
[[NSUserDefaults standardUserDefaults] setObject:typeName
forKey:SKLastExportedNotesTypeKey];
- exportUsingPanel = NO;
return [super saveToURL:absoluteURL ofType:typeName
forSaveOperation:saveOperation error:outError];
}
Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m 2008-07-02 00:02:11 UTC (rev 4115)
+++ trunk/SKPDFDocument.m 2008-07-02 16:47:14 UTC (rev 4116)
@@ -262,11 +262,14 @@
return success;
}
+- (void)document:(NSDocument *)doc didSave:(BOOL)didSave contextInfo:(void
*)contextInfo {
+ exportUsingPanel = NO;
+}
+
- (void)runModalSavePanelForSaveOperation:(NSSaveOperationType)saveOperation
delegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void
*)contextInfo {
// Override so we can determine if this is a save, saveAs or export
operation, so we can prepare the correct accessory view
- if (saveOperation == NSSaveToOperation)
- exportUsingPanel = YES;
- [super runModalSavePanelForSaveOperation:saveOperation delegate:delegate
didSaveSelector:didSaveSelector contextInfo:contextInfo];
+ exportUsingPanel = (saveOperation == NSSaveToOperation);
+ [super runModalSavePanelForSaveOperation:saveOperation delegate:self
didSaveSelector:@selector(document:didSave:contextInfo:) contextInfo:NULL];
}
- (BOOL)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName
forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError **)outError{
@@ -390,8 +393,6 @@
isSaving = NO;
}
- exportUsingPanel = NO;
-
if (success == NO && outError != NULL)
*outError = error ? error : [NSError
errorWithDomain:SKDocumentErrorDomain code:0 userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:NSLocalizedString(@"Unable to write file", @"Error
description"), NSLocalizedDescriptionKey, nil]];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit