Revision: 7092
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7092&view=rev
Author:   hofman
Date:     2011-02-10 13:05:02 +0000 (Thu, 10 Feb 2011)

Log Message:
-----------
just open .skim file from Show Skim Notes service

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

Modified: trunk/SKDocumentController.m
===================================================================
--- trunk/SKDocumentController.m        2011-02-09 19:21:11 UTC (rev 7091)
+++ trunk/SKDocumentController.m        2011-02-10 13:05:02 UTC (rev 7092)
@@ -48,6 +48,7 @@
 #import "SKMainWindowController.h"
 #import "NSError_SKExtensions.h"
 #import <SkimNotes/SkimNotes.h>
+#import "SKNotesDocument.h"
 
 #define SKAutosaveIntervalKey @"SKAutosaveInterval"
 
@@ -276,28 +277,30 @@
     if ([theURL isFileURL]) {
         NSError *error = nil;
         NSString *type = [self typeForContentsOfURL:theURL error:&error];
-        NSData *data = nil;
         
-        if ([type isEqualToString:SKPDFDocumentType] || [type 
isEqualToString:SKPostScriptDocumentType] || [type 
isEqualToString:SKDVIDocumentType] || [type isEqualToString:SKXDVDocumentType]) 
{
-            data = [[SKNExtendedAttributeManager sharedManager] 
extendedAttributeNamed:SKIM_NOTES_KEY atPath:[theURL path] traverseLink:YES 
error:&error];
-        } else if ([type isEqualToString:SKPDFBundleDocumentType]) {
-            NSString *skimFile = [[NSFileManager defaultManager] 
bundledFileWithExtension:@"skim" inPDFBundleAtPath:[theURL path] error:&error];
-            data = skimFile ? [NSData dataWithContentsOfFile:skimFile 
options:0 error:&error] : nil;
-        } else if ([type isEqualToString:SKNotesDocumentType]) {
-            data = [NSData dataWithContentsOfURL:theURL options:0 
error:&error];
-        }
-        
-        if (data)
-            document = [self makeUntitledDocumentOfType:SKNotesDocumentType 
error:&error];
-        
-        if ([document readFromData:data ofType:SKNotesDocumentType 
error:&error]) {
-            [self addDocument:document];
-            [document makeWindowControllers];
-            [document showWindows];
+        if ([[SKNotesDocument readableTypes] containsObject:type]) {
+            document = [self openDocumentWithContentsOfURL:theURL display:YES 
error:outError];
         } else {
-            document = nil;
-            if (outError)
-                *outError = error;
+            NSData *data = nil;
+            if ([type isEqualToString:SKPDFBundleDocumentType]) {
+                NSString *skimFile = [[NSFileManager defaultManager] 
bundledFileWithExtension:@"skim" inPDFBundleAtPath:[theURL path] error:&error];
+                data = skimFile ? [NSData dataWithContentsOfFile:skimFile 
options:0 error:&error] : nil;
+            } else if ([[SKMainDocument readableTypes] containsObject:type]) {
+                data = [[SKNExtendedAttributeManager sharedManager] 
extendedAttributeNamed:SKIM_NOTES_KEY atPath:[theURL path] traverseLink:YES 
error:&error];
+            }
+            
+            if (data)
+                document = [self 
makeUntitledDocumentOfType:SKNotesDocumentType error:&error];
+            
+            if ([document readFromData:data ofType:SKNotesDocumentType 
error:&error]) {
+                [self addDocument:document];
+                [document makeWindowControllers];
+                [document showWindows];
+            } else {
+                document = nil;
+                if (outError)
+                    *outError = error;
+            }
         }
     } else if (outError) {
         *outError = [NSError 
readPasteboardErrorWithLocalizedDescription:NSLocalizedString(@"Unable to load 
data from clipboard", @"Error description")];


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

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to