Revision: 4547
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4547&view=rev
Author:   hofman
Date:     2008-09-04 13:49:06 +0000 (Thu, 04 Sep 2008)

Log Message:
-----------
Make setting file update flags a bit more readable.

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

Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m       2008-09-04 13:36:03 UTC (rev 4546)
+++ trunk/SKPDFDocument.m       2008-09-04 13:49:06 UTC (rev 4547)
@@ -1224,8 +1224,6 @@
     if (returnCode == NSAlertOtherReturn) {
         autoUpdate = NO;
         disableAutoReload = YES;
-        receivedFileUpdateNotification = NO;
-        isUpdatingFile = NO;
     } else {
         NSError *error = nil;
         
@@ -1238,10 +1236,11 @@
         if (returnCode == NSAlertAlternateReturn)
             autoUpdate = YES;
         disableAutoReload = NO;
-        isUpdatingFile = NO;
         if (receivedFileUpdateNotification)
             [self performSelector:@selector(fileUpdated) withObject:nil 
afterDelay:0.0];
     }
+    isUpdatingFile = NO;
+    receivedFileUpdateNotification = NO;
 }
 
 - (BOOL)canUpdateFromFile:(NSString *)fileName {
@@ -1278,21 +1277,18 @@
 }
 
 - (void)fileUpdated {
-    receivedFileUpdateNotification = NO;
-    isUpdatingFile = NO;
-    
     NSString *fileName = [self fileName];
     
     if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKAutoCheckFileUpdateKey] &&
         [[NSFileManager defaultManager] fileExistsAtPath:fileName]) {
         
-        isUpdatingFile = YES;
-        
         fileChangedOnDisk = YES;
         
+        isUpdatingFile = YES;
+        receivedFileUpdateNotification = NO;
+        
         // check for attached sheet, since reloading the document while an 
alert is up looks a bit strange
         if ([[self windowForSheet] attachedSheet]) {
-            receivedFileUpdateNotification = YES;
             [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handleWindowDidEndSheetNotification:) 
                                                          
name:NSWindowDidEndSheetNotification object:[self windowForSheet]];
         } else if ([self canUpdateFromFile:fileName]) {
@@ -1321,6 +1317,9 @@
             isUpdatingFile = NO;
             receivedFileUpdateNotification = NO;
         }
+    } else {
+        isUpdatingFile = NO;
+        receivedFileUpdateNotification = NO;
     }
 }
 
@@ -1365,10 +1364,7 @@
     // This is only called to delay a file update handling
     [[NSNotificationCenter defaultCenter] removeObserver:self 
name:NSWindowDidEndSheetNotification object:[notification object]];
     // Make sure we finish the sheet event first. E.g. the documentEdited 
status may need to be updated.
-    if (receivedFileUpdateNotification)
-        [self performSelector:@selector(fileUpdated) withObject:nil 
afterDelay:0.0];
-    else
-        isUpdatingFile = NO;
+    [self performSelector:@selector(fileUpdated) withObject:nil 
afterDelay:0.0];
 }
 
 #pragma mark Notification observation


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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to