Revision: 29330
          http://sourceforge.net/p/bibdesk/svn/29330
Author:   hofman
Date:     2025-07-22 16:00:13 +0000 (Tue, 22 Jul 2025)
Log Message:
-----------
use action for cite key field in text import sheet

Modified Paths:
--------------
    trunk/bibdesk/BDSKTextImportController.h
    trunk/bibdesk/BDSKTextImportController.m
    trunk/bibdesk/Base.lproj/TextImport.xib

Modified: trunk/bibdesk/BDSKTextImportController.h
===================================================================
--- trunk/bibdesk/BDSKTextImportController.h    2025-07-22 15:54:48 UTC (rev 
29329)
+++ trunk/bibdesk/BDSKTextImportController.h    2025-07-22 16:00:13 UTC (rev 
29330)
@@ -138,6 +138,7 @@
 - (IBAction)openBookmark:(nullable id)sender;
 - (IBAction)stopOrReloadAction:(nullable id)sender;
 - (IBAction)addField:(nullable id)sender;
+- (IBAction)changeCiteKey:(nullable id)sender;
 - (IBAction)changeValue:(nullable id)sender;
 - (IBAction)editSelectedFieldAsRawBibTeX:(nullable id)sender;
 - (IBAction)generateCiteKey:(nullable id)sender;

Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m    2025-07-22 15:54:48 UTC (rev 
29329)
+++ trunk/bibdesk/BDSKTextImportController.m    2025-07-22 16:00:13 UTC (rev 
29330)
@@ -379,6 +379,16 @@
     }];
 }
 
+- (IBAction)changeCiteKey:(id)sender {
+    BibItem *item = [self publication];
+    NSString *newCiteKey = [sender stringValue];
+    if ([newCiteKey isEqualToString:[item citeKey]] == NO) {
+        [item setCiteKey:newCiteKey];
+        [[self undoManager] setActionName:NSLocalizedString(@"Edit Cite Key", 
@"Undo action name")];
+        [self setCiteKeyDuplicateWarning:[item isValidCiteKey:[item citeKey]] 
== NO];
+    }
+}
+
 - (IBAction)changeValue:(id)sender {
     NSInteger row = [itemTableView rowForView:sender];
     if (row == -1)
@@ -1158,18 +1168,8 @@
 }
 
 - (void)controlTextDidEndEditing:(NSNotification *)notification {
-    NSControl *control = [notification object];
-    if ([control isEqual:citeKeyField]) {
-        BibItem *item = [self publication];
-        NSString *newCiteKey = [control stringValue];
-        if ([newCiteKey isEqualToString:[item citeKey]] == NO) {
-            [item setCiteKey:newCiteKey];
-            [[self undoManager] setActionName:NSLocalizedString(@"Edit Cite 
Key", @"Undo action name")];
-            [self setCiteKeyDuplicateWarning:[item isValidCiteKey:[item 
citeKey]] == NO];
-        }
-    } else if ([itemTableView rowForView:control] != -1) {
+    if ([itemTableView rowForView:[notification object]] != -1)
                [tableCellFormatter setEditAsComplexString:NO];
-       }
 }
 
 - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView 
doCommandBySelector:(SEL)commandSelector {

Modified: trunk/bibdesk/Base.lproj/TextImport.xib
===================================================================
--- trunk/bibdesk/Base.lproj/TextImport.xib     2025-07-22 15:54:48 UTC (rev 
29329)
+++ trunk/bibdesk/Base.lproj/TextImport.xib     2025-07-22 16:00:13 UTC (rev 
29330)
@@ -325,6 +325,7 @@
                                         </textFieldCell>
                                         <connections>
                                             <accessibilityConnection 
property="title" destination="240" id="252"/>
+                                            <action selector="changeCiteKey:" 
target="-2" id="Bgr-P1-1eb"/>
                                             <outlet property="delegate" 
destination="-2" id="245"/>
                                         </connections>
                                     </textField>

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