Revision: 17967
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=17967&view=rev
Author:   hofman
Date:     2011-06-22 17:38:35 +0000 (Wed, 22 Jun 2011)

Log Message:
-----------
allow setting scripting properties when document is not yet set, as that may 
happen when passing properties in the "make" command.

Modified Paths:
--------------
    trunk/bibdesk/BibItem+Scripting.m

Modified: trunk/bibdesk/BibItem+Scripting.m
===================================================================
--- trunk/bibdesk/BibItem+Scripting.m   2011-06-22 06:34:55 UTC (rev 17966)
+++ trunk/bibdesk/BibItem+Scripting.m   2011-06-22 17:38:35 UTC (rev 17967)
@@ -131,7 +131,7 @@
 }
 
 - (void)insertObject:(NSURL *)newURL inLinkedFilesAtIndex:(NSUInteger)idx {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         BDSKLinkedFile *file = [BDSKLinkedFile linkedFileWithURL:newURL 
delegate:self];
         if (file) {
             NSArray *localFiles = [self localFiles];
@@ -160,7 +160,7 @@
 }
 
 - (void)insertObject:(NSString *)newURLString 
inLinkedURLsAtIndex:(NSUInteger)idx {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         NSURL *newURL = [NSURL 
URLWithStringByNormalizingPercentEscapes:newURLString];
         BDSKLinkedFile *file = [BDSKLinkedFile linkedFileWithURL:newURL 
delegate:self];
         if (file) {
@@ -206,7 +206,7 @@
 }
 
 - (void)setScriptingType:(NSString *)newType {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         [self setPubType:(NSString *)newType];
         [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
     } else {
@@ -221,7 +221,7 @@
 }
 
 - (void)setScriptingCiteKey:(NSString *)newKey {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         [self setCiteKey:(NSString *)newKey];
         [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
     } else {
@@ -236,7 +236,7 @@
 }
 
 - (void)setScriptingTitle:(NSString*)newTitle {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         [self setField:BDSKTitleString toValue:newTitle];
         [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
     } else {
@@ -252,7 +252,7 @@
 }
 
 - (void) setMonth:(NSString*) newMonth {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         [self setField:BDSKMonthString toValue:newMonth];
         [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
     } else {
@@ -268,7 +268,7 @@
 }
 
 - (void) setYear:(NSString*) newYear {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         [self setField:BDSKYearString toValue:newYear];
         [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
     } else {
@@ -305,7 +305,7 @@
 }
 
 - (void)setScriptingColor:(NSColor *)newColor {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         if ([newColor isEqual:[NSNull null]])
             newColor = nil;
         [self setColor:newColor];
@@ -331,7 +331,7 @@
 }
 
 - (void) setRemoteURLString:(NSString*) newURLString{
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         BDSKLinkedFile *file = [BDSKLinkedFile 
linkedFileWithURLString:newURLString];
         if (file == nil)
             return;
@@ -359,7 +359,7 @@
 }
 
 - (void) setLocalURLString:(NSString*) newPath {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         NSURL *newURL = [newPath hasPrefix:@"file://"] ? [NSURL 
URLWithString:newPath] : [NSURL fileURLWithPath:[newPath 
stringByExpandingTildeInPath]];
         if (newURL == nil)
             return;
@@ -389,7 +389,7 @@
 }
 
 - (void) setAbstract:(NSString*) newAbstract {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         [self setField:BDSKAbstractString toValue:newAbstract];
         [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
     } else {
@@ -404,7 +404,7 @@
 }
 
 - (void) setAnnotation:(NSString*) newAnnotation {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         [self setField:BDSKAnnoteString toValue:newAnnotation];
         [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
     } else {
@@ -419,7 +419,7 @@
 }
 
 - (void) setRssDescription:(NSString*) newDesc {
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         [self setField:BDSKRssDescriptionString toValue:newDesc];
         [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
     } else {
@@ -465,7 +465,7 @@
 }
 
 - (void)setKeywords:(NSString *)keywords{
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         [self setField:BDSKKeywordsString toValue:keywords];
         [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
     } else {
@@ -480,7 +480,7 @@
 }
 
 - (void)setScriptingRating:(NSInteger)rating{
-    if ([[self owner] isDocument]) {
+    if ([self owner] == nil || [[self owner] isDocument]) {
         [self setRating:rating];
         [[self undoManager] 
setActionName:NSLocalizedString(@"AppleScript",@"Undo action name for 
AppleScript")];
     } else {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to