Revision: 18450
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18450&view=rev
Author:   hofman
Date:     2012-01-29 13:07:29 +0000 (Sun, 29 Jan 2012)
Log Message:
-----------
Use callback for text import sheet to reset didImport flag, so we can properly 
collect all items added in the last import group

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

Modified: trunk/bibdesk/BDSKTextImportController.h
===================================================================
--- trunk/bibdesk/BDSKTextImportController.h    2012-01-29 12:49:51 UTC (rev 
18449)
+++ trunk/bibdesk/BDSKTextImportController.h    2012-01-29 13:07:29 UTC (rev 
18450)
@@ -100,7 +100,7 @@
 
 - (id)initWithDocument:(BibDocument *)doc;
 
-- (void)beginSheetForURL:(NSURL *)aURL modalForWindow:(NSWindow *)aWindow;
+- (void)beginSheetForURL:(NSURL *)aURL modalForWindow:(NSWindow *)aWindow 
modalDelegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void 
*)contextInfo;
 
 - (IBAction)addItemAction:(id)sender;
 - (IBAction)closeAction:(id)sender;

Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m    2012-01-29 12:49:51 UTC (rev 
18449)
+++ trunk/bibdesk/BDSKTextImportController.m    2012-01-29 13:07:29 UTC (rev 
18450)
@@ -193,7 +193,7 @@
 
 #pragma mark Calling the main sheet
 
-- (void)beginSheetForURL:(NSURL *)aURL modalForWindow:(NSWindow *)aWindow {
+- (void)beginSheetForURL:(NSURL *)aURL modalForWindow:(NSWindow *)aWindow 
modalDelegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void 
*)contextInfo {
     // make sure we loaded the nib
     [self window];
     if (aURL == nil) {
@@ -204,7 +204,7 @@
                [self setShowingWebView:YES];
         [webView setURL:aURL];
     }
-    [self beginSheetModalForWindow:aWindow];
+    [self beginSheetModalForWindow:aWindow modalDelegate:delegate 
didEndSelector:didEndSelector contextInfo:contextInfo];
 }
 
 #pragma mark Actions

Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2012-01-29 12:49:51 UTC (rev 18449)
+++ trunk/bibdesk/BibDocument_Actions.m 2012-01-29 13:07:29 UTC (rev 18450)
@@ -1429,6 +1429,10 @@
 
 #pragma mark Text import sheet support
 
+- (void)importSheetDidEnd:(BDSKTextImportController *)controller 
returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo{
+    docFlags.didImport = NO;
+}
+
 - (IBAction)importFromPasteboardAction:(id)sender{
     
     NSPasteboard *pasteboard = [NSPasteboard 
pasteboardWithName:NSGeneralPboard];
@@ -1447,8 +1451,14 @@
             return; // it worked, so we're done here
     }
     
+    docFlags.didImport = NO;
+    
     BDSKTextImportController *tic = [[(BDSKTextImportController 
*)[BDSKTextImportController alloc] initWithDocument:self] autorelease];
-    [tic beginSheetForURL:nil modalForWindow:documentWindow];
+    [tic beginSheetForURL:nil
+           modalForWindow:documentWindow 
+            modalDelegate:self 
+           didEndSelector:@selector(importSheetDidEnd:returnCode:contextInfo:) 
+              contextInfo:NULL];
 }
 
 - (void)importOpenPanelDidEnd:(NSOpenPanel *)sheet 
returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo{
@@ -1464,8 +1474,14 @@
         } else {
             [sheet orderOut:nil];
             
+            docFlags.didImport = NO;
+            
             BDSKTextImportController *tic = [[(BDSKTextImportController 
*)[BDSKTextImportController alloc] initWithDocument:self] autorelease];
-            [tic beginSheetForURL:[NSURL fileURLWithPath:fileName] 
modalForWindow:documentWindow];
+            [tic beginSheetForURL:[NSURL fileURLWithPath:fileName] 
+                   modalForWindow:documentWindow 
+                    modalDelegate:self 
+                   
didEndSelector:@selector(importSheetDidEnd:returnCode:contextInfo:) 
+                      contextInfo:NULL];
         }
     }
 }
@@ -1494,8 +1510,14 @@
             return;
         }
         
+        docFlags.didImport = NO;
+        
         BDSKTextImportController *tic = [[(BDSKTextImportController 
*)[BDSKTextImportController alloc] initWithDocument:self] autorelease];
-        [tic beginSheetForURL:url modalForWindow:documentWindow];
+        [tic beginSheetForURL:url 
+               modalForWindow:documentWindow 
+                modalDelegate:self 
+               
didEndSelector:@selector(importSheetDidEnd:returnCode:contextInfo:) 
+                  contextInfo:NULL];
     }
 }
 

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