Revision: 29895
          http://sourceforge.net/p/bibdesk/svn/29895
Author:   hofman
Date:     2025-11-29 17:09:48 +0000 (Sat, 29 Nov 2025)
Log Message:
-----------
use condition key for default smart group name for non-descriptive values

Modified Paths:
--------------
    trunk/bibdesk/BDSKCondition.h
    trunk/bibdesk/BDSKCondition.m
    trunk/bibdesk/BDSKSmartGroup.m

Modified: trunk/bibdesk/BDSKCondition.h
===================================================================
--- trunk/bibdesk/BDSKCondition.h       2025-11-29 16:45:38 UTC (rev 29894)
+++ trunk/bibdesk/BDSKCondition.h       2025-11-29 17:09:48 UTC (rev 29895)
@@ -156,6 +156,8 @@
 
 @property (nonatomic, nullable, weak) id<BDSKSmartGroup> group;
 
+@property (nonatomic, readonly) NSString *defaultName;
+
 @end
 
 

Modified: trunk/bibdesk/BDSKCondition.m
===================================================================
--- trunk/bibdesk/BDSKCondition.m       2025-11-29 16:45:38 UTC (rev 29894)
+++ trunk/bibdesk/BDSKCondition.m       2025-11-29 17:09:48 UTC (rev 29895)
@@ -65,7 +65,7 @@
     return keyPaths;
 }
 
-@synthesize key, stringComparison, stringValue, attachmentComparison, 
countValue, dateComparison, numberValue, andNumberValue, periodValue, 
dateValue, toDateValue, group;
+@synthesize key, stringComparison, stringValue, attachmentComparison, 
countValue, dateComparison, numberValue, andNumberValue, periodValue, 
dateValue, toDateValue, group, defaultName;
 @dynamic dictionaryValue, value, comparison, dateCondition, 
attachmentCondition, stringCondition;
 
 + (NSString *)dictionaryVersion {
@@ -604,6 +604,14 @@
     return [[item groupsForField:field] containsObject:value];
 }
 
+- (NSString *)defaultName {
+    if (([self isDateCondition] && [self dateComparison] < BDSKDate) ||
+        ([self isAttachmentCondition] && [self attachmentComparison] < 
BDSKAttachmentContain))
+        return [self key];
+    else
+        return [self value];
+}
+
 #pragma mark Cached dates
 
 - (void)getStartDate:(NSDate **)startDate endDate:(NSDate **)endDate {

Modified: trunk/bibdesk/BDSKSmartGroup.m
===================================================================
--- trunk/bibdesk/BDSKSmartGroup.m      2025-11-29 16:45:38 UTC (rev 29894)
+++ trunk/bibdesk/BDSKSmartGroup.m      2025-11-29 17:09:48 UTC (rev 29895)
@@ -70,7 +70,7 @@
 - (instancetype)initWithFilter:(BDSKFilter *)aFilter {
        NSString *aName = nil;
        if ([[aFilter conditions] count] > 0)
-               aName = [(BDSKCondition *)[[aFilter conditions] firstObject] 
value];
+               aName = [[[aFilter conditions] firstObject] defaultName];
        if ([NSString isEmptyString:aName])
                aName = NSLocalizedString(@"Smart Group", @"Default name for 
smart group");
        self = [self initWithName:aName filter:aFilter];

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

Reply via email to