Revision: 6845
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6845&view=rev
Author:   hofman
Date:     2010-09-24 14:05:39 +0000 (Fri, 24 Sep 2010)

Log Message:
-----------
set some document attributes in exported rich text from template

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

Modified: trunk/NSDocument_SKExtensions.m
===================================================================
--- trunk/NSDocument_SKExtensions.m     2010-09-24 12:42:15 UTC (rev 6844)
+++ trunk/NSDocument_SKExtensions.m     2010-09-24 14:05:39 UTC (rev 6845)
@@ -53,6 +53,8 @@
 
 NSString *SKDocumentErrorDomain = @"SKDocumentErrorDomain";
 
+#define SKDisableExportAttributesKey @"SKDisableExportAttributes"
+
 #define TEMPLATES_FOLDER_NAME @"Templates"
 
 @implementation NSDocument (SKExtensions)
@@ -168,6 +170,11 @@
         NSError *error = nil;
         NSAttributedString *templateAttrString = [[NSAttributedString alloc] 
initWithPath:templatePath documentAttributes:&docAttributes];
         NSAttributedString *attrString = [SKTemplateParser 
attributedStringByParsingTemplateAttributedString:templateAttrString 
usingObject:self];
+        if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKDisableExportAttributesKey] == NO) {
+            NSMutableDictionary *mutableAttributes = [[docAttributes 
mutableCopy] autorelease];
+            [mutableAttributes addEntriesFromDictionary:[NSDictionary 
dictionaryWithObjectsAndKeys:NSFullUserName(), NSAuthorDocumentAttribute, 
[NSDate date], NSCreationTimeDocumentAttribute, [[[[self fileURL] path] 
lastPathComponent] stringByDeletingPathExtension], NSTitleDocumentAttribute, 
nil]];
+            docAttributes = mutableAttributes;
+        }
         data = [attrString dataFromRange:NSMakeRange(0, [attrString length]) 
documentAttributes:docAttributes error:&error];
         [templateAttrString release];
     } else {


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

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to