Revision: 7093
http://skim-app.svn.sourceforge.net/skim-app/?rev=7093&view=rev
Author: hofman
Date: 2011-02-10 16:13:06 +0000 (Thu, 10 Feb 2011)
Log Message:
-----------
use pdf filename as displayname for notes document shown through service
Modified Paths:
--------------
trunk/SKDocumentController.m
trunk/SKNotesDocument.h
trunk/SKNotesDocument.m
Modified: trunk/SKDocumentController.m
===================================================================
--- trunk/SKDocumentController.m 2011-02-10 13:05:02 UTC (rev 7092)
+++ trunk/SKDocumentController.m 2011-02-10 16:13:06 UTC (rev 7093)
@@ -294,6 +294,7 @@
if ([document readFromData:data ofType:SKNotesDocumentType
error:&error]) {
[self addDocument:document];
+ [document setSourceFileURL:theURL];
[document makeWindowControllers];
[document showWindows];
} else {
Modified: trunk/SKNotesDocument.h
===================================================================
--- trunk/SKNotesDocument.h 2011-02-10 13:05:02 UTC (rev 7092)
+++ trunk/SKNotesDocument.h 2011-02-10 16:13:06 UTC (rev 7093)
@@ -51,6 +51,7 @@
NSDictionary *toolbarItems;
NSArray *notes;
PDFDocument *pdfDocument;
+ NSURL *sourceFileURL;
SKFloatMapTable *rowHeights;
SKNoteTypeSheetController *noteTypeSheetController;
NSRect windowRect;
@@ -63,6 +64,7 @@
@property (nonatomic, retain) IBOutlet NSSearchField *searchField;
@property (nonatomic, readonly) NSArray *notes;
@property (nonatomic, readonly) PDFDocument *pdfDocument;
+@property (nonatomic, retain) NSURL *sourceFileURL;
- (IBAction)openPDF:(id)sender;
- (IBAction)searchNotes:(id)sender;
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2011-02-10 13:05:02 UTC (rev 7092)
+++ trunk/SKNotesDocument.m 2011-02-10 16:13:06 UTC (rev 7093)
@@ -86,7 +86,7 @@
@implementation SKNotesDocument
-@synthesize outlineView, arrayController, searchField, notes, pdfDocument;
+@synthesize outlineView, arrayController, searchField, notes, pdfDocument,
sourceFileURL;
- (id)init {
if (self = [super init]) {
@@ -104,6 +104,7 @@
[outlineView setDataSource:nil];
SKDESTROY(notes);
SKDESTROY(pdfDocument);
+ SKDESTROY(sourceFileURL);
SKDESTROY(rowHeights);
SKDESTROY(toolbarItems);
SKDESTROY(statusBar);
@@ -353,6 +354,18 @@
}
}
+- (void)setFileURL:(NSURL *)absoluteURL {
+ if (absoluteURL)
+ [self setSourceFileURL:nil];
+ [super setFileURL:absoluteURL];
+}
+
+- (NSString *)displayName {
+ if (sourceFileURL)
+ return [[[NSFileManager defaultManager]
displayNameAtPath:[sourceFileURL path]] stringByDeletingPathExtension];
+ return [super displayName];
+}
+
#pragma mark Printing
- (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)printSettings
error:(NSError **)outError {
@@ -385,7 +398,7 @@
#pragma mark Actions
- (IBAction)openPDF:(id)sender {
- NSString *path = [[self fileURL] pathReplacingPathExtension:@"pdf"];
+ NSString *path = [sourceFileURL path] ?: [[self fileURL]
pathReplacingPathExtension:@"pdf"];
NSError *error = nil;
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
// resolve symlinks and aliases
@@ -757,7 +770,7 @@
if ([[[[[self windowControllers] objectAtIndex:0] window] toolbar]
customizationPaletteIsRunning])
return NO;
else if ([[toolbarItem itemIdentifier]
isEqualToString:SKNotesDocumentOpenPDFToolbarItemIdentifier])
- return [[NSFileManager defaultManager] fileExistsAtPath:[[self
fileURL] pathReplacingPathExtension:@"pdf"]];
+ return [[NSFileManager defaultManager] fileExistsAtPath:[sourceFileURL
path] ?: [[self fileURL] pathReplacingPathExtension:@"pdf"]];
return YES;
}
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit