From: Mitchell Livingston Date: Thu, 10 Feb 2011 00:51:25 +0000 (+0000) Subject: move the "open torrent URL" sheet into its own xib file X-Git-Tag: 2.30b1~387 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c1281c43cf56a66ee7f547338db0fa03887bfda;p=transmission move the "open torrent URL" sheet into its own xib file --- diff --git a/Transmission.xcodeproj/project.pbxproj b/Transmission.xcodeproj/project.pbxproj index f1a5a919c..bb242e1cc 100644 --- a/Transmission.xcodeproj/project.pbxproj +++ b/Transmission.xcodeproj/project.pbxproj @@ -278,6 +278,8 @@ A2F40AE40A361C00006B8288 /* Transmission.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4D2784360905709500687951 /* Transmission.icns */; }; A2F41DAB0D0B916B006CE378 /* YingYangTemplate.png in Resources */ = {isa = PBXBuildFile; fileRef = A2F41DAA0D0B916B006CE378 /* YingYangTemplate.png */; }; A2F41F8E0D73595100B82116 /* InfoTracker.png in Resources */ = {isa = PBXBuildFile; fileRef = A2F41F8D0D73595100B82116 /* InfoTracker.png */; }; + A2F7CF5513035F7B0016FF10 /* URLSheetWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A2F7CF5413035F7B0016FF10 /* URLSheetWindow.xib */; }; + A2F7CF5F13035FFD0016FF10 /* URLSheetWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2F7CF5E13035FFD0016FF10 /* URLSheetWindowController.m */; }; A2F8CD430F3D0F4A00DB356A /* miniupnpcstrings.h in Headers */ = {isa = PBXBuildFile; fileRef = A2F8CD420F3D0F4A00DB356A /* miniupnpcstrings.h */; }; A2FB057F0BFEB6800095564D /* DragOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2FB057D0BFEB6800095564D /* DragOverlayView.m */; }; A2FB701C0D95CAEA0001F331 /* GroupsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2FB701B0D95CAEA0001F331 /* GroupsController.m */; }; @@ -846,6 +848,9 @@ A2F1511F0CD438BA001F3B0E /* Lock.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Lock.png; path = macosx/Images/Lock.png; sourceTree = ""; }; A2F41DAA0D0B916B006CE378 /* YingYangTemplate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = YingYangTemplate.png; path = macosx/Images/YingYangTemplate.png; sourceTree = ""; }; A2F41F8D0D73595100B82116 /* InfoTracker.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = InfoTracker.png; path = macosx/Images/InfoTracker.png; sourceTree = ""; }; + A2F7CF5413035F7B0016FF10 /* URLSheetWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = URLSheetWindow.xib; path = macosx/URLSheetWindow.xib; sourceTree = ""; }; + A2F7CF5D13035FFD0016FF10 /* URLSheetWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = URLSheetWindowController.h; path = macosx/URLSheetWindowController.h; sourceTree = ""; }; + A2F7CF5E13035FFD0016FF10 /* URLSheetWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = URLSheetWindowController.m; path = macosx/URLSheetWindowController.m; sourceTree = ""; }; A2F8951E0A2D4BA500ED2127 /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = Credits.rtf; path = macosx/Credits.rtf; sourceTree = ""; }; A2F8CD420F3D0F4A00DB356A /* miniupnpcstrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = miniupnpcstrings.h; path = "third-party/miniupnp/miniupnpcstrings.h"; sourceTree = ""; }; A2FB057C0BFEB6800095564D /* DragOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = DragOverlayView.h; path = macosx/DragOverlayView.h; sourceTree = ""; }; @@ -1053,6 +1058,8 @@ A25892630CF1F7E800CCCDDF /* StatsWindowController.m */, A2085DD90C53BC74000BC3B7 /* AboutWindowController.h */, A2085DDA0C53BC74000BC3B7 /* AboutWindowController.m */, + A2F7CF5D13035FFD0016FF10 /* URLSheetWindowController.h */, + A2F7CF5E13035FFD0016FF10 /* URLSheetWindowController.m */, A234D0D40C79FB6000A82373 /* Additions */, E1B6FBF80C0D719B0015FE4D /* Info Window */, A26AF2220D2DA42800FF7140 /* File Outline View */, @@ -1143,6 +1150,7 @@ A233BD320D8C6585007EE7B4 /* MessageWindow.xib */, A233BD680D8CF2C7007EE7B4 /* StatsWindow.xib */, A231274B0D11D0B7003F9AFF /* AboutWindow.xib */, + A2F7CF5413035F7B0016FF10 /* URLSheetWindow.xib */, A2D307B00D9EC9F50051FD27 /* BlocklistStatusWindow.xib */, A209ECA1114319C3002B02D1 /* InfoWindow.xib */, A209EAEA1142D294002B02D1 /* InfoGeneralView.xib */, @@ -1981,6 +1989,7 @@ A209EC12114301C6002B02D1 /* InfoOptionsView.xib in Resources */, A209ECA2114319C3002B02D1 /* InfoWindow.xib in Resources */, A21F15AD11729A9F00CF5A9C /* AddMagnetWindow.xib in Resources */, + A2F7CF5513035F7B0016FF10 /* URLSheetWindow.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2170,6 +2179,7 @@ A21F15AC11729A8B00CF5A9C /* AddMagnetWindowController.m in Sources */, A2661D6112D0E8D9004F69D5 /* FilterBarView.m in Sources */, A25BB02A12F4F517004B724E /* InfoTabButtonBack.m in Sources */, + A2F7CF5F13035FFD0016FF10 /* URLSheetWindowController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/macosx/Controller.h b/macosx/Controller.h index 38659b226..ef130c3e6 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -39,6 +39,7 @@ @class StatusBarView; @class Torrent; @class TorrentTableView; +@class URLSheetWindowController; typedef enum { @@ -96,10 +97,6 @@ typedef enum IBOutlet NSMenu * fGroupsSetMenu, * fGroupsSetContextMenu, * fGroupFilterMenu; IBOutlet NSPopUpButton * fGroupsButton; - IBOutlet NSWindow * fURLSheetWindow; - IBOutlet NSTextField * fURLSheetTextField; - IBOutlet NSButton * fURLSheetOpenButton; - #warning change to QLPreviewPanel id fPreviewPanel; BOOL fQuitting; @@ -132,10 +129,9 @@ typedef enum - (void) duplicateOpenAlert: (NSString *) name; - (void) duplicateOpenMagnetAlert: (NSString *) address transferName: (NSString *) name; -- (void) openURL: (NSString *) urlString; -- (void) openURLEndSheet: (id) sender; -- (void) openURLCancelEndSheet: (id) sender; -- (void) openURLShowSheet: (id) sender; +- (void) openURL: (NSString *) urlString; +- (void) openURLShowSheet: (id) sender; +- (void) urlSheetDidEnd: (URLSheetWindowController *) controller url: (NSString *) urlString returnCode: (NSInteger) returnCode; - (void) quitSheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo; diff --git a/macosx/Controller.m b/macosx/Controller.m index 0df0c265f..95d48b2df 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -36,6 +36,7 @@ #import "PrefsController.h" #import "GroupsController.h" #import "AboutWindowController.h" +#import "URLSheetWindowController.h" #import "AddWindowController.h" #import "AddMagnetWindowController.h" #import "MessageWindowController.h" @@ -1225,49 +1226,17 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy - (void) openURLShowSheet: (id) sender { - [NSApp beginSheet: fURLSheetWindow modalForWindow: fWindow modalDelegate: self - didEndSelector: @selector(urlSheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; + [[[URLSheetWindowController alloc] initWithController: self] beginSheetForWindow: fWindow]; } -- (void) openURLEndSheet: (id) sender +#warning need to remember sheet text between runs +- (void) urlSheetDidEnd: (URLSheetWindowController *) controller url: (NSString *) urlString returnCode: (NSInteger) returnCode { - [fURLSheetWindow orderOut: sender]; - [NSApp endSheet: fURLSheetWindow returnCode: 1]; -} - -- (void) openURLCancelEndSheet: (id) sender -{ - [fURLSheetWindow orderOut: sender]; - [NSApp endSheet: fURLSheetWindow returnCode: 0]; -} - -- (void) controlTextDidChange: (NSNotification *) notification -{ - if ([notification object] != fURLSheetTextField) - return; - - NSString * string = [fURLSheetTextField stringValue]; - BOOL enable = YES; - if ([string isEqualToString: @""]) - enable = NO; - else - { - NSRange prefixRange = [string rangeOfString: @"://"]; - if (prefixRange.location != NSNotFound && [string length] == NSMaxRange(prefixRange)) - enable = NO; - } - - [fURLSheetOpenButton setEnabled: enable]; -} - -- (void) urlSheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo -{ - [fURLSheetTextField selectText: self]; if (returnCode != 1) return; - NSString * urlString = [fURLSheetTextField stringValue]; [self performSelectorOnMainThread: @selector(openURL:) withObject: urlString waitUntilDone: NO]; + [controller release]; } - (void) createFile: (id) sender diff --git a/macosx/Makefile.am b/macosx/Makefile.am index b6e75c853..361112b41 100644 --- a/macosx/Makefile.am +++ b/macosx/Makefile.am @@ -8,6 +8,7 @@ EXTRA_DIST = \ InfoWindow.xib \ MessageWindow.xib \ StatsWindow.xib \ + URLSheetWindow.xib \ Defaults.plist \ Info.plist \ Transmission_Prefix.pch \ @@ -144,7 +145,9 @@ EXTRA_DIST = \ TrackerNode.h \ TrackerNode.m \ TrackerTableView.h \ - TrackerTableView.m + TrackerTableView.m \ + URLSheetWindowController.h \ + URLSheetWindowController.m dist-hook: rm -rf `find $(distdir)/ -type d -name .svn` diff --git a/macosx/URLSheetWindow.xib b/macosx/URLSheetWindow.xib new file mode 100644 index 000000000..8e05dc861 --- /dev/null +++ b/macosx/URLSheetWindow.xib @@ -0,0 +1,1066 @@ + + + + 1060 + 10J567 + 823 + 1038.35 + 462.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 823 + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + YES + + URLSheetWindowController + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{168, 356}, {400, 177}} + 1886912512 + Window + NSWindow + + View + + {1.79769e+308, 1.79769e+308} + {400, 177} + + + 256 + + YES + + + 274 + {{20, 50}, {360, 80}} + + YES + + -1805517311 + 272630272 + + + LucidaGrande + 13 + 1044 + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + + + + 289 + {{304, 12}, {82, 32}} + + YES + + 604110336 + 134217728 + Open + + + -2038284033 + 1 + + + DQ + 200 + 25 + + + + + 289 + {{222, 12}, {82, 32}} + + YES + + 67239424 + 134217728 + Cancel + + + -2038284033 + 1 + + + Gw + 200 + 25 + + + + + 266 + {{17, 140}, {366, 17}} + + YES + + 67239488 + 272631808 + label + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + + + + + {400, 177} + + + {{0, 0}, {1680, 1028}} + {400, 199} + {1.79769e+308, 1.79769e+308} + + + + + YES + + + window + + + + 13 + + + + fOpenButton + + + + 15 + + + + fLabelField + + + + 16 + + + + fTextField + + + + 17 + + + + openURLEndSheet: + + + + 18 + + + + openURLCancelEndSheet: + + + + 19 + + + + delegate + + + + 21 + + + + + YES + + 0 + + YES + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 3 + + + YES + + + + URLSheetWindow + + + 4 + + + YES + + + + + + + + + 5 + + + YES + + + + + + 6 + + + YES + + + + + + 7 + + + YES + + + + + + 8 + + + YES + + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + + + YES + + YES + -3.IBPluginDependency + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 3.IBEditorWindowLastContentRect + 3.IBPluginDependency + 3.IBWindowTemplateEditedContentRect + 3.ImportedFromIB2 + 3.windowTemplate.hasMaxSize + 3.windowTemplate.hasMinSize + 3.windowTemplate.maxSize + 3.windowTemplate.minSize + 4.IBPluginDependency + 4.ImportedFromIB2 + 5.IBPluginDependency + 5.ImportedFromIB2 + 6.IBPluginDependency + 6.ImportedFromIB2 + 7.IBPluginDependency + 7.ImportedFromIB2 + 8.IBPluginDependency + 8.ImportedFromIB2 + 9.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{535, 596}, {400, 177}} + com.apple.InterfaceBuilder.CocoaPlugin + {{535, 596}, {400, 177}} + + + + {3.40282e+38, 3.40282e+38} + {400, 177} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 21 + + + + YES + + NSApplication + + IBProjectSource + macosx/NSApplicationAdditions.h + + + + NSObject + + IBProjectSource + macosx/UKKQueue/UKFileWatcher.h + + + + NSObject + + IBProjectSource + macosx/UKKQueue/UKKQueue.h + + + + NSObject + + IBProjectSource + macosx/UKKQueue/UKMainThreadProxy.h + + + + URLSheetWindowController + NSWindowController + + YES + + YES + openURLCancelEndSheet: + openURLEndSheet: + + + YES + id + id + + + + YES + + YES + openURLCancelEndSheet: + openURLEndSheet: + + + YES + + openURLCancelEndSheet: + id + + + openURLEndSheet: + id + + + + + YES + + YES + fLabelField + fOpenButton + fTextField + + + YES + NSTextField + NSButton + NSTextField + + + + YES + + YES + fLabelField + fOpenButton + fTextField + + + YES + + fLabelField + NSTextField + + + fOpenButton + NSButton + + + fTextField + NSTextField + + + + + IBProjectSource + macosx/URLSheetWindowController.h + + + + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSButton + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSButton.h + + + + NSButtonCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSButtonCell.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSObject + + IBFrameworkSource + Growl.framework/Headers/GrowlApplicationBridge.h + + + + NSObject + + IBFrameworkSource + ImageKit.framework/Headers/IKImageBrowserView.h + + + + NSObject + + IBFrameworkSource + ImageKit.framework/Headers/IKSaveOptions.h + + + + NSObject + + IBFrameworkSource + ImageKit.framework/Headers/ImageKitDeprecated.h + + + + NSObject + + IBFrameworkSource + PDFKit.framework/Headers/PDFDocument.h + + + + NSObject + + IBFrameworkSource + PDFKit.framework/Headers/PDFView.h + + + + NSObject + + IBFrameworkSource + QuartzComposer.framework/Headers/QCCompositionParameterView.h + + + + NSObject + + IBFrameworkSource + QuartzComposer.framework/Headers/QCCompositionPickerView.h + + + + NSObject + + IBFrameworkSource + QuartzFilters.framework/Headers/QuartzFilterManager.h + + + + NSObject + + IBFrameworkSource + QuickLookUI.framework/Headers/QLPreviewPanel.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUAppcast.h + + + + NSObject + + IBFrameworkSource + Sparkle.framework/Headers/SUUpdater.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + NSWindowController + NSResponder + + showWindow: + id + + + showWindow: + + showWindow: + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../Transmission.xcodeproj + 3 + + diff --git a/macosx/URLSheetWindowController.h b/macosx/URLSheetWindowController.h new file mode 100644 index 000000000..8974035e6 --- /dev/null +++ b/macosx/URLSheetWindowController.h @@ -0,0 +1,44 @@ +/****************************************************************************** + * $Id$ + * + * Copyright (c) 2011 Transmission authors and contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + *****************************************************************************/ + +#import + +@class Controller; + +@interface URLSheetWindowController : NSWindowController +{ + IBOutlet NSTextField * fLabelField; + IBOutlet NSTextField * fTextField; + IBOutlet NSButton * fOpenButton; + + Controller * fController; +} + +- (id) initWithController: (Controller *) controller; +- (void) beginSheetForWindow: (NSWindow *) window; + +- (void) openURLEndSheet: (id) sender; +- (void) openURLCancelEndSheet: (id) sender; + +@end diff --git a/macosx/URLSheetWindowController.m b/macosx/URLSheetWindowController.m new file mode 100644 index 000000000..edfab8e97 --- /dev/null +++ b/macosx/URLSheetWindowController.m @@ -0,0 +1,83 @@ +/****************************************************************************** + * $Id$ + * + * Copyright (c) 2011 Transmission authors and contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + *****************************************************************************/ + +#import "URLSheetWindowController.h" +#import "Controller.h" + +@implementation URLSheetWindowController + +- (id) initWithController: (Controller *) controller +{ + if ((self = [self initWithWindowNibName: @"URLSheetWindow"])) + { + fController = controller; + } + return self; +} + +- (void) awakeFromNib +{ + [fLabelField setStringValue: NSLocalizedString(@"Internet address of torrent file:", "URL sheet label")]; +} + +- (IBAction) beginSheetForWindow: (NSWindow *) window +{ + [NSApp beginSheet: [self window] modalForWindow: window modalDelegate: self + didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:) contextInfo: nil]; +} + +- (void) openURLEndSheet: (id) sender +{ + [[self window] orderOut: sender]; + [NSApp endSheet: [self window] returnCode: 1]; +} + +- (void) openURLCancelEndSheet: (id) sender +{ + [[self window] orderOut: sender]; + [NSApp endSheet: [self window] returnCode: 0]; +} + +- (void) sheetDidEnd: (NSWindow *) sheet returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo +{ + [fController urlSheetDidEnd: self url: [fTextField stringValue] returnCode: returnCode]; +} + +- (void) controlTextDidChange: (NSNotification *) notification +{ + NSString * string = [fTextField stringValue]; + BOOL enable = YES; + if ([string isEqualToString: @""]) + enable = NO; + else + { + NSRange prefixRange = [string rangeOfString: @"://"]; + if (prefixRange.location != NSNotFound && [string length] == NSMaxRange(prefixRange)) + enable = NO; + } + + [fOpenButton setEnabled: enable]; +} + +@end diff --git a/macosx/en.lproj/MainMenu.xib b/macosx/en.lproj/MainMenu.xib index 2e4b5a6dd..32149c210 100644 --- a/macosx/en.lproj/MainMenu.xib +++ b/macosx/en.lproj/MainMenu.xib @@ -2620,110 +2620,6 @@ AAAAAAAAAAAAAAAAA YES - - 15 - 2 - {{168, 356}, {400, 177}} - 1886912512 - Window - NSWindow - - View - - {1.79769e+308, 1.79769e+308} - {400, 177} - - - 256 - - YES - - - 274 - {{20, 50}, {360, 80}} - - YES - - -1805517311 - 272630272 - - - - YES - - - 6 - System - textColor - - - - - - - 289 - {{304, 12}, {82, 32}} - - YES - - 604110336 - 134217728 - Open - - - -2038284033 - 1 - - - DQ - 200 - 25 - - - - - 289 - {{222, 12}, {82, 32}} - - YES - - 67239424 - 134217728 - Cancel - - - -2038284033 - 1 - - - Gw - 200 - 25 - - - - - 268 - {{17, 140}, {200, 17}} - - YES - - 67239424 - 272629760 - Internet address of torrent file: - - - - - - - - {400, 177} - - {{0, 0}, {1680, 1028}} - {400, 199} - {1.79769e+308, 1.79769e+308} - ActionMenu @@ -4038,38 +3934,6 @@ AAAAAAAAAAAAAAAAA 1847 - - - fURLSheetWindow - - - - 1853 - - - - fURLSheetTextField - - - - 1854 - - - - openURLEndSheet: - - - - 1855 - - - - openURLCancelEndSheet: - - - - 1856 - openURLShowSheet: @@ -4830,22 +4694,6 @@ AAAAAAAAAAAAAAAAA 3154 - - - fURLSheetOpenButton - - - - 3156 - - - - delegate - - - - 3157 - toggleStatusString: @@ -6361,64 +6209,6 @@ AAAAAAAAAAAAAAAAA Shared Defaults - - 1848 - - - YES - - - - URLSheetWindow - - - 1849 - - - YES - - - - - - - - - 1850 - - - YES - - - - - - 1851 - - - YES - - - - - - 1852 - - - YES - - - - - - 1857 - - - YES - - - - 1936 @@ -6725,26 +6515,6 @@ AAAAAAAAAAAAAAAAA - - 3064 - - - - - 3065 - - - - - 3066 - - - - - 3067 - - - 2683 @@ -7341,24 +7111,6 @@ AAAAAAAAAAAAAAAAA 1815.ImportedFromIB2 1846.IBPluginDependency 1846.ImportedFromIB2 - 1848.IBEditorWindowLastContentRect - 1848.IBPluginDependency - 1848.IBWindowTemplateEditedContentRect - 1848.ImportedFromIB2 - 1848.windowTemplate.hasMaxSize - 1848.windowTemplate.hasMinSize - 1848.windowTemplate.maxSize - 1848.windowTemplate.minSize - 1849.IBPluginDependency - 1849.ImportedFromIB2 - 1850.IBPluginDependency - 1850.ImportedFromIB2 - 1851.IBPluginDependency - 1851.ImportedFromIB2 - 1852.IBPluginDependency - 1852.ImportedFromIB2 - 1857.IBPluginDependency - 1857.ImportedFromIB2 1858.IBPluginDependency 1858.ImportedFromIB2 1860.IBPluginDependency @@ -7607,10 +7359,6 @@ AAAAAAAAAAAAAAAAA 3061.IBPluginDependency 3062.IBPluginDependency 3063.IBPluginDependency - 3064.IBPluginDependency - 3065.IBPluginDependency - 3066.IBPluginDependency - 3067.IBPluginDependency 3077.IBPluginDependency 3078.IBPluginDependency 3078.ImportedFromIB2 @@ -7959,24 +7707,6 @@ AAAAAAAAAAAAAAAAA com.apple.InterfaceBuilder.CocoaPlugin - {{0, 818}, {400, 177}} - com.apple.InterfaceBuilder.CocoaPlugin - {{0, 818}, {400, 177}} - - - - {3.40282e+38, 3.40282e+38} - {400, 177} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -8229,10 +7959,6 @@ AAAAAAAAAAAAAAAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -8390,8 +8116,6 @@ AAAAAAAAAAAAAAAAA linkTrac: moveDataFilesSelected: openShowSheet: - openURLCancelEndSheet: - openURLEndSheet: openURLShowSheet: removeDeleteData: removeNoDelete: @@ -8489,8 +8213,6 @@ AAAAAAAAAAAAAAAAA id id id - id - id @@ -8509,8 +8231,6 @@ AAAAAAAAAAAAAAAAA linkTrac: moveDataFilesSelected: openShowSheet: - openURLCancelEndSheet: - openURLEndSheet: openURLShowSheet: removeDeleteData: removeNoDelete: @@ -8603,14 +8323,6 @@ AAAAAAAAAAAAAAAAA openShowSheet: id - - openURLCancelEndSheet: - id - - - openURLEndSheet: - id - openURLShowSheet: id @@ -8814,9 +8526,6 @@ AAAAAAAAAAAAAAAAA fTotalDLImageView fTotalTorrentsField fTotalULField - fURLSheetOpenButton - fURLSheetTextField - fURLSheetWindow fUploadLimitItem fUploadMenu fUploadNoLimitItem @@ -8857,9 +8566,6 @@ AAAAAAAAAAAAAAAAA NSImageView NSTextField NSTextField - NSButton - NSTextField - NSWindow NSMenuItem NSMenu NSMenuItem @@ -8903,9 +8609,6 @@ AAAAAAAAAAAAAAAAA fTotalDLImageView fTotalTorrentsField fTotalULField - fURLSheetOpenButton - fURLSheetTextField - fURLSheetWindow fUploadLimitItem fUploadMenu fUploadNoLimitItem @@ -9045,18 +8748,6 @@ AAAAAAAAAAAAAAAAA fTotalULField NSTextField - - fURLSheetOpenButton - NSButton - - - fURLSheetTextField - NSTextField - - - fURLSheetWindow - NSWindow - fUploadLimitItem NSMenuItem