Revision: 7214
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7214&view=rev
Author:   hofman
Date:     2011-04-21 10:17:28 +0000 (Thu, 21 Apr 2011)

Log Message:
-----------
do revert when file mod date has changed on disk

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

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2011-04-15 12:07:49 UTC (rev 7213)
+++ trunk/SKMainDocument.m      2011-04-21 10:17:28 UTC (rev 7214)
@@ -1270,10 +1270,11 @@
 }
 
 - (void)revertDocumentToSaved:(id)sender {      
-     if ([self fileURL]) {      
-         if ([self isDocumentEdited]) {         
+     if ([self fileURL]) {
+         if ([self isDocumentEdited]) {
              [super revertDocumentToSaved:sender];      
-         } else if ([fileUpdateChecker fileChangedOnDisk]) {    
+         } else if ([fileUpdateChecker fileChangedOnDisk] || 
+                    NSOrderedAscending == [[self fileModificationDate] 
compare:[[[NSFileManager defaultManager] attributesOfItemAtPath:[[self fileURL] 
path] error:NULL] fileModificationDate]]) {
              NSAlert *alert = [NSAlert alertWithMessageText:[NSString 
stringWithFormat:NSLocalizedString(@"Do you want to revert to the version of 
the document \"%@\" on disk?", @"Message in alert dialog"), [[[self fileURL] 
path] lastPathComponent]]       
                                               
defaultButton:NSLocalizedString(@"Revert", @"Button title")       
                                             
alternateButton:NSLocalizedString(@"Cancel", @"Button title")       
@@ -1283,9 +1284,9 @@
                                modalDelegate:self       
                               
didEndSelector:@selector(revertAlertDidEnd:returnCode:contextInfo:)       
                                  contextInfo:NULL];     
-         }      
-     }          
- }
+        }
+    }
+}
 
 - (void)performFindPanelAction:(id)sender {
     [[SKFindController sharedFindController] performFindPanelAction:sender];
@@ -1298,7 +1299,8 @@
         NSString *fileName = [[self fileURL] path];
         if (fileName == nil || [[NSFileManager defaultManager] 
fileExistsAtPath:fileName] == NO)
             return NO;
-        return [self isDocumentEdited] || [fileUpdateChecker 
fileChangedOnDisk];
+        return [self isDocumentEdited] || [fileUpdateChecker 
fileChangedOnDisk] ||
+               NSOrderedAscending == [[self fileModificationDate] 
compare:[[[NSFileManager defaultManager] attributesOfItemAtPath:[[self fileURL] 
path] error:NULL] fileModificationDate]];
     } else if ([anItem action] == @selector(printDocument:)) {
         return [[self pdfDocument] allowsPrinting];
     } else if ([anItem action] == @selector(convertNotes:)) {


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

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to