]> granicus.if.org Git - transmission/commitdiff
#902 pasting a link into transmission will open the url
authorMitchell Livingston <livings124@transmissionbt.com>
Thu, 1 May 2008 02:20:53 +0000 (02:20 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Thu, 1 May 2008 02:20:53 +0000 (02:20 +0000)
macosx/InfoWindowController.m
macosx/TorrentTableView.h
macosx/TorrentTableView.m

index 8f499abf812237e4a00e12b23b7faf41e1153879..3f93428272ecad3aec14baa885c23a26a034da6b 100644 (file)
@@ -394,8 +394,8 @@ typedef enum
                     ? [[torrent publicTorrentLocation] stringByAbbreviatingWithTildeInPath]
                     : NSLocalizedString(@"Transmission Support Folder", "Torrent -> location when deleting original")];
         if (publicTorrent)
-            [fTorrentLocationField setToolTip: [NSString stringWithFormat: @"%@\n\n%@",
-                        [torrent publicTorrentLocation], [torrent torrentLocation]]];
+            [fTorrentLocationField setToolTip: [[torrent publicTorrentLocation] stringByAppendingFormat: @"\n\n%@",
+                                                [torrent torrentLocation]]];
         else
             [fTorrentLocationField setToolTip: [torrent torrentLocation]];
         
index d07191b8f0f0bf72869e28accf18804d89e582de..8733c9a9a049829335c53e01e7123c1132309b3e 100644 (file)
@@ -66,6 +66,8 @@
 - (NSArray *) selectedValues;
 - (NSArray *) selectedTorrents;
 
+- (void) paste: (id) sender;
+
 - (void) toggleControlForTorrent: (Torrent *) torrent;
 
 - (void) displayTorrentMenuForEvent: (NSEvent *) event;
index 28fe7d99386b2cede42e02144d46511d5a806e2b..52ce65096ac60191b081107d1be44a3ee51ebb37 100644 (file)
         [super keyDown: event];
 }
 
+- (void) paste: (id) sender
+{
+    NSURL * url;
+    if ((url = [NSURL URLFromPasteboard: [NSPasteboard generalPasteboard]]))
+        [fController openURL: url];
+}
+
+- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
+{
+    SEL action = [menuItem action];
+    
+    if (action == @selector(paste:))
+        return [[[NSPasteboard generalPasteboard] types] containsObject: NSURLPboardType];
+    
+    return YES;
+}
+
 - (void) toggleControlForTorrent: (Torrent *) torrent
 {
     if ([torrent isActive])