Revision: 18490
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18490&view=rev
Author: hofman
Date: 2012-02-05 13:41:30 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
Handle a failed revert from bibtex the same as a failed paste/drag, we should
not remove the document from the error controller in that case because it's not
closed
Modified Paths:
--------------
trunk/bibdesk/BDSKErrorObjectController.h
trunk/bibdesk/BDSKErrorObjectController.m
trunk/bibdesk/BibDocument.h
trunk/bibdesk/BibDocument.m
Modified: trunk/bibdesk/BDSKErrorObjectController.h
===================================================================
--- trunk/bibdesk/BDSKErrorObjectController.h 2012-02-05 13:31:39 UTC (rev
18489)
+++ trunk/bibdesk/BDSKErrorObjectController.h 2012-02-05 13:41:30 UTC (rev
18490)
@@ -71,8 +71,8 @@
// called from the tableView doubleclick
- (void)showEditorForErrorObject:(BDSKErrorObject *)errObj;
-// called to edit a failed paste/drag
-- (void)showEditorForLastPasteDragError;
+// called to edit a failed paste/drag or revert
+- (void)showEditorForLastErrors;
- (void)documentFailedLoad:(BibDocument *)document shouldEdit:(BOOL)shouldEdit;
- (void)handleRemoveDocumentNotification:(NSNotification *)notification;
Modified: trunk/bibdesk/BDSKErrorObjectController.m
===================================================================
--- trunk/bibdesk/BDSKErrorObjectController.m 2012-02-05 13:31:39 UTC (rev
18489)
+++ trunk/bibdesk/BDSKErrorObjectController.m 2012-02-05 13:41:30 UTC (rev
18490)
@@ -230,11 +230,11 @@
} else NSBeep();
}
-// edit paste/drag error; sent via document error panel displayed when paste
fails
-- (void)showEditorForLastPasteDragError{
+// edit paste/drag error or error on revert; sent via document error panel
displayed when paste fails or revert fails
+- (void)showEditorForLastErrors{
if(lastIndex < [self countOfErrors]){
BDSKErrorObject *errObj = [self objectInErrorsAtIndex:lastIndex];
- BDSKASSERT([[errObj editor] isPasteDrag]);
+ //BDSKASSERT([[errObj editor] isPasteDrag]);
[self showWindow:self];
[self showEditorForErrorObject:errObj];
NSIndexSet *indexes = [NSIndexSet
indexSetWithIndexesInRange:NSMakeRange(lastIndex, [self countOfErrors] -
lastIndex)];
@@ -403,8 +403,8 @@
// the document failed to load, the user chose not to keep going,
register failure
[self documentFailedLoad:doc shouldEdit:shouldEdit];
else if (doc == nil && shouldEdit)
- // paste/drag failed, the user chose to edit
- [self showEditorForLastPasteDragError];
+ // paste/drag or revert failed, the user chose to edit
+ [self showEditorForLastErrors];
// return YES to accept for Keep Going, otherwise return NO
return shouldKeepGoing;
}
Modified: trunk/bibdesk/BibDocument.h
===================================================================
--- trunk/bibdesk/BibDocument.h 2012-02-05 13:31:39 UTC (rev 18489)
+++ trunk/bibdesk/BibDocument.h 2012-02-05 13:41:30 UTC (rev 18490)
@@ -243,6 +243,7 @@
unsigned int tmpSortDescending:1;
unsigned int sortGroupsDescending:1;
unsigned int dragFromExternalGroups:1;
+ unsigned int isReverting:1;
unsigned int isDocumentClosed:1;
unsigned int didImport:1;
unsigned int displayMigrationAlert:1;
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2012-02-05 13:31:39 UTC (rev 18489)
+++ trunk/bibdesk/BibDocument.m 2012-02-05 13:41:30 UTC (rev 18490)
@@ -1713,6 +1713,13 @@
#pragma mark -
#pragma mark Opening and Loading Files
+- (BOOL)revertToContentsOfURL:(NSURL *)absoluteURL ofType:(NSString *)typeName
error:(NSError **)outError{
+ docFlags.isReverting = YES;
+ BOOL success = [super revertToContentsOfURL:absoluteURL ofType:typeName
error:outError];
+ docFlags.isReverting = NO;
+ return success;
+}
+
- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)aType
error:(NSError **)outError
{
BOOL success = NO;
@@ -1882,8 +1889,9 @@
[recoveryError setValue:NSLocalizedString(@"There was a problem
reading the file. Do you want to give up, edit the file to correct the errors,
or keep going with everything that could be analyzed?\n\nIf you choose \"Keep
Going\" and then save the file, you will probably lose data.", @"Informative
text in alert dialog") forKey:NSLocalizedRecoverySuggestionErrorKey];
[recoveryError setValue:[BDSKErrorObjectController
sharedErrorObjectController] forKey:NSRecoveryAttempterErrorKey];
[recoveryError setValue:[NSArray
arrayWithObjects:NSLocalizedString(@"Give Up", @"Button title"),
NSLocalizedString(@"Keep Going", @"Button title"), NSLocalizedString(@"Edit
File", @"Button title"), nil] forKey:NSLocalizedRecoveryOptionsErrorKey];
- [recoveryError setValue:self forKey:BDSKFailedDocumentErrorKey];
[recoveryError setValue:error forKey:NSUnderlyingErrorKey];
+ if (docFlags.isReverting == NO)
+ [recoveryError setValue:self forKey:BDSKFailedDocumentErrorKey];
if ([self presentError:recoveryError])
// the user said to keep going, so if they save, they might
clobber data...
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit