Revision: 18445
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18445&view=rev
Author:   hofman
Date:     2012-01-28 11:24:19 +0000 (Sat, 28 Jan 2012)
Log Message:
-----------
Don't allow filing linked files from text import sheet, as linked files are not 
shown and the owner/document is messed up, messing up undo etc.

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

Modified: trunk/bibdesk/BDSKTextImportController.h
===================================================================
--- trunk/bibdesk/BDSKTextImportController.h    2012-01-28 07:35:35 UTC (rev 
18444)
+++ trunk/bibdesk/BDSKTextImportController.h    2012-01-28 11:24:19 UTC (rev 
18445)
@@ -118,7 +118,6 @@
 - (IBAction)editSelectedFieldAsRawBibTeX:(id)sender;
 - (IBAction)generateCiteKey:(id)sender;
 - (IBAction)showCiteKeyWarning:(id)sender;
-- (IBAction)consolidateLinkedFiles:(id)sender;
 
 - (void)copyLocationAsRemoteUrl:(id)sender;
 - (void)copyLinkedLocationAsRemoteUrl:(id)sender;

Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m    2012-01-28 07:35:35 UTC (rev 
18444)
+++ trunk/bibdesk/BDSKTextImportController.m    2012-01-28 11:24:19 UTC (rev 
18445)
@@ -98,7 +98,6 @@
 
 - (BOOL)addCurrentSelectionToFieldAtIndex:(NSUInteger)index;
 - (void)recordChangingField:(NSString *)fieldName toValue:(NSString *)value;
-- (BOOL)autoFileLinkedFile:(BDSKLinkedFile *)file;
 
 - (BOOL)editSelectedCellAsMacro;
 - (void)autoDiscoverDataFromFrame:(WebFrame *)frame;
@@ -405,64 +404,6 @@
     [alert beginSheetModalForWindow:[self window] modalDelegate:nil 
didEndSelector:NULL contextInfo:NULL];
 }
 
-- (void)consolidateAlertDidEnd:(NSAlert *)alert 
returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo {
-    NSArray *files = nil;
-    
-    if (returnCode == NSAlertAlternateReturn){
-        return;
-    }else if(returnCode == NSAlertOtherReturn){
-        files = [NSMutableArray array];
-        
-        for (BDSKLinkedFile *file in [item localFiles]){
-            if([item canSetURLForLinkedFile:file] == NO)
-                [item addFileToBeFiled:file];
-            else
-                [(NSMutableArray *)files addObject:file];
-        }
-    }else{
-        files = [item localFiles];
-    }
-    
-    if ([files count] == 0)
-        return;
-    
-    if ([[BDSKFiler sharedFiler] autoFileLinkedFiles:files 
fromDocument:document check:NO])
-        [[self undoManager] setActionName:NSLocalizedString(@"Move File", 
@"Undo action name")];
-}
-
-- (IBAction)consolidateLinkedFiles:(id)sender{
-    // make the tableview stop editing:
-    [self finalizeChangesPreservingSelection:YES];
-       BOOL canSet = YES;
-    
-    for (BDSKLinkedFile *file in [item localFiles]) {
-        if ([item canSetURLForLinkedFile:file] == NO) {
-            canSet = NO;
-            break;
-        }
-    }
-    
-       if (canSet == NO){
-               NSString *message = NSLocalizedString(@"Not all fields needed 
for generating the file location are set.  Do you want me to file the paper now 
using the available fields, or cancel autofile for this paper?", @"Informative 
text in alert");
-               NSString *otherButton = nil;
-               if([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKFilePapersAutomaticallyKey]){
-                       message = NSLocalizedString(@"Not all fields needed for 
generating the file location are set. Do you want me to file the paper now 
using the available fields, cancel autofile for this paper, or wait until the 
necessary fields are set?", @"Informative text in alert dialog"),
-                       otherButton = NSLocalizedString(@"Wait", @"Button 
title");
-               }
-        NSAlert *alert = [NSAlert 
alertWithMessageText:NSLocalizedString(@"Warning", @"Message in alert dialog") 
-                                         
defaultButton:NSLocalizedString(@"File Now", @"Button title")
-                                       
alternateButton:NSLocalizedString(@"Cancel", @"Button title")
-                                           otherButton:otherButton
-                             informativeTextWithFormat:message];
-        [alert beginSheetModalForWindow:[self window]
-                          modalDelegate:self
-                         
didEndSelector:@selector(consolidateAlertDidEnd:returnCode:contextInfo:) 
-                            contextInfo:NULL];
-       } else {
-        [self consolidateAlertDidEnd:nil returnCode:NSAlertDefaultReturn 
contextInfo:NULL];
-    }
-}
-
 #pragma mark WebView contextual menu actions
 
 - (void)copyLocationAsRemoteUrl:(id)sender{
@@ -897,9 +838,6 @@
                // need to set the title, as the document can change it in the 
main menu
                [menuItem setTitle: NSLocalizedString(@"Generate Cite Key", 
@"Menu item title")];
                return YES;
-       } else if ([menuItem action] == @selector(consolidateLinkedFiles:)) {
-               [menuItem setTitle: NSLocalizedString(@"AutoFile Linked File", 
@"Menu item title")];
-        return [[item localFiles] count] > 0;
        }
        return YES;
 }
@@ -1220,22 +1158,6 @@
     [itemTableView reloadData];
 }
 
-// we don't use the one from the item befcause it doesn't know about the 
document yet
-- (BOOL)autoFileLinkedFile:(BDSKLinkedFile *)file
-{
-    // we can't autofile if it's disabled or there is nothing to file
-       if ([[NSUserDefaults standardUserDefaults] 
boolForKey:BDSKFilePapersAutomaticallyKey] == NO || [file URL] == nil)
-               return NO;
-       
-       if ([item canSetURLForLinkedFile:file]) {
-        [[BDSKFiler sharedFiler] autoFileLinkedFiles:[NSArray 
arrayWithObject:file] fromDocument:document check:NO]; 
-        return YES;
-       } else {
-               [item addFileToBeFiled:file];
-       }
-       return NO;
-}
-
 #pragma mark Cite key duplicate warning
 
 - (void)setCiteKeyDuplicateWarning:(BOOL)set{

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