Revision: 2929
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2929&view=rev
Author:   hofman
Date:     2007-09-16 03:02:44 -0700 (Sun, 16 Sep 2007)

Log Message:
-----------
Show modal progress sheet while auto-reloading the document, so the user cannot 
interact with the document and cause a crash.

Modified Paths:
--------------
    trunk/SKDocument.m

Modified: trunk/SKDocument.m
===================================================================
--- trunk/SKDocument.m  2007-09-15 20:44:24 UTC (rev 2928)
+++ trunk/SKDocument.m  2007-09-16 10:02:44 UTC (rev 2929)
@@ -822,7 +822,6 @@
                 [progressBar setUsesThreadedAnimation:YES];
             } else {
                 NSLog(@"Failed to load ProgressSheet.nib");
-                return;
             }
         }
         
@@ -985,12 +984,32 @@
         autoUpdate = NO;
     } else {
         NSError *error = nil;
-        if (NO == [self revertToContentsOfURL:[self fileURL] ofType:[self 
fileType] error:&error]) {
-            if (autoUpdate == NO) {
-                [[alert window] orderOut:nil];
-                [self presentError:error modalForWindow:[self windowForSheet] 
delegate:nil didPresentSelector:NULL contextInfo:NULL];
+        BOOL success;
+        
+        [[alert window] orderOut:nil];
+        
+        if (progressSheet == nil) {
+            if ([NSBundle loadNibNamed:@"ProgressSheet" owner:self])  {
+                [progressBar setUsesThreadedAnimation:YES];
+            } else {
+                NSLog(@"Failed to load ProgressSheet.nib");
             }
         }
+        
+        [progressField setStringValue:[NSLocalizedString(@"Reloading 
document", @"Message for progress sheet") stringByAppendingEllipsis]];
+        [progressBar setIndeterminate:YES];
+        [progressBar startAnimation:self];
+        [NSApp beginSheet:progressSheet modalForWindow:[self windowForSheet] 
modalDelegate:nil didEndSelector:NULL contextInfo:NULL];
+        
+        success = [self revertToContentsOfURL:[self fileURL] ofType:[self 
fileType] error:&error];
+        
+        [progressBar stopAnimation:self];
+        [NSApp endSheet:progressSheet];
+        [progressSheet orderOut:self];
+        
+        if (success == NO && error)
+            [self presentError:error modalForWindow:[self windowForSheet] 
delegate:nil didPresentSelector:NULL contextInfo:NULL];
+        
         if (returnCode == NSAlertAlternateReturn)
             autoUpdate = YES;
     }


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to