Revision: 18449
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18449&view=rev
Author:   hofman
Date:     2012-01-29 12:49:51 +0000 (Sun, 29 Jan 2012)
Log Message:
-----------
use import method to add pups from text import controller

Modified Paths:
--------------
    trunk/bibdesk/BDSKTextImportController.m

Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m    2012-01-29 07:35:26 UTC (rev 
18448)
+++ trunk/bibdesk/BDSKTextImportController.m    2012-01-29 12:49:51 UTC (rev 
18449)
@@ -47,13 +47,13 @@
 #import "BDSKFieldNameFormatter.h"
 #import "BDSKEdgeView.h"
 #import "BibDocument.h"
+#import "BibDocument_Groups.h"
 #import "NSFileManager_BDSKExtensions.h"
 #import "BDSKAppController.h"
 #import "BDSKFieldEditor.h"
 #import "BDSKFieldSheetController.h"
 #import "BDSKMacroResolver.h"
 #import "NSImage_BDSKExtensions.h"
-#import "BDSKFiler.h"
 #import "BDSKStringParser.h"
 #import "NSArray_BDSKExtensions.h"
 #import "BDSKPublicationsArray.h"
@@ -212,6 +212,7 @@
 - (IBAction)addItemAction:(id)sender{
     NSInteger optKey = [NSEvent standardModifierFlags] & NSAlternateKeyMask;
     BibItem *newItem = (optKey) ? [item copy] : [[BibItem alloc] init];
+    NSArray *itemsToAdd = [NSArray arrayWithObjects:item, nil];
     
     // make the tableview stop editing:
     [self finalizeChangesPreservingSelection:NO];
@@ -219,24 +220,9 @@
        [itemsAdded addObject:item];
     [[self undoManager] removeAllActions];
     [item setOwner:nil];
-    [document addPublication:item];
+    [document addPublications:itemsToAdd publicationsToAutoFile:nil 
temporaryCiteKey:nil selectLibrary:NO edit:NO];
     
-    if ([item hasEmptyOrDefaultCiteKey])
-        [item setCiteKey:[item suggestedCiteKey]];
-    if([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKFilePapersAutomaticallyKey] && [[item filesToBeFiled] count]){
-        NSMutableArray *files = [NSMutableArray array];
-        
-        for (BDSKLinkedFile *file in [item filesToBeFiled]) {
-            if([item canSetURLForLinkedFile:file] == NO)
-                continue;
-            [files addObject:file];
-        }
-        if ([files count])
-            [[BDSKFiler sharedFiler] autoFileLinkedFiles:files 
fromDocument:document check:NO];
-    }
-    
     [item release];
-    
     item = newItem;
     [item setOwner:self];
        
@@ -261,8 +247,10 @@
     [self cancelDownload];
     [webView setDelegate:nil];
        // select the items we just added
-    if ([itemsAdded count] > 0)
+    if ([itemsAdded count] > 0) {
+        [document selectLibraryGroup:nil];
         [document selectPublications:itemsAdded];
+    }
        [itemsAdded removeAllObjects];
     
     [super dismiss:sender];

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


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to