Revision: 7026
http://skim-app.svn.sourceforge.net/skim-app/?rev=7026&view=rev
Author: hofman
Date: 2010-12-30 23:14:56 +0000 (Thu, 30 Dec 2010)
Log Message:
-----------
open URL links we can handle ourselves rather than passing them on to
NSWorkspace
Modified Paths:
--------------
trunk/SKMainWindowController_UI.m
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2010-12-30 18:52:38 UTC (rev 7025)
+++ trunk/SKMainWindowController_UI.m 2010-12-30 23:14:56 UTC (rev 7026)
@@ -1144,14 +1144,17 @@
NSURL *fileURL = [action URL];
NSError *error = nil;
SKDocumentController *sdc = [NSDocumentController
sharedDocumentController];
+ Class docClass = [sdc documentClassForContentsOfURL:fileURL];
id document = nil;
- if ([[sdc documentClassForContentsOfURL:fileURL] isPDFDocument]) {
+ if (docClass) {
if (document = [sdc openDocumentWithContentsOfURL:fileURL display:YES
error:&error]) {
- NSUInteger pageIndex = [action pageIndex];
- if (pageIndex < [[document pdfDocument] pageCount]) {
- PDFPage *page = [[document pdfDocument] pageAtIndex:pageIndex];
- PDFDestination *dest = [[[PDFDestination alloc]
initWithPage:page atPoint:[action point]] autorelease];
- [[document pdfView] goToDestination:dest];
+ if ([docClass isPDFDocument]) {
+ NSUInteger pageIndex = [action pageIndex];
+ if (pageIndex < [[document pdfDocument] pageCount]) {
+ PDFPage *page = [[document pdfDocument]
pageAtIndex:pageIndex];
+ PDFDestination *dest = [[[PDFDestination alloc]
initWithPage:page atPoint:[action point]] autorelease];
+ [[document pdfView] goToDestination:dest];
+ }
}
} else if (error && ([[error domain]
isEqualToString:NSCocoaErrorDomain] == NO || [error code] !=
NSUserCancelledError)) {
[NSApp presentError:error];
@@ -1162,6 +1165,19 @@
}
}
+- (void)PDFViewWillClickOnLink:(PDFView *)sender withURL:(NSURL *)url {
+ NSError *error = nil;
+ SKDocumentController *sdc = [NSDocumentController
sharedDocumentController];
+ id document = nil;
+ if ([sdc documentClassForContentsOfURL:url]) {
+ document = [sdc openDocumentWithContentsOfURL:url display:YES
error:&error];
+ if (document == nil && error && ([[error domain]
isEqualToString:NSCocoaErrorDomain] == NO || [error code] !=
NSUserCancelledError))
+ [NSApp presentError:error];
+ } else {
+ [[NSWorkspace sharedWorkspace] openURL:url];
+ }
+}
+
- (void)PDFViewPerformFind:(PDFView *)sender {
[[[SKFindController sharedFindController] window]
makeKeyAndOrderFront:sender];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit