Revision: 12264
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12264&view=rev
Author:   amaxwell
Date:     2008-01-04 14:02:27 -0800 (Fri, 04 Jan 2008)

Log Message:
-----------
Add context menu item to open with default browser.

Modified Paths:
--------------
    trunk/bibdesk/BDSKWebGroupViewController.m

Modified: trunk/bibdesk/BDSKWebGroupViewController.m
===================================================================
--- trunk/bibdesk/BDSKWebGroupViewController.m  2008-01-04 21:58:54 UTC (rev 
12263)
+++ trunk/bibdesk/BDSKWebGroupViewController.m  2008-01-04 22:02:27 UTC (rev 
12264)
@@ -223,6 +223,13 @@
     [[BDSKBookmarkController sharedBookmarkController] 
addBookmarkWithUrlString:URLString proposedName:title modalForWindow:[webView 
window]];
 }
 
+- (IBAction)openInDefaultBrowser:(id)sender {
+    NSDictionary *element = (NSDictionary *)[sender representedObject];
+       NSURL *theURL = [element objectForKey:WebElementLinkURLKey];
+    if (theURL)
+        [[NSWorkspace sharedWorkspace] openURL:theURL];
+}
+
 - (void)setRetrieving:(BOOL)retrieving {
     [group setRetrieving:retrieving];
     [backForwardButton setEnabled:[webView canGoBack] forSegment:0];
@@ -369,6 +376,14 @@
     unsigned int i = [[menuItems valueForKey:@"tag"] indexOfObject:[NSNumber 
numberWithInt:WebMenuItemTagCopyLinkToClipboard]];
     
     if (i != NSNotFound) {
+        
+        item = [[NSMenuItem allocWithZone:[NSMenu menuZone]] 
initWithTitle:NSLocalizedString(@"Open in Default Browser",@"Open web page")
+                                                                    
action:@selector(openInDefaultBrowser:)
+                                                             
keyEquivalent:@""];
+        [item setTarget:self];
+        [item setRepresentedObject:element];
+        [menuItems insertObject:[item autorelease] atIndex:(i > 0 ? i - 1 : 
0)];
+        
         item = [[NSMenuItem allocWithZone:[NSMenu menuZone]] 
initWithTitle:[NSLocalizedString(@"Bookmark Link",@"Bookmark linked page") 
stringByAppendingEllipsis]
                                    action:@selector(bookmarkLink:)
                             keyEquivalent:@""];


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to