Revision: 5949
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5949&view=rev
Author:   hofman
Date:     2009-10-26 09:47:39 +0000 (Mon, 26 Oct 2009)

Log Message:
-----------
temporary unlock target file for saving EAs if needed

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

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2009-10-26 09:19:38 UTC (rev 5948)
+++ trunk/SKMainDocument.m      2009-10-26 09:47:39 UTC (rev 5949)
@@ -383,6 +383,18 @@
                 
             }
             
+            BOOL isLocked = NO;
+            FSRef fileRef;
+            FSCatalogInfo catalogInfo;
+            if (CFURLGetFSRef((CFURLRef)absoluteURL, &fileRef) &&
+                noErr == FSGetCatalogInfo(&fileRef, kFSCatInfoNodeFlags, 
&catalogInfo, NULL, NULL, NULL)) {
+                if (isLocked = (catalogInfo.nodeFlags & kFSNodeLockedMask) != 
0) {
+                    FSCatalogInfo unlockedCatalogInfo = catalogInfo;
+                    unlockedCatalogInfo.nodeFlags &= ~kFSNodeLockedMask;
+                    (void)FSSetCatalogInfo(&fileRef, kFSCatInfoNodeFlags, 
&unlockedCatalogInfo);
+                }
+            }
+            
             if (NO == [[NSFileManager defaultManager] writeSkimNotes:[[self 
notes] valueForKey:@"SkimNoteProperties"] textNotes:[self notesString] 
richTextNotes:[self notesRTFData] toExtendedAttributesAtURL:absoluteURL 
error:NULL]) {
                 NSString *message = saveNotesOK ? NSLocalizedString(@"The 
notes could not be saved with the PDF at \"%...@\". However a companion .skim 
file was successfully updated.", @"Informative text in alert dialog") :
                                                   NSLocalizedString(@"The 
notes could not be saved with the PDF at \"%...@\"", @"Informative text in 
alert dialog");
@@ -399,6 +411,9 @@
             if (options)
                 [[SKNExtendedAttributeManager sharedManager] 
setExtendedAttributeNamed:PRESENTATION_OPTIONS_KEY toPropertyListValue:options 
atPath:[absoluteURL path] options:kSKNXattrDefault error:NULL];
             
+            if (isLocked)
+                (void)FSSetCatalogInfo(&fileRef, kFSCatInfoNodeFlags, 
&catalogInfo);
+            
             [[NSDistributedNotificationCenter defaultCenter]
                 postNotificationName:SKSkimFileDidSaveNotification 
object:[absoluteURL path]];
         }


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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to