Revision: 2749
http://skim-app.svn.sourceforge.net/skim-app/?rev=2749&view=rev
Author: hofman
Date: 2007-08-28 10:36:36 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Importer reads pdf bundle.
Modified Paths:
--------------
trunk/SkimImporter/GetMetadataForFile.m
trunk/SkimImporter/Info.plist
Modified: trunk/SkimImporter/GetMetadataForFile.m
===================================================================
--- trunk/SkimImporter/GetMetadataForFile.m 2007-08-28 17:12:56 UTC (rev
2748)
+++ trunk/SkimImporter/GetMetadataForFile.m 2007-08-28 17:36:36 UTC (rev
2749)
@@ -99,6 +99,51 @@
[(NSMutableDictionary *)attributes setObject:date forKey:(NSString
*)kMDItemContentCreationDate];
success = TRUE;
+ } else if (UTTypeEqual(contentTypeUTI,
CFSTR("net.sourceforge.skim-app.pdfd"))) {
+ NSData *data = [[NSData alloc] initWithContentsOfFile:[(NSString
*)pathToFile stringByAppendingPathComponent:@"data.skim"]
options:NSUncachedRead error:NULL];
+ if (data) {
+ NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
+ [data release];
+
+ if (array) {
+ NSEnumerator *noteEnum = [array objectEnumerator];
+ NSDictionary *note;
+ NSMutableString *textContent = [[NSMutableString alloc] init];
+ NSMutableArray *notes = [[NSMutableArray alloc] init];
+ while (note = [noteEnum nextObject]) {
+ NSString *contents = [note objectForKey:@"contents"];
+ if (contents) {
+ if ([textContent length])
+ [textContent appendString:@"\n\n"];
+ [textContent appendString:contents];
+ [notes addObject:contents];
+ }
+ NSString *text = [[note objectForKey:@"text"] string];
+ if (text) {
+ if ([textContent length])
+ [textContent appendString:@"\n\n"];
+ [textContent appendString:text];
+ }
+ }
+ [(NSMutableDictionary *)attributes setObject:textContent
forKey:(NSString *)kMDItemTextContent];
+ [(NSMutableDictionary *)attributes setObject:notes
forKey:@"net_sourceforge_skim_app_notes"];
+ [textContent release];
+ [notes release];
+ }
+ }
+
+ [(NSMutableDictionary *)attributes setObject:@"Skim" forKey:(NSString
*)kMDItemCreator];
+
+ [(NSMutableDictionary *)attributes setObject:[NSArray
arrayWithObjects:(NSString *)pathToFile, nil] forKey:(NSString
*)kMDItemWhereFroms];
+
+ NSDictionary *fileAttributes = [[NSFileManager defaultManager]
fileAttributesAtPath:(NSString *)pathToFile traverseLink:YES];
+ NSDate *date;
+ if (date = [fileAttributes objectForKey:NSFileModificationDate])
+ [(NSMutableDictionary *)attributes setObject:date forKey:(NSString
*)kMDItemContentModificationDate];
+ if (date = [fileAttributes objectForKey:NSFileCreationDate])
+ [(NSMutableDictionary *)attributes setObject:date forKey:(NSString
*)kMDItemContentCreationDate];
+
+ success = TRUE;
} else {
NSLog(@"Importer asked to handle unknown UTI %@ at path",
contentTypeUTI, pathToFile);
}
Modified: trunk/SkimImporter/Info.plist
===================================================================
--- trunk/SkimImporter/Info.plist 2007-08-28 17:12:56 UTC (rev 2748)
+++ trunk/SkimImporter/Info.plist 2007-08-28 17:36:36 UTC (rev 2749)
@@ -11,6 +11,14 @@
<string>MDImporter</string>
<key>LSItemContentTypes</key>
<array>
+ <string>net.sourceforge.skim-app.pdfd</string>
+ </array>
+ </dict>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>MDImporter</string>
+ <key>LSItemContentTypes</key>
+ <array>
<string>net.sourceforge.skim-app.skimnotes</string>
</array>
</dict>
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: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit