Revision: 26457
          http://sourceforge.net/p/bibdesk/svn/26457
Author:   hofman
Date:     2021-07-22 17:26:29 +0000 (Thu, 22 Jul 2021)
Log Message:
-----------
use count rather than numberValue for group sorting. Use name description 
instead of stringValue for dictionaryValue.

Modified Paths:
--------------
    trunk/bibdesk/BDSKCategoryGroup.m
    trunk/bibdesk/BibDocument_Groups.m

Modified: trunk/bibdesk/BDSKCategoryGroup.m
===================================================================
--- trunk/bibdesk/BDSKCategoryGroup.m   2021-07-22 17:02:56 UTC (rev 26456)
+++ trunk/bibdesk/BDSKCategoryGroup.m   2021-07-22 17:26:29 UTC (rev 26457)
@@ -81,7 +81,7 @@
 }
 
 - (NSDictionary *)dictionaryValue {
-    NSString *aName = [[self stringValue] stringByEscapingGroupPlistEntities];
+    NSString *aName = [[[self name] description] 
stringByEscapingGroupPlistEntities];
     NSString *aKey = [[self key] stringByEscapingGroupPlistEntities];
     return [NSDictionary dictionaryWithObjectsAndKeys:aName, @"group name", 
aKey, @"key", nil];
 }

Modified: trunk/bibdesk/BibDocument_Groups.m
===================================================================
--- trunk/bibdesk/BibDocument_Groups.m  2021-07-22 17:02:56 UTC (rev 26456)
+++ trunk/bibdesk/BibDocument_Groups.m  2021-07-22 17:26:29 UTC (rev 26457)
@@ -1604,7 +1604,7 @@
     NSArray *sortDescriptors = nil;
     
     if([sortGroupsKey isEqualToString:BDSKGroupCountKey]){
-        NSSortDescriptor *countSort = [[NSSortDescriptor alloc] 
initWithKey:@"numberValue" ascending:!docFlags.sortGroupsDescending 
selector:@selector(compare:)];
+        NSSortDescriptor *countSort = [[NSSortDescriptor alloc] 
initWithKey:@"count" ascending:!docFlags.sortGroupsDescending 
selector:@selector(compare:)];
         NSSortDescriptor *nameSort = [[NSSortDescriptor alloc] 
initWithKey:@"name" ascending:YES selector:@selector(sortCompare:)];
         sortDescriptors = [NSArray arrayWithObjects:countSort, nameSort, nil];
         [countSort release];
@@ -1627,10 +1627,7 @@
         } else {
             // change key
             // save new sorting selector, and re-sort the array.
-            if ([key isEqualToString:BDSKGroupStringValueKey])
-                docFlags.sortGroupsDescending = NO;
-            else
-                docFlags.sortGroupsDescending = YES; // more appropriate for 
default count sort
+            docFlags.sortGroupsDescending = [key 
isEqualToString:BDSKGroupCountKey]; // more appropriate for default count sort
             [sortGroupsKey release];
             sortGroupsKey = [key retain];
         }

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



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to