Revision: 18452
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18452&view=rev
Author: hofman
Date: 2012-01-30 10:40:34 +0000 (Mon, 30 Jan 2012)
Log Message:
-----------
Use error code for temporary cite key warning.
Modified Paths:
--------------
trunk/bibdesk/BDSKEditor.m
trunk/bibdesk/BDSKTextImportController.m
trunk/bibdesk/BibDocument.m
trunk/bibdesk/English.lproj/Localizable.strings
trunk/bibdesk/NSError_BDSKExtensions.h
Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m 2012-01-30 07:35:20 UTC (rev 18451)
+++ trunk/bibdesk/BDSKEditor.m 2012-01-30 10:40:34 UTC (rev 18452)
@@ -85,6 +85,7 @@
#import "NSTableView_BDSKExtensions.h"
#import "NSInvocation_BDSKExtensions.h"
#import "NSTextView_BDSKExtensions.h"
+#import "NSError_BDSKExtensions.h"
#define WEAK_NULL NULL
@@ -1027,7 +1028,7 @@
}
if (canSet == NO){
- NSString *message = NSLocalizedString(@"Not all fields needed
for generating the file location are set. Do you want me to file the paper now
using the available fields, or cancel autofile for this paper?",@"");
+ NSString *message = NSLocalizedString(@"Not all fields needed
for generating the file location are set. Do you want me to file the paper now
using the available fields, or cancel autofile for this paper?",@"Informative
text in alert dialog");
NSString *otherButton = nil;
if([[NSUserDefaults standardUserDefaults]
boolForKey:BDSKFilePapersAutomaticallyKey]){
message = NSLocalizedString(@"Not all fields needed for
generating the file location are set. Do you want me to file the paper now
using the available fields, cancel autofile for this paper, or wait until the
necessary fields are set?", @"Informative text in alert dialog"),
@@ -2690,7 +2691,7 @@
// this returns nil when there was a parser error and the user didn't
decide to proceed anyway
draggedPubs = [[self document] publicationsForString:pbString
type:[pbString contentStringType] verbose:NO error:&error];
// we ignore warnings for parsing with temporary keys, but we want to
ignore the cite key in that case
- if([[error userInfo] objectForKey:@"temporaryCiteKey"] != nil){
+ if([error isLocalError] && [error code] == kBDSKHadMissingCiteKeys) {
hasTemporaryCiteKey = YES;
error = nil;
}
Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m 2012-01-30 07:35:20 UTC (rev
18451)
+++ trunk/bibdesk/BDSKTextImportController.m 2012-01-30 10:40:34 UTC (rev
18452)
@@ -66,6 +66,7 @@
#import "NSEvent_BDSKExtensions.h"
#import "BDSKURLSheetController.h"
#import "NSTextView_BDSKExtensions.h"
+#import "NSError_BDSKExtensions.h"
#define BDSKTextImportControllerFrameAutosaveName @"BDSKTextImportController
Frame Autosave Name"
@@ -1497,7 +1498,7 @@
NSArray *pubs = [document publicationsForString:string type:type
verbose:NO error:&error];
// ignore warnings for parsing with temporary citekeys, as we're not
interested in the cite key
- if ([[error userInfo] valueForKey:@"temporaryCiteKey"] != nil)
+ if ([error isLocalError] && [error code] == kBDSKHadMissingCiteKeys)
error = nil;
if(error || [pubs count] == 0)
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2012-01-30 07:35:20 UTC (rev 18451)
+++ trunk/bibdesk/BibDocument.m 2012-01-30 10:40:34 UTC (rev 18452)
@@ -2214,8 +2214,10 @@
newPubs = newPubs ? [newPubs
arrayByAddingObjectsFromArray:newFilePubs]: newFilePubs;
}
- if(temporaryCiteKey = [[error userInfo] objectForKey:@"temporaryCiteKey"])
+ if([error isLocalError] && [error code] == kBDSKHadMissingCiteKeys) {
+ temporaryCiteKey = [[error userInfo] objectForKey:@"temporaryCiteKey"];
error = nil; // accept temporary cite keys, but show a warning later
+ }
if ([newPubs count] > 0)
[self addPublications:newPubs
publicationsToAutoFile:newFilePubs temporaryCiteKey:temporaryCiteKey
selectLibrary:shouldSelect edit:shouldEdit];
@@ -2306,7 +2308,7 @@
// return an error when we inserted temporary keys, let the caller
decide what to do with it
// don't override a parseError though, as that is probably more
relevant
- parseError = [NSError mutableLocalErrorWithCode:kBDSKParserFailed
localizedDescription:NSLocalizedString(@"Temporary Cite Keys", @"Error
description")];
+ parseError = [NSError
mutableLocalErrorWithCode:kBDSKHadMissingCiteKeys
localizedDescription:NSLocalizedString(@"Temporary Cite Keys", @"Error
description")];
[parseError setValue:@"FixMe" forKey:@"temporaryCiteKey"];
}
Modified: trunk/bibdesk/English.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/bibdesk/NSError_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSError_BDSKExtensions.h 2012-01-30 07:35:20 UTC (rev
18451)
+++ trunk/bibdesk/NSError_BDSKExtensions.h 2012-01-30 10:40:34 UTC (rev
18452)
@@ -63,6 +63,7 @@
kBDSKCannotFindTemporaryDirectoryError, /* Cannot find temporary
directory */
kBDSKCannotCreateTemporaryFileError, /* Cannot create a temporary
file */
kBDSKDocumentOpenError, /* umbrella error type for
document open */
+ kBDSKHadMissingCiteKeys, /* BibTeX data had missing
cite keys */
};
extern NSString *BDSKUnderlyingItemErrorKey;
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