Revision: 28340
http://sourceforge.net/p/bibdesk/svn/28340
Author: hofman
Date: 2023-09-13 14:38:03 +0000 (Wed, 13 Sep 2023)
Log Message:
-----------
make sure default condition value is set, always for date or attachment
conditions as they set multiple default values
Modified Paths:
--------------
trunk/bibdesk/BDSKCondition+Scripting.m
trunk/bibdesk/BDSKCondition.m
Modified: trunk/bibdesk/BDSKCondition+Scripting.m
===================================================================
--- trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-13 14:26:12 UTC (rev
28339)
+++ trunk/bibdesk/BDSKCondition+Scripting.m 2023-09-13 14:38:03 UTC (rev
28340)
@@ -157,9 +157,10 @@
id newValue = [properties objectForKey:@"scriptingValue"];
if ([newValue isEqual:[NSNull null]])
newValue = nil;
- [self setDefaultValue];
if (newValue == nil) {
+ [self setDefaultValue];
} else if ([self isDateCondition]) {
+ [self setDefaultValue];
if ([newValue isKindOfClass:[NSDictionary class]]) {
id value;
if ((value = [newValue objectForKey:@"numberValue"])) {
@@ -181,6 +182,7 @@
[cmd setScriptErrorString:@"Invalid value for smart
condition."];
}
} else if ([self isAttachmentCondition]) {
+ [self setDefaultValue];
if ([newValue isKindOfClass:[NSNumber class]] || [newValue
isKindOfClass:[NSString class]]) {
switch ([self attachmentComparison]) {
case BDSKCountEqual:
Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m 2023-09-13 14:26:12 UTC (rev 28339)
+++ trunk/bibdesk/BDSKCondition.m 2023-09-13 14:38:03 UTC (rev 28340)
@@ -113,7 +113,12 @@
// the order is important
if (comparisonNumber != nil)
[self setComparison:[comparisonNumber integerValue]];
+ else
+ [self setDefaultComparison];
+ if (([self isDateCondition] || [self isAttachmentCondition]) || aValue
== nil)
+ [self setDefaultValue];
+
if (aValue != nil)
[self setValue:aValue];
@@ -138,6 +143,8 @@
// the order is important
[self setKey:[decoder decodeObjectForKey:@"key"]];
[self setComparison:[decoder
decodeIntegerForKey:@"comparison"]];
+ if ([self isDateCondition] || [self isAttachmentCondition])
+ [self setDefaultValue];
[self setValue:[decoder decodeObjectForKey:@"value"]];
BDSKASSERT(key != nil);
BDSKASSERT([self value] != nil);
@@ -168,6 +175,8 @@
// the order is important
[copy setKey:[self key]];
[copy setComparison:[self comparison]];
+ if ([copy isDateCondition] || [copy isAttachmentCondition])
+ [copy setDefaultValue];
[copy setValue:[self value]];
return copy;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit