Revision: 17932
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=17932&view=rev
Author:   hofman
Date:     2011-06-03 17:31:27 +0000 (Fri, 03 Jun 2011)

Log Message:
-----------
Do select duplicates and type select always by the main sort key and not by 
useless Import Order or Relevance keys.

Modified Paths:
--------------
    trunk/bibdesk/BibDocument_Actions.m
    trunk/bibdesk/BibDocument_DataSource.m
    trunk/bibdesk/BibDocument_Menus.m

Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2011-06-03 17:24:17 UTC (rev 17931)
+++ trunk/bibdesk/BibDocument_Actions.m 2011-06-03 17:31:27 UTC (rev 17932)
@@ -1701,18 +1701,17 @@
     
     CFIndex idx = [shownPublications count];
     id object1 = nil, object2 = nil;
-    NSString *key = tmpSortKey ?: sortKey;
     
-    BDSKASSERT(key);
+    BDSKASSERT(sortKey);
     
     NSMutableIndexSet *rowsToSelect = [NSMutableIndexSet indexSet];
     CFIndex countOfItems = 0;
-    BOOL isURL = [key isGeneralURLField];
+    BOOL isURL = [sortKey isGeneralURLField];
     
     // Compare objects in the currently sorted table column using the isEqual: 
method to test adjacent cells in order to check for duplicates based on a 
specific sort key.  BibTool does this, but its effectiveness is obviously 
limited by the key used 
<http://lml.ls.fi.upm.es/manuales/bibtool/m_2_11_1.html>.
     while(idx--){
         object1 = object2;
-        object2 = isURL ? [[shownPublications objectAtIndex:idx] 
valueOfField:key] : [[shownPublications objectAtIndex:idx] 
displayValueOfField:key];
+        object2 = isURL ? [[shownPublications objectAtIndex:idx] 
valueOfField:sortKey] : [[shownPublications objectAtIndex:idx] 
displayValueOfField:sortKey];
         if([object1 isEqual:object2]){
             [rowsToSelect addIndexesInRange:NSMakeRange(idx, 2)];
             countOfItems++;

Modified: trunk/bibdesk/BibDocument_DataSource.m
===================================================================
--- trunk/bibdesk/BibDocument_DataSource.m      2011-06-03 17:24:17 UTC (rev 
17931)
+++ trunk/bibdesk/BibDocument_DataSource.m      2011-06-03 17:31:27 UTC (rev 
17932)
@@ -809,14 +809,14 @@
     if(searchString == nil || (sortKey == nil && tmpSortKey == nil))
         [self updateStatus]; // resets the status line to its default value
     else if([tv isEqual:tableView]) 
-        [self setStatus:[NSString stringWithFormat:NSLocalizedString(@"Finding 
item with %@: \"%@\"", @"Status message:Finding item with [sorting field]: 
\"[search string]\""), [(tmpSortKey ?: sortKey) localizedFieldName], 
searchString]];
+        [self setStatus:[NSString stringWithFormat:NSLocalizedString(@"Finding 
item with %@: \"%@\"", @"Status message:Finding item with [sorting field]: 
\"[search string]\""), [sortKey localizedFieldName], searchString]];
 }
 
 - (void)tableView:(NSTableView *)tv typeSelectHelper:(BDSKTypeSelectHelper 
*)typeSelectHelper didFailToFindMatchForSearchString:(NSString *)searchString{
     if(sortKey == nil && tmpSortKey == nil)
         [self updateStatus]; // resets the status line to its default value
     else if([tv isEqual:tableView]) 
-        [self setStatus:[NSString stringWithFormat:NSLocalizedString(@"No item 
with %@: \"%@\"", @"Status message:No item with [sorting field]: \"[search 
string]\""), [(tmpSortKey ?: sortKey) localizedFieldName], searchString]];
+        [self setStatus:[NSString stringWithFormat:NSLocalizedString(@"No item 
with %@: \"%@\"", @"Status message:No item with [sorting field]: \"[search 
string]\""), [sortKey localizedFieldName], searchString]];
 }
 
 // This is where we build the list of possible items which the user can select 
by typing the first few letters. You should return an array of NSStrings.
@@ -831,16 +831,15 @@
         
         NSUInteger i, count = [shownPublications count];
         NSMutableArray *a = [NSMutableArray arrayWithCapacity:count];
-        NSString *key = tmpSortKey ?: sortKey;
         
         // table datasource returns an NSImage for URL fields, so we'll ignore 
those columns
-        if(nil != key && [key isGeneralURLField] == NO){
+        if(nil != sortKey && [sortKey isGeneralURLField] == NO){
             BibItem *pub;
             id value;
             
             for (i = 0; i < count; i++){
                 pub = [shownPublications objectAtIndex:i];
-                value = [pub displayValueOfField:key];
+                value = [pub displayValueOfField:sortKey];
                 
                 // use @"" for nil values; ensure typeahead index matches 
shownPublications index
                 [a addObject:value ? [value description] : @""];

Modified: trunk/bibdesk/BibDocument_Menus.m
===================================================================
--- trunk/bibdesk/BibDocument_Menus.m   2011-06-03 17:24:17 UTC (rev 17931)
+++ trunk/bibdesk/BibDocument_Menus.m   2011-06-03 17:31:27 UTC (rev 17932)
@@ -422,7 +422,7 @@
 }
 
 - (BOOL) validateSelectPossibleDuplicatesMenuItem:(NSMenuItem *)menuItem{
-    [menuItem setTitle:[NSString stringWithFormat:NSLocalizedString(@"Select 
Duplicates by %@", @"Menu item title"), [(tmpSortKey ?: sortKey) 
localizedFieldName]]];
+    [menuItem setTitle:[NSString stringWithFormat:NSLocalizedString(@"Select 
Duplicates by %@", @"Menu item title"), [sortKey localizedFieldName]]];
     return ([self hasExternalGroupsSelected] == NO);
 }
 


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. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to