├── .appledoc.plist ├── .gitignore ├── .gitmodules ├── AuthTester ├── AppDelegate.h ├── AppDelegate.m ├── AuthTester-Info.plist ├── AuthTester-Prefix.pch ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib └── main.m ├── Connection-Info.plist ├── Connection.svxSite ├── Connection.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── ConnectionKit.xcscheme ├── ConnectionKit 2.graffle ├── ConnectionKit.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── ConnectionKit.xccheckout ├── ConnectionKit ├── CK2Authentication.h ├── CK2Authentication.m ├── CK2BrowserPreviewController.h ├── CK2BrowserPreviewController.m ├── CK2BrowserPreviewView.h ├── CK2BrowserPreviewView.m ├── CK2CURLBasedProtocol.h ├── CK2CURLBasedProtocol.m ├── CK2CurlTransferStackManager.h ├── CK2CurlTransferStackManager.m ├── CK2FTPProtocol.h ├── CK2FTPProtocol.m ├── CK2FileCell.h ├── CK2FileCell.m ├── CK2FileManager.h ├── CK2FileManager.m ├── CK2FileManagerWithTestSupport.h ├── CK2FileManagerWithTestSupport.m ├── CK2FileOperation.h ├── CK2FileOperation.m ├── CK2FileOperationWithTestSupport.h ├── CK2FileOperationWithTestSupport.m ├── CK2FileProtocol.h ├── CK2FileProtocol.m ├── CK2FileSizeFormatter.h ├── CK2FileSizeFormatter.m ├── CK2IconItemView.h ├── CK2IconItemView.m ├── CK2IconView.h ├── CK2IconView.m ├── CK2IconViewItem.h ├── CK2IconViewItem.m ├── CK2NewFolderWindowController.h ├── CK2NewFolderWindowController.m ├── CK2OpenPanel.h ├── CK2OpenPanel.m ├── CK2OpenPanelColumnViewController.h ├── CK2OpenPanelColumnViewController.m ├── CK2OpenPanelController.h ├── CK2OpenPanelController.m ├── CK2OpenPanelIconViewController.h ├── CK2OpenPanelIconViewController.m ├── CK2OpenPanelListViewController.h ├── CK2OpenPanelListViewController.m ├── CK2OpenPanelViewController.h ├── CK2OpenPanelViewController.m ├── CK2PathControl.h ├── CK2PathControl.m ├── CK2PathFieldWindowController.h ├── CK2PathFieldWindowController.m ├── CK2Protocol.h ├── CK2Protocol.m ├── CK2SFTPProtocol.h ├── CK2SFTPProtocol.m ├── CK2WebDAVProtocol.h ├── CK2WebDAVProtocol.m ├── CKConnectionProtocol.h ├── CKS3Connection.h ├── CKS3Connection.m ├── CKTransferProgressCell.h ├── CKTransferProgressCell.m ├── CKTransferRecord.h ├── CKTransferRecord.m ├── CKUploader.h ├── CKUploader.m ├── ConnectionKit.h ├── ConnectionTest.h ├── ConnectionTest.m ├── Connection_Prefix.pch ├── NSImage+CK2OpenPanel.h ├── NSImage+CK2OpenPanel.m ├── NSURL+CK2OpenPanel.h ├── NSURL+CK2OpenPanel.m ├── en.lproj │ ├── CK2FilePreview.xib │ ├── CK2NewFolderWindow.xib │ ├── CK2OpenPanel.xib │ └── CK2PathFieldWindow.xib └── main.m ├── ConnectionKitUI ├── ConnectionKitUI-Info.plist ├── ConnectionKitUI-Prefix.pch ├── ConnectionKitUI.h └── en.lproj │ └── InfoPlist.strings ├── Documentation └── Standard Errors.md ├── Example ├── AquaFolder.png ├── Connection-Info.plist ├── Connection.svxSite ├── ConnectionApp.xcodeproj │ └── project.pbxproj ├── ConnectionTest.h ├── ConnectionTest.m ├── Connection_Prefix.pch ├── Controller.h ├── Controller.m ├── DropletController.h ├── DropletController.m ├── DropletHelper-Info.plist ├── DropletIcon.icns ├── DropletLauncher.m ├── DropletMain.m ├── DropletOutlineView.h ├── DropletOutlineView.m ├── DropletPanel.h ├── DropletPanel.m ├── FileTransfer.h ├── FileTransfer.m ├── Framework Debug.xcconfig ├── Framework Release.xcconfig ├── Framework-Info.plist ├── InputDialog.h ├── InputDialog.m ├── KTLog Viewer-Info.plist ├── KTLogController.h ├── KTLogController.m ├── LeopardFolder.tiff ├── Logs.icns ├── ONBSSLContext.h ├── ONBSSLContext.m ├── ONBSSLIdentity.h ├── ONBSSLIdentity.m ├── PermissionsController.h ├── PermissionsController.m ├── ProgressCell.h ├── ProgressCell.m ├── README ├── ReleaseNotes.txt ├── Stop.tiff ├── UKKQueue_Symbols ├── channel.c ├── comp.c ├── connect.tiff ├── console.tiff ├── crypt.c ├── da.lproj │ ├── DropletLauncher.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── InfoPlist.strings │ └── Localizable.strings ├── de.lproj │ ├── DropletLauncher.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── InfoPlist.strings │ └── Localizable.strings ├── delete.tiff ├── download.tif ├── edit.png ├── en.lproj │ ├── Droplet.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── DropletLauncher.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── InfoPlist.strings │ ├── InputDialog.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── KTLogViewer.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── Localizable.strings │ ├── MainMenu.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ ├── keyedobjects.nib │ │ └── objects.nib │ └── Permissions.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib ├── fr.lproj │ ├── DropletLauncher.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── InfoPlist.strings │ └── Localizable.strings ├── home.tiff ├── hostkey.c ├── icon.icns ├── it.lproj │ ├── DropletLauncher.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── InfoPlist.strings │ └── Localizable.strings ├── ja.lproj │ ├── DropletLauncher.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── InfoPlist.strings │ └── Localizable.strings ├── kex.c ├── ktlogviewer_main.m ├── libssh2.h ├── libssh2_config.h ├── libssh2_priv.h ├── libssh2_publickey.h ├── libssh2_sftp.h ├── lock.tiff ├── mac.c ├── main.m ├── misc.c ├── network_icon.png ├── openssl.c ├── openssl.h ├── packet.c ├── pem.c ├── publickey.c ├── redo.tif ├── scp.c ├── session.c ├── sftp.c ├── symlink_file.tif ├── symlink_folder.tif ├── unit test │ └── 09 moustik.mp3 ├── upload.tif ├── userauth.c ├── version.plist ├── zh_CN.lproj │ ├── DropletLauncher.nib │ │ ├── classes.nib │ │ ├── info.nib │ │ └── keyedobjects.nib │ ├── InfoPlist.strings │ └── Localizable.strings └── zh_TW.lproj │ ├── DropletLauncher.nib │ ├── classes.nib │ ├── info.nib │ └── keyedobjects.nib │ ├── InfoPlist.strings │ └── Localizable.strings ├── Framework Debug.xcconfig ├── Framework Release.xcconfig ├── ProfilingTester ├── AppDelegate.h ├── AppDelegate.m ├── ProfilingTester-Info.plist ├── ProfilingTester-Prefix.pch ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib └── main.m ├── README.md ├── Resources ├── Framework-Info.plist ├── bookmark.tif ├── da.lproj │ ├── InfoPlist.strings │ └── Localizable.strings ├── de.lproj │ ├── InfoPlist.strings │ └── Localizable.strings ├── en.lproj │ └── Localizable.strings ├── error.png ├── es.lproj │ └── Localizable.strings ├── finished.png ├── fr.lproj │ ├── InfoPlist.strings │ └── Localizable.strings ├── it.lproj │ ├── InfoPlist.strings │ └── Localizable.strings ├── ja.lproj │ ├── InfoPlist.strings │ └── Localizable.strings ├── pt_BR.lproj │ └── Localizable.strings ├── zh_CN.lproj │ ├── InfoPlist.strings │ └── Localizable.strings └── zh_TW.lproj │ ├── InfoPlist.strings │ └── Localizable.strings ├── UKQueue └── UKKQueue_Symbols ├── UnitTests ├── 09 moustik.mp3 ├── BaseCKProtocolTests.h ├── BaseCKProtocolTests.m ├── BaseCKTests.h ├── BaseCKTests.m ├── CKUploaderTests.m ├── ErrorTests.m ├── FTPAuthenticationTests.m ├── FTPTests.m ├── FileTests.m ├── PathTests.m ├── README.md ├── SFTPTests.m ├── URLAppendingTests.m ├── URLCanonicalizationTests.m ├── URLDirectoryTests.m ├── URLTests.m ├── URLs.testdata ├── UnitTest-Info.plist ├── UnitTests_Prefix.pch ├── WebDAVTests.m ├── test.sh ├── use-ftp-server.sh ├── use-mockserver.sh ├── use-sftp-server.sh └── use-webdav-server.sh └── version.plist /.appledoc.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | --include 6 | 7 | Documentation 8 | 9 | --ignore 10 | 11 | CurlHandle 12 | DAVKit 13 | AuthTester 14 | Example 15 | ProfilingTester 16 | UKQueue 17 | .git 18 | .gitmodules 19 | .gitignore 20 | 21 | --index-desc 22 | 23 | README.md 24 | 25 | --logformat 26 | xcode 27 | --exit-threshold 28 | 2 29 | --explicit-crossref 30 | 31 | --project-company 32 | Karelia Systems 33 | --company-id 34 | com.karelia 35 | --keep-undocumented-members 36 | 37 | --keep-undocumented-objects 38 | 39 | --merge-categories 40 | 41 | --keep-merged-sections 42 | 43 | --prefix-merged-sections 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac OS X 2 | *.DS_Store 3 | 4 | # Xcode 5 | build 6 | profile 7 | *.pbxuser 8 | *.mode1v3 9 | *.mode2v3 10 | *.perspectivev3 11 | *.xcuserstate 12 | xcuserdata/ 13 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "DAVKit"] 2 | path = DAVKit 3 | url = https://github.com/karelia/DAVKit.git 4 | [submodule "CurlHandle"] 5 | path = CurlHandle 6 | url = https://github.com/karelia/CurlHandle.git 7 | -------------------------------------------------------------------------------- /AuthTester/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AuthTester 4 | // 5 | // Created by Mike on 01/02/2013. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /AuthTester/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AuthTester 4 | // 5 | // Created by Mike on 01/02/2013. 6 | // 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (void)dealloc 14 | { 15 | [super dealloc]; 16 | } 17 | 18 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 19 | { 20 | [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://tv.eurosport.com/"]] 21 | delegate:self]; 22 | } 23 | 24 | - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; 25 | { 26 | NSLog(@"challenge error: %@", challenge.error); 27 | [[challenge sender] performDefaultHandlingForAuthenticationChallenge:challenge]; 28 | } 29 | 30 | - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error; 31 | { 32 | [NSApp presentError:error modalForWindow:self.window delegate:nil didPresentSelector:NULL contextInfo:NULL]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /AuthTester/AuthTester-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /AuthTester/AuthTester-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'AuthTester' target in the 'AuthTester' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /AuthTester/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /AuthTester/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /AuthTester/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AuthTester 4 | // 5 | // Created by Mike on 01/02/2013. 6 | // 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Connection-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.yourcompany.Connection 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | FMWK 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /Connection.svxSite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Connection.svxSite -------------------------------------------------------------------------------- /Connection.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Connection.xcodeproj/xcshareddata/xcschemes/ConnectionKit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 44 | 46 | 47 | 49 | 50 | 52 | 53 | 55 | 56 | 58 | 59 | 61 | 62 | 64 | 65 | 67 | 68 | 70 | 71 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 90 | 91 | 97 | 98 | 99 | 100 | 101 | 102 | 108 | 109 | 111 | 112 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /ConnectionKit.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ConnectionKit/CK2Authentication.m: -------------------------------------------------------------------------------- 1 | // 2 | // CK2Authentication.m 3 | // Connection 4 | // 5 | // Created by Mike on 18/12/2012. 6 | // 7 | // 8 | 9 | #import "CK2Authentication.h" 10 | 11 | #import 12 | 13 | 14 | #pragma mark SSH Host Fingerprint 15 | 16 | @interface CK2SSHHostFingerprintProtectionSpace : NSURLProtectionSpace 17 | { 18 | CK2KnownHostMatch _match; 19 | NSData *_publicKey; 20 | CK2KnownHostType _publicKeyType; 21 | } 22 | @end 23 | 24 | 25 | @implementation CK2SSHHostFingerprintProtectionSpace 26 | 27 | - initWithHost:(NSString *)host match:(enum curl_khmatch)match publicKey:(NSData *)key type:(CK2KnownHostType)keyType; 28 | { 29 | if (self = [self initWithHost:host port:0 protocol:@"ssh" realm:nil authenticationMethod:CK2AuthenticationMethodHostFingerprint]) 30 | { 31 | _match = match; 32 | _publicKey = [key copy]; 33 | _publicKeyType = keyType; 34 | } 35 | return self; 36 | } 37 | 38 | - (void)dealloc; 39 | { 40 | [_publicKey release]; 41 | [super dealloc]; 42 | } 43 | 44 | // Force it to return correct thing 45 | - (NSString *)authenticationMethod; { return CK2AuthenticationMethodHostFingerprint; } 46 | - (NSString *)protocol; { return @"ssh"; } 47 | 48 | - (CK2KnownHostMatch)ck2_knownHostMatch; { return _match; } 49 | - (NSData *)ck2_serverPublicKey; { return _publicKey; } 50 | - (CK2KnownHostType)ck2_serverKnownHostType; { return _publicKeyType; } 51 | 52 | // Make sure super doesn't create an actual copy 53 | - (id)copyWithZone:(NSZone *)zone; { return [self retain]; } 54 | 55 | @end 56 | 57 | 58 | @implementation NSURLProtectionSpace (CK2SSHHostFingerprint) 59 | 60 | - (CK2KnownHostMatch)ck2_knownHostMatch; { return 0; } 61 | - (NSData *)ck2_serverPublicKey; { return nil; } 62 | - (CK2KnownHostType)ck2_serverKnownHostType; { return CK2KnownHostTypeUnknown; } 63 | 64 | NSString * const CK2AuthenticationMethodHostFingerprint = @"CK2AuthenticationMethodHostFingerprint"; 65 | 66 | + (NSURLProtectionSpace *)ck2_protectionSpaceWithHost:(NSString *)host knownHostMatch:(CK2KnownHostMatch)match publicKey:(NSData *)key type:(CK2KnownHostType)keyType; 67 | { 68 | return [[[CK2SSHHostFingerprintProtectionSpace alloc] initWithHost:host match:match publicKey:key type:keyType] autorelease]; 69 | } 70 | 71 | @end 72 | 73 | 74 | @implementation NSURLCredential (CK2SSHHostFingerprint) 75 | 76 | + (NSURLCredential *)ck2_credentialForKnownHostWithPersistence:(NSURLCredentialPersistence)persistence; 77 | { 78 | return [self credentialWithUser:nil password:nil persistence:persistence]; 79 | } 80 | 81 | @end 82 | 83 | 84 | #pragma mark - 85 | 86 | 87 | @interface NSURLCredential (SFTPWrapperSuppliedMethods) 88 | 89 | + (NSURLCredential *)ck2_credentialWithUser:(NSString *)user 90 | publicKeyURL:(NSURL *)publicKey 91 | privateKeyURL:(NSURL *)privateKey; 92 | 93 | - (NSURLCredential *)ck2_credentialWithPassword:(NSString *)password persistence:(NSURLCredentialPersistence)persistence; 94 | 95 | @end 96 | 97 | 98 | @implementation NSURLCredential (CK2SSHPublicKey) 99 | 100 | + (NSURLCredential *)ck2_credentialWithUser:(NSString *)user 101 | publicKeyURL:(NSURL *)publicKey 102 | privateKeyURL:(NSURL *)privateKey 103 | password:(NSString *)password 104 | persistence:(NSURLCredentialPersistence)persistence; 105 | { 106 | NSURLCredential *result = [self ck2_credentialWithUser:user publicKeyURL:publicKey privateKeyURL:privateKey]; 107 | result = [result ck2_credentialWithPassword:password persistence:persistence]; 108 | return result; 109 | } 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /ConnectionKit/CK2BrowserPreviewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2BrowserPreviewControllerViewController.h 3 | // CKTest 4 | // 5 | // Created by Paul Kim on 12/26/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CK2BrowserPreviewController : NSViewController 12 | { 13 | 14 | } 15 | 16 | - (id)init; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /ConnectionKit/CK2BrowserPreviewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CK2BrowserPreviewControllerViewController.m 3 | // CKTest 4 | // 5 | // Created by Paul Kim on 12/26/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | 9 | #import "CK2BrowserPreviewController.h" 10 | #import "CK2BrowserPreviewView.h" 11 | #import "NSURL+CK2OpenPanel.h" 12 | 13 | @implementation CK2BrowserPreviewController 14 | 15 | - (id)init; 16 | { 17 | if ((self = [super initWithNibName:@"CK2FilePreview" bundle:[NSBundle bundleForClass:[self class]]]) != nil) 18 | { 19 | } 20 | 21 | return self; 22 | } 23 | 24 | - (void)loadView 25 | { 26 | [super loadView]; 27 | } 28 | 29 | - (void)setRepresentedObject:(id)representedObject 30 | { 31 | [super setRepresentedObject:representedObject]; 32 | 33 | [(CK2BrowserPreviewView *)[self view] setURL:representedObject]; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /ConnectionKit/CK2BrowserPreviewView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2BrowserPreviewView.h 3 | // Connection 4 | // 5 | // Created by Paul Kim on 1/18/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface CK2BrowserPreviewView : NSView 12 | { 13 | IBOutlet NSImageView *_iconView; 14 | IBOutlet NSTextField *_nameField; 15 | IBOutlet NSTextField *_kindField; 16 | IBOutlet NSTextField *_sizeField; 17 | IBOutlet NSTextField *_dateModifiedField; 18 | IBOutlet NSTextField *_nameLabel; 19 | IBOutlet NSTextField *_kindLabel; 20 | IBOutlet NSTextField *_sizeLabel; 21 | IBOutlet NSTextField *_dateModifiedLabel; 22 | 23 | NSRect _separatorRect; 24 | NSGradient *_separatorGradient; 25 | } 26 | 27 | - (void)setURL:(NSURL *)url; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ConnectionKit/CK2CURLBasedProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2CURLBasedProtocol.h 3 | // Connection 4 | // 5 | // Created by Mike on 06/12/2012. 6 | // 7 | // 8 | 9 | #import "CK2Protocol.h" 10 | 11 | #import 12 | 13 | 14 | @class CK2RemoteURL; 15 | 16 | @interface CK2CURLBasedProtocol : CK2Protocol 17 | { 18 | CURLTransfer *_transfer; 19 | BOOL _cancelled; 20 | NSString *_user; 21 | 22 | void (^_completionHandler)(NSError *error); 23 | void (^_dataBlock)(NSData *data); 24 | 25 | int64_t _totalBytesWritten; 26 | int64_t _totalBytesExpectedToWrite; 27 | } 28 | 29 | #pragma mark Initialisation 30 | // In any of these methods, if completion handler is nil, the standard behaviour of reporting to the client will be performed 31 | 32 | - (id)initWithRequest:(NSURLRequest *)request client:(id )client completionHandler:(void (^)(NSError *))handler; 33 | - (id)initWithRequest:(NSURLRequest *)request client:(id )client dataHandler:(void (^)(NSData *))dataBlock completionHandler:(void (^)(NSError *))handler; 34 | 35 | - (id)initWithCustomCommands:(NSArray *)commands request:(NSURLRequest *)request createIntermediateDirectories:(BOOL)createIntermediates client:(id )client completionHandler:(void (^)(NSError *error))handler; 36 | 37 | // Already handled for you; can override in a subclass if you want 38 | - (id)initForEnumeratingDirectoryWithRequest:(NSURLRequest *)request includingPropertiesForKeys:(NSArray *)keys options:(NSDirectoryEnumerationOptions)mask client:(id)client; 39 | 40 | - (id)initForCreatingFileWithRequest:(NSURLRequest *)request size:(int64_t)size withIntermediateDirectories:(BOOL)createIntermediates client:(id)client completionHandler:(void (^)(NSError *error))handler; 41 | 42 | #pragma mark Loading 43 | 44 | // If the protocol requires authentication, override -start to fire off an authentication challenge to the client. When a response is received to the challenge, CK2CURLBasedProtocol automatically handles it to start up the handle/request 45 | - (void)start; 46 | - (void)startWithProtectionSpace:(NSURLProtectionSpace *)protectionSpace; 47 | - (void)startWithRequest:(NSURLRequest *)request credential:(NSURLCredential *)credential; 48 | 49 | 50 | #pragma mark Progress 51 | @property(nonatomic, readonly) int64_t totalBytesWritten; 52 | @property(nonatomic, readonly) int64_t totalBytesExpectedToWrite; 53 | 54 | 55 | #pragma mark Customization 56 | + (BOOL)usesMultiHandle; // defaults to YES. Subclasses can override to be NO and fall back to the old synchronous "easy" backend 57 | - (void)popCompletionHandlerByExecutingWithError:(NSError *)error; 58 | - (void)reportToProtocolWithError:(NSError*)error; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /ConnectionKit/CK2CurlTransferStackManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2CurlTransferStackManager.h 3 | // Connection 4 | // 5 | // Created by Mike on 23/03/2015. 6 | // 7 | // 8 | 9 | #import 10 | 11 | 12 | /** 13 | This is a little wrapper around a CURLTransferStack. We use it to tie each CK2FileManager to a 14 | transfer stack, and invalidate that stack when appropriate. 15 | */ 16 | @interface CK2CurlTransferStackManager : NSObject { 17 | CURLTransferStack *_transferStack; 18 | } 19 | 20 | /** 21 | The manager automatically creates a transfer stack for itself 22 | */ 23 | @property(nonatomic, readonly) CURLTransferStack *transferStack; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /ConnectionKit/CK2CurlTransferStackManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // CK2CurlTransferStackManager.m 3 | // Connection 4 | // 5 | // Created by Mike on 23/03/2015. 6 | // 7 | // 8 | 9 | #import "CK2CurlTransferStackManager.h" 10 | 11 | @implementation CK2CurlTransferStackManager 12 | 13 | - (instancetype)init { 14 | if (self = [super init]) { 15 | _transferStack = [CURLTransferStack transferStackWithDelegate:nil delegateQueue:nil]; 16 | } 17 | return self; 18 | } 19 | 20 | - (void)dealloc { 21 | // We're being torn down, so figure now is the time to invalidate transfer stack. Crude, but 22 | // there you go. 23 | [self.transferStack finishTransfersAndInvalidate]; 24 | 25 | [super dealloc]; 26 | } 27 | 28 | @synthesize transferStack = _transferStack; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ConnectionKit/CK2FTPProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2FTPProtocol.h 3 | // Connection 4 | // 5 | // Created by Mike on 12/10/2012. 6 | // 7 | // 8 | 9 | #import "CK2CURLBasedProtocol.h" 10 | 11 | 12 | @interface CK2FTPProtocol : CK2CURLBasedProtocol 13 | { 14 | @private 15 | BOOL _atEnd; 16 | 17 | // SSL 18 | NSURLCredential *_credential; 19 | NSUInteger _sslFailures; 20 | } 21 | 22 | @end 23 | 24 | 25 | -------------------------------------------------------------------------------- /ConnectionKit/CK2FileCell.h: -------------------------------------------------------------------------------- 1 | /* 2 | This class is based on FileSystemBrowserCell. The original version of 3 | which can be found here: 4 | http://developer.apple.com/library/mac/#samplecode/ComplexBrowser/Listings/FileSystemBrowserCell_m.html 5 | 6 | The original code falls under the copyright and license specified 7 | there. 8 | 9 | 10 | Modifications to the code for this project fall under the following 11 | license: 12 | 13 | Copyright (c) 2013, Karelia Software 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without modification, 17 | are permitted provided that the following conditions are met: 18 | 19 | Redistributions of source code must retain the above copyright notice, this list 20 | of conditions and the following disclaimer. 21 | 22 | Redistributions in binary form must reproduce the above copyright notice, this 23 | list of conditions and the following disclaimer in the documentation and/or other 24 | materials provided with the distribution. 25 | 26 | Neither the name of Karelia Software nor the names of its contributors may be used to 27 | endorse or promote products derived from this software without specific prior 28 | written permission. 29 | 30 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 31 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 32 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 33 | SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 34 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 35 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 36 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 37 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 38 | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | 40 | */ 41 | 42 | #import 43 | 44 | @interface CK2FileCell : NSTextFieldCell { 45 | @private 46 | NSImage *_image; 47 | NSColor *_labelColor; 48 | BOOL _isTextOnly; 49 | } 50 | 51 | @property(retain) NSImage *image; 52 | @property(retain) NSColor *labelColor; 53 | @property(assign, getter=isTextOnly, nonatomic) BOOL textOnly; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /ConnectionKit/CK2FileManagerWithTestSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Sam Deane on 27/03/2013. 3 | // Copyright (c) 2013 Karelia Software. All rights reserved. 4 | 5 | #import "CK2FileManager.h" 6 | 7 | @class CURLTransferStack; 8 | 9 | /** 10 | CK2FileManager with some additional API for test purposes. 11 | */ 12 | 13 | @interface CK2FileManagerWithTestSupport : CK2FileManager 14 | { 15 | BOOL _dontShareConnections; 16 | CURLTransferStack* _multi; 17 | } 18 | 19 | /** 20 | An alternative CURLMultiHandle to use instead of the default one. 21 | This is generated on demand, if dontShareConnections is set. 22 | */ 23 | 24 | @property (strong, readonly, nonatomic) CURLTransferStack* multi; 25 | 26 | /** 27 | Set this property to force CURL based protocols use an alternative CURLTransfer instead of the default one 28 | */ 29 | 30 | @property (assign, nonatomic) BOOL dontShareConnections; 31 | 32 | @end 33 | 34 | @interface NSURLRequest(CK2FileManagerDebugging) 35 | - (CURLTransferStack*)ck2_multi; 36 | @end 37 | 38 | @interface NSMutableURLRequest(CK2FileManagerDebugging) 39 | - (void)ck2_setMulti:(CURLTransferStack*)multi; 40 | @end 41 | 42 | -------------------------------------------------------------------------------- /ConnectionKit/CK2FileManagerWithTestSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Sam Deane on 27/03/2013. 3 | // Copyright (c) 2013 Karelia Software. All rights reserved. 4 | 5 | #import "CK2FileManagerWithTestSupport.h" 6 | #import "CK2FileOperationWithTestSupport.h" 7 | 8 | #import 9 | 10 | 11 | @interface CURLTransfer (Testing) 12 | + (void)cleanupStandaloneMulti:(CURLTransferStack *)multi; 13 | + (CURLTransferStack *)standaloneMultiForTestPurposes; 14 | @end 15 | 16 | 17 | @implementation CK2FileManagerWithTestSupport 18 | 19 | @synthesize dontShareConnections = _dontShareConnections; 20 | @synthesize multi = _multi; 21 | 22 | - (void)dealloc 23 | { 24 | [CURLTransfer cleanupStandaloneMulti:_multi]; 25 | [_multi release]; 26 | 27 | [super dealloc]; 28 | } 29 | 30 | - (Class)classForOperation 31 | { 32 | return [CK2FileOperationWithTestSupport class]; 33 | } 34 | 35 | - (CURLTransferStack*)multi 36 | { 37 | if (_dontShareConnections && !_multi) 38 | { 39 | _multi = [[CURLTransfer standaloneMultiForTestPurposes] retain]; 40 | } 41 | 42 | return _dontShareConnections ? _multi : nil; 43 | } 44 | 45 | @end 46 | 47 | @implementation NSURLRequest(CK2FileManagerDebugging) 48 | 49 | - (CURLTransferStack*)ck2_multi 50 | { 51 | return [NSURLProtocol propertyForKey:@"ck2_multi" inRequest:self]; 52 | } 53 | 54 | @end 55 | @implementation NSMutableURLRequest(CK2FileManagerDebugging) 56 | 57 | - (void)ck2_setMulti:(CURLTransferStack*)multi 58 | { 59 | [NSURLProtocol setProperty:multi forKey:@"ck2_multi" inRequest:self]; 60 | } 61 | 62 | 63 | @end 64 | 65 | -------------------------------------------------------------------------------- /ConnectionKit/CK2FileOperation.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2FileOperation.h 3 | // Connection 4 | // 5 | // Created by Mike on 22/03/2013. 6 | // 7 | // 8 | 9 | #import "CK2FileManager.h" 10 | 11 | @class CK2Protocol; 12 | 13 | 14 | typedef NS_ENUM(NSInteger, CK2FileOperationState) { 15 | CK2FileOperationStateRunning = 0, /* The operation is currently being serviced by the file manager */ 16 | CK2FileOperationStateSuspended = 1, /* The operation is yet to start. */ 17 | CK2FileOperationStateCanceling = 2, /* The operation has been told to cancel and will complete shortly. */ 18 | CK2FileOperationStateCompleted = 3, /* The operation has completed and the file manager will receive no more delegate notifications */ 19 | }; 20 | 21 | 22 | @class CK2FileOperationCallbacks; 23 | 24 | /** 25 | All @properties are KVO-compliant. 26 | */ 27 | @interface CK2FileOperation : NSObject // retains self when copying 28 | { 29 | @private 30 | CK2FileManager *_manager; 31 | NSURL *_originalURL; 32 | NSString *_descriptionForErrors; 33 | dispatch_queue_t _queue; 34 | 35 | CK2Protocol *_protocol; 36 | CK2FileOperationCallbacks *_callbacks; 37 | 38 | void (^_completionBlock)(NSError *); 39 | void (^_enumerationBlock)(NSURL *); 40 | NSURL *_localURL; 41 | 42 | int64_t _bytesWritten; 43 | int64_t _bytesExpectedToWrite; 44 | CK2ProgressBlock _progressBlock; 45 | 46 | // Temporary hack which gets us to fire off extra directory creating requests should the main op fail 47 | BOOL _createIntermediateDirectories; 48 | 49 | CK2FileOperationState _state; 50 | NSError *_error; 51 | } 52 | 53 | /** 54 | @return a deep copy of the original connection request. 55 | 56 | You can think of this as the "primary" URL for a given operation. Normally this is fairly obvious: 57 | if uploading, it's the URL being uploaded to. When we come to support downloads, it's the URL being 58 | downloaded from. 59 | 60 | This can potentially get a bit tricky doing something like renaming/moving a file; in which case, 61 | this URL will be that of the _source_ file. 62 | 63 | ConnectionKit doesn't currently support redirects, but were it to, this URL would remain constant 64 | and we'd likely introduce a new `currentURL` property for retrieving the redirected URL if need be. 65 | */ 66 | @property (readonly, copy) NSURL *originalURL; 67 | 68 | /** 69 | * Number of body bytes already written. 70 | * 71 | * Excludes any headers, such as in HTTP messages, or FTP control connection. 72 | */ 73 | @property (readonly) int64_t countOfBytesWritten; 74 | 75 | /** 76 | * Number of body bytes we expect to write. 77 | * 78 | * Excludes any headers, such as in HTTP messages, or FTP control connection. 79 | */ 80 | @property (readonly) int64_t countOfBytesExpectedToWrite; 81 | 82 | /** 83 | * `-cancel` returns immediately, but marks an operation as being canceled. 84 | * The operation will signal its completion handler with an 85 | * error value of `{ NSURLErrorDomain, NSURLErrorCancelled }`. In some 86 | * cases, the operation may signal other work before it acknowledges the 87 | * cancelation. 88 | */ 89 | - (void)cancel; 90 | 91 | /** 92 | * The current state of the operation. 93 | */ 94 | @property (readonly) CK2FileOperationState state; 95 | 96 | /** 97 | * The error, if any. Also delivered to completion handler. 98 | * This property will be `nil` in the event that no error occured. 99 | */ 100 | @property (readonly, copy) NSError *error; 101 | 102 | /** 103 | Sets an operation going if it hasn't already. 104 | */ 105 | - (void)resume; 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /ConnectionKit/CK2FileOperationWithTestSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Sam Deane on 27/03/2013. 3 | // Copyright (c) 2013 Karelia Software. All rights reserved. 4 | 5 | #import "CK2FileOperation.h" 6 | 7 | @interface CK2FileOperationWithTestSupport : CK2FileOperation 8 | @end 9 | -------------------------------------------------------------------------------- /ConnectionKit/CK2FileOperationWithTestSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Sam Deane on 27/03/2013. 3 | // Copyright (c) 2013 Karelia Software. All rights reserved. 4 | 5 | #import "CK2FileOperationWithTestSupport.h" 6 | #import "CK2FileManagerWithTestSupport.h" 7 | 8 | @implementation CK2FileOperationWithTestSupport 9 | 10 | - (NSURLRequest *)requestWithURL:(NSURL *)url; 11 | { 12 | NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:60.0]; 13 | CK2FileManagerWithTestSupport* manager = [self valueForKey:@"_manager"]; 14 | if (manager.dontShareConnections) 15 | { 16 | [request ck2_setMulti:manager.multi]; 17 | } 18 | 19 | return request; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /ConnectionKit/CK2FileProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2FileProtocol.h 3 | // Connection 4 | // 5 | // Created by Mike on 18/10/2012. 6 | // 7 | // 8 | 9 | #import "CK2Protocol.h" 10 | 11 | @interface CK2FileProtocol : CK2Protocol 12 | { 13 | @private 14 | void (^_block)(void); 15 | BOOL _cancelled; 16 | dispatch_queue_t _queue; 17 | 18 | int64_t _bytesExpectedToWrite; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /ConnectionKit/CK2FileSizeFormatter.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2FileSizeFormatter.h 3 | // Connection 4 | // 5 | // Created by Paul Kim on 1/16/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface CK2FileSizeFormatter : NSNumberFormatter 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ConnectionKit/CK2FileSizeFormatter.m: -------------------------------------------------------------------------------- 1 | // 2 | // CK2FileSizeFormatter.m 3 | // Connection 4 | // 5 | // Created by Paul Kim on 1/16/13. 6 | // 7 | // 8 | 9 | #import "CK2FileSizeFormatter.h" 10 | 11 | #define FRACTION_TRESHOLD_INDEX 2 12 | 13 | static NSArray *_unitLabels; 14 | 15 | @implementation CK2FileSizeFormatter 16 | 17 | + (void)initialize 18 | { 19 | if ([[self class] isEqual:[CK2FileSizeFormatter class]]) 20 | { 21 | _unitLabels = [@[ @"bytes", @"KB", @"MB", @"TB", @"PB", @"EB", @"ZB", @"YB" ] retain]; 22 | } 23 | } 24 | 25 | - (NSString *)stringForObjectValue:(id)anObject 26 | { 27 | if ([anObject isKindOfClass:[NSNumber class]]) 28 | { 29 | NSUInteger i, count; 30 | double size; 31 | NSString *formattedNumber; 32 | 33 | size = [anObject doubleValue]; 34 | count = [_unitLabels count]; 35 | 36 | for (i = 0; (i < count) && (size >= 1000); i++) 37 | { 38 | size /= 1000; 39 | } 40 | 41 | if (i >= count) 42 | { 43 | i = count - 1; 44 | } 45 | 46 | if (i < FRACTION_TRESHOLD_INDEX) 47 | { 48 | [self setMaximumFractionDigits:0]; 49 | } 50 | else 51 | { 52 | [self setMaximumFractionDigits:1]; 53 | } 54 | 55 | formattedNumber = [super stringForObjectValue:[NSNumber numberWithDouble:size]]; 56 | 57 | return [NSString stringWithFormat:@"%@ %@", formattedNumber, [_unitLabels objectAtIndex:i]]; 58 | } 59 | else if ([anObject isKindOfClass:[NSString class]]) 60 | { 61 | return @"--"; 62 | } 63 | return @""; 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /ConnectionKit/CK2IconItemView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2IconItemView.h 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 12/23/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, 10 | // are permitted provided that the following conditions are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // Neither the name of Karelia Software nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior 21 | // written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 24 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 31 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import 34 | 35 | @class CK2IconViewItem; 36 | 37 | @interface CK2IconItemView : NSView 38 | { 39 | IBOutlet CK2IconViewItem *_item; 40 | NSTextFieldCell *_textCell; 41 | } 42 | 43 | @property (readwrite, assign, nonatomic) CK2IconViewItem *item; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /ConnectionKit/CK2IconView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2IconView.h 3 | // Connection 4 | // 5 | // Created by Paul Kim on 1/17/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface CK2IconView : NSCollectionView 12 | { 13 | NSMutableString *_typeSelectBuffer; 14 | NSTimer *_typeSelectTimer; 15 | 16 | BOOL _messageMode; 17 | } 18 | 19 | @property (readwrite, assign, nonatomic) BOOL messageMode; 20 | 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /ConnectionKit/CK2IconViewItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2IconViewItem.h 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 12/19/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, 10 | // are permitted provided that the following conditions are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // Neither the name of Karelia Software nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior 21 | // written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 24 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 31 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import 34 | 35 | @interface CK2IconViewItem : NSCollectionViewItem 36 | { 37 | IBOutlet id _target; 38 | SEL _action; 39 | SEL _doubleAction; 40 | BOOL _isEnabled; 41 | } 42 | 43 | @property (readwrite, assign) id target; 44 | @property (readwrite, assign) SEL action; 45 | @property (readwrite, assign) SEL doubleAction; 46 | @property (readwrite, assign, getter=isEnabled) BOOL enabled; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /ConnectionKit/CK2IconViewItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // CK2IconViewItem.m 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 12/19/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, 10 | // are permitted provided that the following conditions are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // Neither the name of Karelia Software nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior 21 | // written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 24 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 31 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import "CK2IconViewItem.h" 34 | #import "CK2IconItemView.h" 35 | 36 | @interface CK2IconViewItem () 37 | 38 | @end 39 | 40 | @implementation CK2IconViewItem 41 | 42 | @synthesize target = _target; 43 | @synthesize action = _action; 44 | @synthesize doubleAction = _doubleAction; 45 | @synthesize enabled = _isEnabled; 46 | 47 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 48 | { 49 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) != nil) 50 | { 51 | [self setEnabled:YES]; 52 | } 53 | 54 | return self; 55 | } 56 | 57 | - (void)dealloc 58 | { 59 | [(CK2IconItemView *)[self view] setItem:nil]; 60 | [super dealloc]; 61 | } 62 | 63 | - (void)setView:(NSView *)view 64 | { 65 | [super setView:view]; 66 | 67 | [(CK2IconItemView *)[self view] setItem:self]; 68 | } 69 | 70 | #pragma mark NSCopying 71 | 72 | - (id)copyWithZone:(NSZone *)zone 73 | { 74 | CK2IconViewItem *copy; 75 | 76 | copy = [super copyWithZone:zone]; 77 | [copy setTarget:[self target]]; 78 | [copy setAction:[self action]]; 79 | [copy setDoubleAction:[self doubleAction]]; 80 | 81 | return copy; 82 | } 83 | 84 | #pragma mark NSCoding 85 | 86 | #define TARGET_KEY @"target" 87 | #define ACTION_KEY @"action" 88 | #define DOUBLE_ACTION_KEY @"doubleAction" 89 | #define ENABLED_ACTION_KEY @"enabled" 90 | 91 | - (id)initWithCoder:(NSCoder *)aDecoder 92 | { 93 | if ((self = [super initWithCoder:aDecoder]) != nil) 94 | { 95 | [self setTarget:[aDecoder decodeObjectForKey:TARGET_KEY]]; 96 | [self setAction:NSSelectorFromString([aDecoder decodeObjectForKey:ACTION_KEY])]; 97 | [self setDoubleAction:NSSelectorFromString([aDecoder decodeObjectForKey:DOUBLE_ACTION_KEY])]; 98 | [self setEnabled:[aDecoder decodeBoolForKey:ENABLED_ACTION_KEY]]; 99 | } 100 | return self; 101 | } 102 | 103 | - (void)encodeWithCoder:(NSCoder *)aCoder 104 | { 105 | [super encodeWithCoder:aCoder]; 106 | 107 | [aCoder encodeObject:[self target] forKey:TARGET_KEY]; 108 | [aCoder encodeObject:NSStringFromSelector([self action]) forKey:ACTION_KEY]; 109 | [aCoder encodeObject:NSStringFromSelector([self doubleAction]) forKey:DOUBLE_ACTION_KEY]; 110 | [aCoder encodeBool:[self isEnabled] forKey:ENABLED_ACTION_KEY]; 111 | } 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /ConnectionKit/CK2NewFolderWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2NewFolderWindowWindowController.h 3 | // Connection 4 | // 5 | // Created by Paul Kim on 1/22/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @class CK2OpenPanelController; 12 | 13 | @interface CK2NewFolderWindowController : NSWindowController 14 | { 15 | IBOutlet NSTextField *_nameField; 16 | IBOutlet NSButton *_okButton; 17 | IBOutlet NSTextField *_statusField; 18 | IBOutlet NSProgressIndicator *_progressIndicator; 19 | 20 | CK2OpenPanelController *_controller; 21 | NSURL *_folderURL; 22 | NSArray *_existingNames; 23 | CK2FileOperation *_operation; 24 | NSError *_error; 25 | } 26 | 27 | @property (readonly, retain) NSURL *folderURL; 28 | @property (readonly, retain) NSError *error; 29 | 30 | - (id)initWithController:(CK2OpenPanelController *)controller;; 31 | 32 | - (BOOL)runModalForURL:(NSURL *)url; 33 | 34 | - (IBAction)ok:(id)sender; 35 | - (IBAction)cancel:(id)sender; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /ConnectionKit/CK2OpenPanelColumnViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2OpenPanelBrowserController.h 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 12/29/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, 10 | // are permitted provided that the following conditions are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // Neither the name of Karelia Software nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior 21 | // written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 24 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 31 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import 34 | #import "CK2OpenPanelViewController.h" 35 | 36 | @class CK2BrowserPreviewController; 37 | 38 | @interface CK2OpenPanelColumnViewController : CK2OpenPanelViewController 39 | { 40 | IBOutlet NSBrowser *_browser; 41 | CK2BrowserPreviewController *_previewController; 42 | NSURL *_rootURL; 43 | } 44 | 45 | @property (readwrite, retain) NSURL *rootURL; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /ConnectionKit/CK2OpenPanelIconViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2OpenPanelIconViewController.h 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 1/9/13. 6 | // Copyright (c) 2013 Paul Kim. All rights reserved. 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, 10 | // are permitted provided that the following conditions are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // Neither the name of Karelia Software nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior 21 | // written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 24 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 31 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import "CK2OpenPanelViewController.h" 34 | 35 | @class CK2IconView; 36 | 37 | @interface CK2OpenPanelIconViewController : CK2OpenPanelViewController 38 | { 39 | IBOutlet CK2IconView *_iconView; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /ConnectionKit/CK2OpenPanelListViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2OpenPanelListController.h 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 12/29/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, 10 | // are permitted provided that the following conditions are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // Neither the name of Karelia Software nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior 21 | // written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 24 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 31 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import "CK2OpenPanelViewController.h" 34 | 35 | @interface CK2OpenPanelListViewController : CK2OpenPanelViewController 36 | { 37 | IBOutlet NSOutlineView *_outlineView; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /ConnectionKit/CK2OpenPanelViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2OpenPanelViewController.h 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 12/29/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, 10 | // are permitted provided that the following conditions are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // Neither the name of Karelia Software nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior 21 | // written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 24 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 31 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import 34 | 35 | @class CK2OpenPanelController; 36 | 37 | @interface CK2OpenPanelViewController : NSViewController 38 | { 39 | IBOutlet CK2OpenPanelController *_controller; 40 | } 41 | 42 | @property (readonly, assign) CK2OpenPanelController *controller; 43 | @property (readwrite, assign) BOOL allowsMutipleSelection; 44 | 45 | - (id)init; 46 | 47 | - (void)reload; 48 | - (void)update; 49 | - (BOOL)hasFixedRoot; 50 | 51 | - (void)urlDidLoad:(NSURL *)url; 52 | 53 | - (NSArray *)selectedURLs; 54 | - (IBAction)itemSelected:(id)sender; 55 | - (IBAction)itemDoubleClicked:(id)sender; 56 | 57 | - (void)saveViewHistoryState:(NSMutableDictionary *)dict; 58 | - (void)restoreViewHistoryState:(NSDictionary *)dict; 59 | 60 | - (IBAction)goToSelectedItem:(id)sender; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /ConnectionKit/CK2OpenPanelViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CK2OpenPanelViewController.m 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 12/29/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, 10 | // are permitted provided that the following conditions are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // Neither the name of Karelia Software nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior 21 | // written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 24 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 31 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import "CK2OpenPanelViewController.h" 34 | #import "CK2OpenPanelController.h" 35 | 36 | @implementation CK2OpenPanelViewController 37 | 38 | - (id)init 39 | { 40 | if ((self = [super initWithNibName:nil bundle:nil]) != nil) 41 | { 42 | } 43 | return self; 44 | } 45 | 46 | @synthesize controller = _controller; 47 | 48 | - (BOOL)allowsMutipleSelection 49 | { 50 | return NO; 51 | } 52 | 53 | - (void)setAllowsMutipleSelection:(BOOL)allowsMutipleSelection 54 | { 55 | } 56 | 57 | - (void)reload 58 | { 59 | } 60 | 61 | - (void)update 62 | { 63 | } 64 | 65 | - (BOOL)hasFixedRoot 66 | { 67 | return NO; 68 | } 69 | 70 | - (void)urlDidLoad:(NSURL *)url 71 | { 72 | } 73 | 74 | - (NSArray *)selectedURLs 75 | { 76 | return [NSArray array]; 77 | } 78 | 79 | 80 | - (IBAction)itemSelected:(id)sender 81 | { 82 | NSArray *urls; 83 | 84 | urls = [self selectedURLs]; 85 | 86 | if ([urls count] > 0) 87 | { 88 | [[self controller] setURLs:urls updateDirectory:[self hasFixedRoot] sender:self]; 89 | } 90 | } 91 | 92 | - (IBAction)itemDoubleClicked:(id)sender 93 | { 94 | } 95 | 96 | - (void)saveViewHistoryState:(NSMutableDictionary *)dict 97 | { 98 | } 99 | 100 | - (void)restoreViewHistoryState:(NSDictionary *)dict 101 | { 102 | } 103 | 104 | - (IBAction)goToSelectedItem:(id)sender 105 | { 106 | } 107 | 108 | 109 | 110 | @end 111 | -------------------------------------------------------------------------------- /ConnectionKit/CK2PathControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2PathControl.h 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 12/27/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, 10 | // are permitted provided that the following conditions are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // Neither the name of Karelia Software nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior 21 | // written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 24 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 31 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import 34 | 35 | @class CK2OpenPanelController; 36 | 37 | @interface CK2PathControl : NSPopUpButton 38 | { 39 | NSURL *_url; 40 | } 41 | 42 | @property (readwrite, retain, nonatomic) NSURL *URL; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /ConnectionKit/CK2PathControl.m: -------------------------------------------------------------------------------- 1 | // 2 | // CK2PathControl.m 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 12/27/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | // 9 | // Redistribution and use in source and binary forms, with or without modification, 10 | // are permitted provided that the following conditions are met: 11 | // 12 | // Redistributions of source code must retain the above copyright notice, this list 13 | // of conditions and the following disclaimer. 14 | // 15 | // Redistributions in binary form must reproduce the above copyright notice, this 16 | // list of conditions and the following disclaimer in the documentation and/or other 17 | // materials provided with the distribution. 18 | // 19 | // Neither the name of Karelia Software nor the names of its contributors may be used to 20 | // endorse or promote products derived from this software without specific prior 21 | // written permission. 22 | // 23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 24 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 26 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 28 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 31 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | 33 | #import "CK2PathControl.h" 34 | #import "NSURL+CK2OpenPanel.h" 35 | #import "CK2OpenPanelController.h" 36 | #import "NSImage+CK2OpenPanel.h" 37 | 38 | #define ICON_SIZE 16.0 39 | 40 | @implementation CK2PathControl 41 | 42 | @synthesize URL = _url; 43 | 44 | - (id)initWithFrame:(NSRect)frame 45 | { 46 | if ((self = [super initWithFrame:frame pullsDown:NO]) != nil) 47 | { 48 | [[self menu] setAutoenablesItems:NO]; 49 | } 50 | 51 | return self; 52 | } 53 | 54 | - (void)dealloc 55 | { 56 | [_url release]; 57 | [super dealloc]; 58 | } 59 | 60 | - (void)urlSelected:(id)sender 61 | { 62 | [self setURL:[sender representedObject]]; 63 | [self sendAction:[self action] to:[self target]]; 64 | } 65 | 66 | - (void)setURL:(NSURL *)url 67 | { 68 | if (![url isEqual:_url]) 69 | { 70 | NSMenu *menu; 71 | 72 | [_url release]; 73 | _url = [url retain]; 74 | 75 | menu = [self menu]; 76 | [menu removeAllItems]; 77 | 78 | if (url != nil) 79 | { 80 | NSSize size; 81 | NSURL *tempURL; 82 | 83 | size = NSMakeSize(ICON_SIZE, ICON_SIZE); 84 | tempURL = _url; 85 | 86 | while (tempURL != nil) 87 | { 88 | NSImage *image; 89 | NSString *title; 90 | NSMenuItem *item; 91 | 92 | image = [[[tempURL ck2_icon] copy] autorelease]; 93 | title = [tempURL ck2_displayName]; 94 | 95 | if ([title isEqual:@"/"] || 96 | title.length == 0) // happens for URLs like ftpes://user@example.com 97 | { 98 | title = [tempURL host]; 99 | } 100 | 101 | item = [[NSMenuItem alloc] initWithTitle:title action:@selector(urlSelected:) keyEquivalent:@""]; 102 | [item setTarget:self]; 103 | [image setSize:size]; 104 | [item setImage:image]; 105 | [item setRepresentedObject:tempURL]; 106 | [menu addItem:item]; 107 | [item release]; 108 | 109 | tempURL = [tempURL ck2_parentURL]; 110 | } 111 | } 112 | [self selectItemAtIndex:0]; 113 | } 114 | } 115 | 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /ConnectionKit/CK2PathFieldWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2PathFieldWindowController.h 3 | // Connection 4 | // 5 | // Created by Paul Kim on 3/25/13. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface CK2PathFieldWindowController : NSWindowController 12 | { 13 | IBOutlet NSTextField *_field; 14 | IBOutlet NSButton *_goButton; 15 | NSString *_stringValue; 16 | } 17 | 18 | @property (readwrite, copy) NSString *stringValue; 19 | 20 | - (id)init; 21 | 22 | - (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSInteger result))handler; 23 | 24 | - (IBAction)go:(id)sender; 25 | - (IBAction)cancel:(id)sender; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ConnectionKit/CK2PathFieldWindowController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CK2PathFieldWindowController.m 3 | // Connection 4 | // 5 | // Created by Paul Kim on 3/25/13. 6 | // 7 | // 8 | 9 | #import "CK2PathFieldWindowController.h" 10 | 11 | @interface CK2PathFieldWindowController () 12 | 13 | @end 14 | 15 | @implementation CK2PathFieldWindowController 16 | 17 | @synthesize stringValue = _stringValue; 18 | 19 | - (id)init 20 | { 21 | if ((self = [super initWithWindowNibName:@"CK2PathFieldWindow"]) != nil) 22 | { 23 | } 24 | 25 | return self; 26 | } 27 | 28 | 29 | - (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSInteger result))handler 30 | { 31 | NSWindow *sheet; 32 | NSText *fieldEditor; 33 | NSString *string; 34 | 35 | sheet = [self window]; 36 | string = [self stringValue]; 37 | [_field setStringValue:string]; 38 | [sheet makeFirstResponder:_field]; 39 | 40 | fieldEditor = [sheet fieldEditor:YES forObject:_field]; 41 | [fieldEditor setSelectedRange:NSMakeRange([string length], 0)]; 42 | 43 | [NSApp beginSheet:sheet modalForWindow:window modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:[handler copy]]; 44 | } 45 | 46 | - (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo 47 | { 48 | [sheet orderOut:self]; 49 | 50 | if (returnCode == NSOKButton) 51 | { 52 | [self setStringValue:[_field stringValue]]; 53 | } 54 | 55 | if (contextInfo != NULL) 56 | { 57 | void (^block)(NSInteger); 58 | 59 | block = contextInfo; 60 | block(returnCode); 61 | [block release]; 62 | } 63 | } 64 | 65 | - (IBAction)cancel:(id)sender 66 | { 67 | [NSApp endSheet:[self window] returnCode:NSCancelButton]; 68 | } 69 | 70 | - (IBAction)go:(id)sender 71 | { 72 | [NSApp endSheet:[self window] returnCode:NSOKButton]; 73 | } 74 | 75 | - (void)controlTextDidChange:(NSNotification *)aNotification 76 | { 77 | NSText *fieldEditor; 78 | NSString *string; 79 | 80 | fieldEditor = [[aNotification userInfo] objectForKey:@"NSFieldEditor"]; 81 | 82 | string = [fieldEditor string]; 83 | 84 | [_goButton setEnabled:([string length] != 0)]; 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /ConnectionKit/CK2SFTPProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2SFTPProtocol.h 3 | // Connection 4 | // 5 | // Created by Mike on 15/10/2012. 6 | // 7 | // 8 | 9 | #import "CK2CURLBasedProtocol.h" 10 | 11 | @interface CK2SFTPProtocol : CK2CURLBasedProtocol 12 | { 13 | @private 14 | NSURLAuthenticationChallenge *_fingerprintChallenge; 15 | enum curl_khstat _knownHostsStat; 16 | dispatch_semaphore_t _fingerprintSemaphore; 17 | 18 | NSString *_transcriptMessage; 19 | } 20 | @end 21 | -------------------------------------------------------------------------------- /ConnectionKit/CK2WebDAVProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CK2WebDAVProtocol.h 3 | // 4 | // Created by Sam Deane on 19/11/2012. 5 | // 6 | // 7 | 8 | #import "CK2Protocol.h" 9 | #import 10 | 11 | typedef void (^CK2WebDAVCompletionHandler)(id result); 12 | typedef void (^CK2WebDAVErrorHandler)(NSError* error); 13 | 14 | @interface CK2WebDAVProtocol : CK2Protocol 15 | { 16 | @private 17 | DAVSession* _session; 18 | NSOperationQueue* _queue; 19 | 20 | CK2WebDAVCompletionHandler _completionHandler; 21 | CK2WebDAVErrorHandler _errorHandler; 22 | 23 | BOOL _isWriteOp; // minor hack for now 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /ConnectionKit/CKS3Connection.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2004-2006, Greg Hulands 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | Redistributions of source code must retain the above copyright notice, this list 9 | of conditions and the following disclaimer. 10 | 11 | Redistributions in binary form must reproduce the above copyright notice, this 12 | list of conditions and the following disclaimer in the documentation and/or other 13 | materials provided with the distribution. 14 | 15 | Neither the name of Greg Hulands nor the names of its contributors may be used to 16 | endorse or promote products derived from this software without specific prior 17 | written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 22 | SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 24 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 25 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 27 | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "CKHTTPConnection.h" 31 | 32 | 33 | @interface CKS3Connection : CKHTTPConnection 34 | { 35 | //When we receive a directory listing that is truncated, we keep around the contents in here until we've received all the directory's contents to return the delegate. 36 | NSMutableArray *incompleteDirectoryContents; 37 | NSMutableArray *incompleteKeyNames; 38 | 39 | NSString *myCurrentDirectory; 40 | unsigned long long bytesTransferred; 41 | unsigned long long bytesToTransfer; 42 | unsigned long long transferHeaderLength; 43 | unsigned int myLastPercent; 44 | NSFileHandle *myDownloadHandle; 45 | 46 | @private 47 | // Authentication 48 | NSURLCredential *_credential; 49 | //NSURLAuthenticationChallenge *_currentAuthenticationChallenge; 50 | } 51 | 52 | @end 53 | 54 | extern NSString *S3StorageClassKey; // file attribute extension keys 55 | 56 | extern NSString *S3ErrorDomain; 57 | 58 | enum { S3DownloadFileExists = 100 }; 59 | -------------------------------------------------------------------------------- /ConnectionKit/CKTransferProgressCell.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2006, Greg Hulands 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | Redistributions of source code must retain the above copyright notice, this list 9 | of conditions and the following disclaimer. 10 | 11 | Redistributions in binary form must reproduce the above copyright notice, this 12 | list of conditions and the following disclaimer in the documentation and/or other 13 | materials provided with the distribution. 14 | 15 | Neither the name of Greg Hulands nor the names of its contributors may be used to 16 | endorse or promote products derived from this software without specific prior 17 | written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 22 | SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 24 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 25 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 27 | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | 31 | #import 32 | 33 | /* 34 | To set the name and progress, set the object value with a dictionary 35 | and have the keys progress and name 36 | */ 37 | 38 | @interface CKTransferProgressCell : NSCell 39 | { 40 | NSInteger myProgress; 41 | BOOL _finished; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /ConnectionKit/ConnectionKit.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2006, Greg Hulands 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without modification, 6 | are permitted provided that the following conditions are met: 7 | 8 | Redistributions of source code must retain the above copyright notice, this list 9 | of conditions and the following disclaimer. 10 | 11 | Redistributions in binary form must reproduce the above copyright notice, this 12 | list of conditions and the following disclaimer in the documentation and/or other 13 | materials provided with the distribution. 14 | 15 | Neither the name of Greg Hulands nor the names of its contributors may be used to 16 | endorse or promote products derived from this software without specific prior 17 | written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 20 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 22 | SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 24 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 25 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 27 | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | 31 | #import 32 | #import 33 | #import 34 | 35 | // Legacy 36 | #import 37 | #import 38 | #import 39 | 40 | -------------------------------------------------------------------------------- /ConnectionKit/ConnectionTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectionTest.h 3 | // Marvel 4 | // 5 | // Created by Dan Wood on 11/29/04. 6 | // Copyright (c) 2004 Biophony, LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface ConnectionTest : NSObject { 13 | 14 | NSMutableDictionary *myCallbackDictionary; 15 | unsigned long myUniqueNumber; 16 | 17 | NSThread *myMainThread; // not retained. Just for diagnostics. 18 | 19 | NSString *myCurrentDirectory; 20 | 21 | } 22 | 23 | - (NSMutableDictionary *)callbackDictionary; 24 | - (void)setCallbackDictionary:(NSMutableDictionary *)aCallbackDictionary; 25 | 26 | - (NSString *)currentDirectory; 27 | - (void)setCurrentDirectory:(NSString *)aCurrentDirectory; 28 | 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ConnectionKit/Connection_Prefix.pch: -------------------------------------------------------------------------------- 1 | 2 | #define LocalizedStringInConnectionKitBundle(key, comment) \ 3 | [[NSBundle bundleForClass:[self class]] localizedStringForKey:(key) value:@"" table:nil] 4 | 5 | #ifndef CK2WebDAVLog 6 | #define CK2WebDAVLog(...) 7 | #endif -------------------------------------------------------------------------------- /ConnectionKit/NSImage+CK2OpenPanel.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSImage+NSImage_CK2OpenPanel.h 3 | // Connection 4 | // 5 | // Created by Paul Kim on 1/27/13. 6 | // 7 | // Redistribution and use in source and binary forms, with or without modification, 8 | // are permitted provided that the following conditions are met: 9 | // 10 | // Redistributions of source code must retain the above copyright notice, this list 11 | // of conditions and the following disclaimer. 12 | // 13 | // Redistributions in binary form must reproduce the above copyright notice, this 14 | // list of conditions and the following disclaimer in the documentation and/or other 15 | // materials provided with the distribution. 16 | // 17 | // Neither the name of Karelia Software nor the names of its contributors may be used to 18 | // endorse or promote products derived from this software without specific prior 19 | // written permission. 20 | // 21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 22 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 26 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 29 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | 31 | #import 32 | 33 | @interface NSImage (CK2OpenPanel) 34 | 35 | - (NSImage *)ck2_imageWithBadgeImage:(NSImage *)image; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /ConnectionKit/NSURL+CK2OpenPanel.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+CKRemote.h 3 | // ConnectionKit 4 | // 5 | // Created by Paul Kim on 12/15/12. 6 | // Copyright (c) 2012 Paul Kim. All rights reserved. 7 | // 8 | // Redistribution and use in source and binary forms, with or without modification, 9 | // are permitted provided that the following conditions are met: 10 | // 11 | // Redistributions of source code must retain the above copyright notice, this list 12 | // of conditions and the following disclaimer. 13 | // 14 | // Redistributions in binary form must reproduce the above copyright notice, this 15 | // list of conditions and the following disclaimer in the documentation and/or other 16 | // materials provided with the distribution. 17 | // 18 | // Neither the name of Karelia Software nor the names of its contributors may be used to 19 | // endorse or promote products derived from this software without specific prior 20 | // written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 23 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | // SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 27 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 28 | // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 30 | // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | #import 33 | 34 | @interface NSURL (CK2OpenPanel) 35 | 36 | + (NSURL *)ck2_loadingURL; 37 | + (NSURL *)ck2_errorURL; 38 | + (NSURL *)ck2_errorURLWithMessage:(NSString *)message; 39 | 40 | /** 41 | @return A comparator to compare the last component of URLs alphabetically. 42 | */ 43 | + (NSComparator)ck2_displayComparator; 44 | 45 | - (BOOL)ck2_isPlaceholder; 46 | 47 | - (NSString *)ck2_displayName; 48 | - (NSImage *)ck2_icon; 49 | - (NSNumber *)ck2_size; 50 | - (NSDate *)ck2_dateModified; 51 | - (NSString *)ck2_kind; 52 | - (BOOL)ck2_isDirectory; 53 | - (BOOL)ck2_isPackage; 54 | - (BOOL)ck2_isHidden; 55 | 56 | - (NSURL *)ck2_root; 57 | - (NSURL *)ck2_parentURL; 58 | 59 | /** 60 | Will return YES if receiver and given url are the same. 61 | 62 | @return Whether the receiver represents an ancestory directory of the given url. 63 | */ 64 | - (BOOL)ck2_isAncestorOfURL:(NSURL *)url; 65 | 66 | - (NSURL *)ck2_URLByDeletingTrailingSlash; 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /ConnectionKit/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FTPConnection 4 | // 5 | // Created by Greg Hulands on 3/12/04. 6 | // Copyright __MyCompanyName__ 2004. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **) argv); 14 | } 15 | -------------------------------------------------------------------------------- /ConnectionKitUI/ConnectionKitUI-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ConnectionKitUI/ConnectionKitUI-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /ConnectionKitUI/ConnectionKitUI.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectionKitUI.h 3 | // ConnectionKitUI 4 | // 5 | // Created by Mike on 08/07/2013. 6 | // 7 | // 8 | 9 | #import 10 | 11 | #import 12 | -------------------------------------------------------------------------------- /ConnectionKitUI/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Documentation/Standard Errors.md: -------------------------------------------------------------------------------- 1 | Protocols have wildly differing implementations, and those implementation can return wildly different errors in a given situation. 2 | 3 | To some extent this is an impossible problem to solve, since it's unrealistic for us to provide a universal translation of all potential errors into some known set. 4 | 5 | However, it is useful to be able to test for a few common errors, in specific situations, such as: 6 | 7 | - authentication has failed 8 | - we tried to make a directory but it was already there 9 | - we tried to delete a directory but it wasn't there 10 | - we tried to delete a file but it wasn't there 11 | 12 | It's also helpful to wrap up all the other errors in some more generic catch-alls: 13 | 14 | - something went wrong with something that reads/lists files 15 | - something went wrong with writes/modifies/creates/destroys files 16 | 17 | 18 | As a result, CK2Protocol defines some standard methods that protocol implementations can use to wrap up their own errors: 19 | 20 | - (NSError*)standardCouldntWriteErrorWithUnderlyingError:(NSError*)error; 21 | - (NSError*)standardCouldntReadErrorWithUnderlyingError:(NSError*)error; 22 | - (NSError*)standardFileNotFoundErrorWithUnderlyingError:(NSError*)error; 23 | - (NSError*)standardAuthenticationErrorWithUnderlyingError:(NSError*)error; 24 | 25 | These methods will return, respectively: 26 | 27 | standardCouldntWriteErrorWithUnderlyingError: NSCocoaErrorDomain - NSFileWriteUnknownError 28 | standardCouldntReadErrorWithUnderlyingError: NSCocoaErrorDomain - NSFileNoSuchFileError 29 | standardFileNotFoundErrorWithUnderlyingError: NSCocoaErrorDomain - NSURLErrorNoPermissionsToReadFile 30 | standardAuthenticationErrorWithUnderlyingError: NSURLErrorDomain NSURLErrorUserAuthenticationRequired 31 | 32 | Protocol implementations should ensure that they use these errors in the following situations: 33 | 34 | Use standardAuthenticationErrorWithUnderlyingError to report any authentication problems (obviously). 35 | 36 | Use standardFileNotFoundErrorWithUnderlyingError if the protocol implementation is sure that the underlying problem is caused by the file being absent. For example when deleting a directory or file that doesn't exist - assuming that the underlying protocol error is specific enough to know that this is the reason for the failure. 37 | 38 | Use standardCouldntWriteErrorWithUnderlyingError when performing a createFile/createDirectory/removeFile/removeDirectory/setAttributes, if the protocol implementation's underlying error was too vague or definitely wasn't a file-not-found error. 39 | 40 | Use standardCouldntReadErrorWithUnderlyingError when performing a enumating operation, if the protocol implementation's underlying error was too vague or definitely wasn't a file-not-found error. 41 | 42 | One of the side benefits of this plan is that it allows us to write some unit tests that work generically across all supported protocols, since they now have some (vaguely) predictable errors to check against in the situations where the test is deliberately engineering an error situation. 43 | 44 | Hopefully, though, this will also allow client code that uses multiple protocols to do something vaguely sensible with the errors that it gets back. 45 | 46 | -------------------------------------------------------------------------------- /Example/AquaFolder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/AquaFolder.png -------------------------------------------------------------------------------- /Example/Connection-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.yourcompany.Connection 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | FMWK 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /Example/Connection.svxSite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/Connection.svxSite -------------------------------------------------------------------------------- /Example/ConnectionTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConnectionTest.h 3 | // Marvel 4 | // 5 | // Created by Dan Wood on 11/29/04. 6 | // Copyright (c) 2004 Biophony, LLC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface ConnectionTest : NSObject { 13 | 14 | NSMutableDictionary *myCallbackDictionary; 15 | unsigned long myUniqueNumber; 16 | 17 | NSThread *myMainThread; // not retained. Just for diagnostics. 18 | 19 | NSString *myCurrentDirectory; 20 | 21 | } 22 | 23 | - (NSMutableDictionary *)callbackDictionary; 24 | - (void)setCallbackDictionary:(NSMutableDictionary *)aCallbackDictionary; 25 | 26 | - (NSString *)currentDirectory; 27 | - (void)setCurrentDirectory:(NSString *)aCurrentDirectory; 28 | 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/Connection_Prefix.pch: -------------------------------------------------------------------------------- 1 | // For Mac OS X < 10.5. 2 | #ifndef NSINTEGER_DEFINED 3 | #define NSINTEGER_DEFINED 4 | #ifdef __LP64__ || NS_BUILD_32_LIKE_64 5 | typedef long NSInteger; 6 | typedef unsigned long NSUInteger; 7 | #define NSIntegerMin LONG_MIN 8 | #define NSIntegerMax LONG_MAX 9 | #define NSUIntegerMax ULONG_MAX 10 | #else 11 | typedef int NSInteger; 12 | typedef unsigned int NSUInteger; 13 | #define NSIntegerMin INT_MIN 14 | #define NSIntegerMax INT_MAX 15 | #define NSUIntegerMax UINT_MAX 16 | #endif 17 | #endif // NSINTEGER_DEFINED 18 | 19 | 20 | #import "KTLog.h" -------------------------------------------------------------------------------- /Example/Controller.h: -------------------------------------------------------------------------------- 1 | /* Controller */ 2 | 3 | #import 4 | 5 | @class InputDialog; 6 | @protocol AbstractConnectionProtocol; 7 | 8 | @interface Controller : NSObject 9 | { 10 | IBOutlet NSButton *btnConnect; 11 | IBOutlet NSButton *btnDelete; 12 | IBOutlet NSButton *btnNewFolder; 13 | IBOutlet NSButton *btnPermissions; 14 | IBOutlet NSButton *btnRefresh; 15 | IBOutlet NSButton *btnStop; 16 | IBOutlet NSButton *cBtnCancel; 17 | IBOutlet NSButton *cBtnConnect; 18 | IBOutlet NSTextField *cHost; 19 | IBOutlet NSPanel *connectWindow; 20 | IBOutlet NSTextField *cPass; 21 | IBOutlet NSTextField *cPort; 22 | IBOutlet NSPopUpButton *cTypePopup; 23 | IBOutlet NSTextField *cURL; 24 | IBOutlet NSTextField *cUser; 25 | IBOutlet NSPopUpButton *localPopup; 26 | IBOutlet NSTableView *localTable; 27 | IBOutlet NSPopUpButton *remotePopup; 28 | IBOutlet NSTableView *remoteTable; 29 | IBOutlet NSTextField *status; 30 | IBOutlet NSTableView *transferTable; 31 | IBOutlet NSWindow *window; 32 | IBOutlet NSDrawer *logDrawer; 33 | IBOutlet NSTextView *log; 34 | IBOutlet NSOutlineView *savedHosts; 35 | IBOutlet NSButton *btnDisconnect; 36 | IBOutlet NSTextField *initialDirectory; 37 | IBOutlet NSTextView *fileCheckLog; 38 | IBOutlet NSButton *btnBrowseHost; 39 | IBOutlet NSButton *btnEdit; 40 | IBOutlet NSPopUpButton *oConMenu; 41 | 42 | id con; 43 | NSMutableArray *remoteFiles; 44 | NSMutableArray *localFiles; 45 | NSMutableArray *transfers; 46 | NSString *currentLocalPath; 47 | NSString *currentRemotePath; 48 | 49 | int downloadCounter; 50 | int uploadCounter; 51 | BOOL isConnected; 52 | 53 | NSMutableArray *_savedHosts; 54 | id selectedItem; 55 | InputDialog *check; 56 | } 57 | - (IBAction)cancelConnect:(id)sender; 58 | - (IBAction)connect:(id)sender; 59 | - (IBAction)deleteFile:(id)sender; 60 | - (IBAction)localFileSelected:(id)sender; 61 | - (IBAction)localPopupChanged:(id)sender; 62 | - (IBAction)newFolder:(id)sender; 63 | - (IBAction)permissions:(id)sender; 64 | - (IBAction)refresh:(id)sender; 65 | - (IBAction)remoteFileSelected:(id)sender; 66 | - (IBAction)remotePopupChanged:(id)sender; 67 | - (IBAction)showConnect:(id)sender; 68 | - (IBAction)stopTransfer:(id)sender; 69 | - (IBAction)transferSelected:(id)sender; 70 | @end 71 | -------------------------------------------------------------------------------- /Example/DropletController.h: -------------------------------------------------------------------------------- 1 | /* DropletController */ 2 | 3 | #import 4 | #import 5 | 6 | @interface DropletController : NSObject 7 | { 8 | IBOutlet NSButton *oCancel; 9 | IBOutlet NSTextField *oPassword; 10 | IBOutlet NSPanel *oPasswordPanel; 11 | IBOutlet NSTextField *oPasswordText; 12 | IBOutlet NSProgressIndicator *oProgressBar; 13 | IBOutlet NSTextField *oStatus; 14 | IBOutlet NSPanel *oWindow; 15 | IBOutlet NSOutlineView *oFiles; 16 | IBOutlet NSButton *oToggleFiles; 17 | 18 | CKHost *myHost; 19 | id myConnection; 20 | NSArray *myFilesDropped; 21 | NSMutableArray *myTransfers; 22 | } 23 | - (IBAction)cancelPassword:(id)sender; 24 | - (IBAction)cancelUpload:(id)sender; 25 | - (IBAction)connectPassword:(id)sender; 26 | - (IBAction)toggleFiles:(id)sender; 27 | @end 28 | -------------------------------------------------------------------------------- /Example/DropletHelper-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | DropletIcon 11 | CFBundleIdentifier 12 | com.connectionkit.DropletHelper 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | APPL 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | LSUIElement 22 | 1 23 | NSMainNibFile 24 | Droplet 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /Example/DropletIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/DropletIcon.icns -------------------------------------------------------------------------------- /Example/DropletLauncher.m: -------------------------------------------------------------------------------- 1 | // 2 | // DropletLauncher.m 3 | // Connection 4 | // 5 | // Created by Greg Hulands on 16/11/06. 6 | // Copyright 2006 __MyCompanyName__. All rights reserved. 7 | // 8 | #import 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | return NSApplicationMain(argc, (const char **) argv); 13 | } 14 | 15 | @interface DropletLauncherDelegate : NSObject 16 | { 17 | BOOL myHasFilesToUpload; 18 | } 19 | 20 | @end 21 | 22 | @implementation DropletLauncherDelegate 23 | 24 | - (id)init 25 | { 26 | if ((self != [super init])) 27 | { 28 | [self release]; 29 | return nil; 30 | } 31 | myHasFilesToUpload = NO; 32 | 33 | return self; 34 | } 35 | 36 | - (void)application:(NSApplication *)app openFiles:(NSArray *)files 37 | { 38 | myHasFilesToUpload = YES; 39 | NSString *dropletCreator = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CKApplication"]; 40 | NSString *applicationPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:dropletCreator]; 41 | NSString *dyldPath = [[applicationPath stringByAppendingPathComponent:@"Contents"] stringByAppendingPathComponent:@"Frameworks"]; 42 | NSString *ckFrameworkPath = [[dyldPath stringByAppendingPathComponent:@"Connection"] stringByAppendingPathExtension:@"framework"]; 43 | NSString *dropletPath = [[NSBundle bundleWithPath:ckFrameworkPath] pathForResource:@"DropletHelper" ofType:@"app"]; 44 | NSString *path = [[NSBundle bundleWithPath:dropletPath] executablePath]; 45 | 46 | if (!path) 47 | { 48 | NSRunAlertPanel(NSLocalizedString(@"Bad Droplet", @"error"), 49 | NSLocalizedString(@"This droplet is missing the original application that created it. You will need to reinstall the original application.", @"error"), 50 | NSLocalizedString(@"Quit", @"error"), 51 | nil, 52 | nil); 53 | [NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0]; 54 | return; 55 | } 56 | 57 | NSTask *task = [[NSTask alloc] init]; 58 | [task setLaunchPath:path]; 59 | NSMutableArray *args = [NSMutableArray arrayWithObject:[[NSBundle mainBundle] pathForResource:@"configuration" ofType:@"ckhost"]]; 60 | [args addObjectsFromArray:files]; 61 | [task setArguments:args]; 62 | [task launch]; 63 | 64 | [task release]; 65 | [NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0]; 66 | } 67 | 68 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 69 | { 70 | if (!myHasFilesToUpload) 71 | { 72 | NSString *dropletCreator = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CKApplication"]; 73 | NSString *applicationPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:dropletCreator]; 74 | [[NSWorkspace sharedWorkspace] openFile:[[NSBundle mainBundle] pathForResource:@"configuration" ofType:@"ckhost"] withApplication:applicationPath]; 75 | [NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0]; 76 | } 77 | } 78 | 79 | @end 80 | 81 | -------------------------------------------------------------------------------- /Example/DropletMain.m: -------------------------------------------------------------------------------- 1 | // 2 | // DropletMain.m 3 | // Connection 4 | // 5 | // Created by Greg Hulands on 16/11/06. 6 | // Copyright 2006 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **) argv); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /Example/DropletOutlineView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DropletOutlineView.h 3 | // Connection 4 | // 5 | // Created by Greg Hulands on 16/11/06. 6 | // Copyright 2006 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface DropletOutlineView : NSOutlineView 13 | { 14 | BOOL isReloading; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/DropletOutlineView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DropletOutlineView.m 3 | // Connection 4 | // 5 | // Created by Greg Hulands on 16/11/06. 6 | // Copyright 2006 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "DropletOutlineView.h" 10 | 11 | 12 | @implementation DropletOutlineView 13 | 14 | - (void)reloadData 15 | { 16 | if (isReloading) 17 | { 18 | [self performSelector:@selector(reloadData) withObject:nil afterDelay:0.0]; 19 | } 20 | isReloading = YES; 21 | [super reloadData]; 22 | isReloading = NO; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/DropletPanel.h: -------------------------------------------------------------------------------- 1 | // 2 | // DropletPanel.h 3 | // Connection 4 | // 5 | // Created by Greg Hulands on 17/11/06. 6 | // Copyright 2006 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface DropletPanel : NSPanel 13 | { 14 | 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/DropletPanel.m: -------------------------------------------------------------------------------- 1 | // 2 | // DropletPanel.m 3 | // Connection 4 | // 5 | // Created by Greg Hulands on 17/11/06. 6 | // Copyright 2006 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "DropletPanel.h" 10 | 11 | 12 | @implementation DropletPanel 13 | 14 | - (BOOL)hidesOnDeactivate 15 | { 16 | return NO; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/FileTransfer.h: -------------------------------------------------------------------------------- 1 | // 2 | // FileTransfer.h 3 | // FTPConnection 4 | // 5 | // Created by Greg Hulands on 24/11/05. 6 | // Copyright 2005 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | // This is just a wrapper around the notion of a file transfer 10 | 11 | #import 12 | 13 | typedef enum { 14 | UploadType = 0, 15 | DownloadType, 16 | DeleteType 17 | } TransferType; 18 | 19 | @interface FileTransfer : NSObject 20 | { 21 | TransferType _type; 22 | NSString *_local; 23 | NSString *_remote; 24 | NSNumber *_size; 25 | NSNumber *_percent; 26 | NSNumber *_transferred; 27 | BOOL _completed; 28 | } 29 | 30 | + (id)uploadFile:(NSString *)local to:(NSString *)remote; 31 | + (id)downloadFile:(NSString *)remote to:(NSString *)local; 32 | + (id)deleteFile:(NSString *)remote; 33 | 34 | - (id)initWithType:(TransferType)type localFile:(NSString *)local remoteFile:(NSString *)remote; 35 | 36 | - (void)setLocalFile:(NSString *)local; 37 | - (void)setRemoteFile:(NSString *)remote; 38 | - (void)setSize:(NSNumber *)size; 39 | - (void)setPercentTransferred:(NSNumber *)percent; 40 | - (void)setAmountTransferred:(NSNumber *)transferred; 41 | - (void)setCompleted:(BOOL)flag; 42 | - (void)setType:(TransferType)type; 43 | - (TransferType)type; 44 | 45 | - (BOOL)isCompleted; 46 | - (NSString *)localFile; 47 | - (NSString *)remoteFile; 48 | - (NSNumber *)size; 49 | - (NSNumber *)percentTransferred; 50 | - (NSNumber *)amountTransferred; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Example/FileTransfer.m: -------------------------------------------------------------------------------- 1 | // 2 | // FileTransfer.m 3 | // FTPConnection 4 | // 5 | // Created by Greg Hulands on 24/11/05. 6 | // Copyright 2005 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "FileTransfer.h" 10 | 11 | 12 | @implementation FileTransfer 13 | 14 | + (id)uploadFile:(NSString *)local to:(NSString *)remote 15 | { 16 | FileTransfer *transfer = [[[FileTransfer alloc] initWithType:UploadType 17 | localFile:local 18 | remoteFile:remote] autorelease]; 19 | 20 | [transfer setSize: [NSNumber numberWithUnsignedLongLong: [[[NSFileManager defaultManager] fileAttributesAtPath: local 21 | traverseLink: NO] fileSize]]]; 22 | 23 | return transfer; 24 | } 25 | 26 | + (id)downloadFile:(NSString *)remote to:(NSString *)local 27 | { 28 | return [[[FileTransfer alloc] initWithType:DownloadType 29 | localFile:local 30 | remoteFile:remote] autorelease]; 31 | } 32 | 33 | + (id)deleteFile:(NSString *)remote 34 | { 35 | return [[[FileTransfer alloc] initWithType: DeleteType 36 | localFile: nil 37 | remoteFile: remote] autorelease]; 38 | } 39 | 40 | - (id)initWithType:(TransferType)type localFile:(NSString *)local remoteFile:(NSString *)remote 41 | { 42 | [super init]; 43 | _type = type; 44 | _local = [local copy]; 45 | _remote = [remote copy]; 46 | _transferred = [NSNumber numberWithInt: 0]; 47 | return self; 48 | } 49 | 50 | - (void)dealloc 51 | { 52 | [_local release]; 53 | [_remote release]; 54 | [_size release]; 55 | [_percent release]; 56 | [_transferred release]; 57 | [super dealloc]; 58 | } 59 | 60 | - (void)setLocalFile:(NSString *)local 61 | { 62 | [_local autorelease]; 63 | _local = [local copy]; 64 | } 65 | 66 | - (void)setRemoteFile:(NSString *)remote 67 | { 68 | [_remote autorelease]; 69 | _remote = [remote copy]; 70 | } 71 | 72 | - (void)setSize:(NSNumber *)size 73 | { 74 | [_size autorelease]; 75 | _size = [size copy]; 76 | } 77 | 78 | - (void)setPercentTransferred:(NSNumber *)percent 79 | { 80 | [_percent autorelease]; 81 | _percent = [percent copy]; 82 | } 83 | 84 | - (void)setAmountTransferred:(NSNumber *)transferred 85 | { 86 | [_transferred autorelease]; 87 | _transferred = [transferred copy]; 88 | } 89 | 90 | - (NSString *)localFile 91 | { 92 | return _local; 93 | } 94 | 95 | - (NSString *)remoteFile 96 | { 97 | return _remote; 98 | } 99 | 100 | - (NSNumber *)size 101 | { 102 | return _size; 103 | } 104 | 105 | - (NSNumber *)percentTransferred 106 | { 107 | if (_completed) 108 | return [NSNumber numberWithInt:100]; 109 | return _percent; 110 | } 111 | 112 | - (NSNumber *)amountTransferred 113 | { 114 | return _transferred; 115 | } 116 | 117 | - (void)setCompleted:(BOOL)flag 118 | { 119 | _completed = flag; 120 | } 121 | 122 | - (BOOL)isCompleted 123 | { 124 | return _completed; 125 | } 126 | 127 | - (void)setType:(TransferType)type 128 | { 129 | _type = type; 130 | } 131 | 132 | - (TransferType)type 133 | { 134 | return _type; 135 | } 136 | 137 | - (NSString *)description 138 | { 139 | NSMutableString *d = [NSMutableString stringWithString:@"File Transfer\n"]; 140 | [d appendFormat:@"Local File: %@\n", _local]; 141 | [d appendFormat:@"Remote File: %@\n", _remote]; 142 | 143 | if (_type == DownloadType) 144 | [d appendString:@"is Download"]; 145 | else if (_type == UploadType) 146 | [d appendString:@"is Upload"]; 147 | else 148 | [d appendString:@"is Delete"]; 149 | 150 | [d appendFormat:@" transfered: %@\n", [self amountTransferred]]; 151 | 152 | 153 | return d; 154 | } 155 | @end 156 | -------------------------------------------------------------------------------- /Example/Framework Debug.xcconfig: -------------------------------------------------------------------------------- 1 | COPY_PHASE_STRIP = NO 2 | DYLIB_COMPATIBILITY_VERSION = 1 3 | DYLIB_CURRENT_VERSION = 1 4 | FRAMEWORK_VERSION = A 5 | GCC_DYNAMIC_NO_PIC = NO 6 | GCC_ENABLE_FIX_AND_CONTINUE = YES 7 | GCC_ENABLE_OBJC_EXCEPTIONS = YES 8 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 9 | GCC_MODEL_TUNING = G5 10 | GCC_OPTIMIZATION_LEVEL = 0 11 | GCC_PRECOMPILE_PREFIX_HEADER = YES 12 | GCC_PREFIX_HEADER = $(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h 13 | OTHER_LDFLAGS = -framework Foundation -framework AppKit 14 | PREBINDING = NO 15 | PRODUCT_NAME = iMediaBrowser 16 | SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk 17 | ZERO_LINK = YES 18 | -------------------------------------------------------------------------------- /Example/Framework Release.xcconfig: -------------------------------------------------------------------------------- 1 | ARCHS = ppc i386 2 | COPY_PHASE_STRIP = YES 3 | DYLIB_COMPATIBILITY_VERSION = 1 4 | DYLIB_CURRENT_VERSION = 1 5 | FRAMEWORK_VERSION = A 6 | GCC_ENABLE_FIX_AND_CONTINUE = NO 7 | GCC_ENABLE_OBJC_EXCEPTIONS = YES 8 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 9 | GCC_MODEL_TUNING = G5 10 | GCC_PRECOMPILE_PREFIX_HEADER = YES 11 | GCC_PREFIX_HEADER = $(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h 12 | OTHER_LDFLAGS = -framework Foundation -framework AppKit 13 | PREBINDING = NO 14 | SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk 15 | ZERO_LINK = NO 16 | -------------------------------------------------------------------------------- /Example/Framework-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.dlsxtreme.connection 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | FMWK 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /Example/InputDialog.h: -------------------------------------------------------------------------------- 1 | /* InputDialog */ 2 | 3 | #import 4 | 5 | @interface InputDialog : NSObject 6 | { 7 | IBOutlet id input; 8 | IBOutlet id panel; 9 | IBOutlet id title; 10 | 11 | id _del; 12 | SEL _sel; 13 | } 14 | - (id)init; 15 | 16 | - (IBAction)cancel:(id)sender; 17 | - (IBAction)ok:(id)sender; 18 | - (void)setDialogTitle:(NSString *)str; 19 | 20 | //must respond to input: receivedValue: 21 | - (void)beginSheetModalForWindow:(NSWindow *)win delegate:(id)delegate selector:(SEL)sel; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/InputDialog.m: -------------------------------------------------------------------------------- 1 | #import "InputDialog.h" 2 | 3 | @implementation InputDialog 4 | 5 | - (id)init 6 | { 7 | [super init]; 8 | [NSBundle loadNibNamed:@"InputDialog" owner:self]; 9 | return self; 10 | } 11 | 12 | - (IBAction)cancel:(id)sender 13 | { 14 | [panel orderOut:self]; 15 | [NSApp endSheet:panel]; 16 | [_del performSelector:_sel withObject:nil]; 17 | } 18 | 19 | - (IBAction)ok:(id)sender 20 | { 21 | [panel orderOut:self]; 22 | [NSApp endSheet:panel]; 23 | 24 | [_del performSelector:_sel withObject:[input stringValue]]; 25 | } 26 | 27 | - (void)setDialogTitle:(NSString *)str 28 | { 29 | [title setStringValue:str]; 30 | } 31 | 32 | - (void)beginSheetModalForWindow:(NSWindow *)win delegate:(id)delegate selector:(SEL)sel 33 | { 34 | _del = delegate; 35 | _sel = sel; 36 | [NSApp beginSheet:panel 37 | modalForWindow:win 38 | modalDelegate:nil 39 | didEndSelector:nil 40 | contextInfo:nil]; 41 | } 42 | @end 43 | -------------------------------------------------------------------------------- /Example/KTLog Viewer-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeExtensions 11 | 12 | ktlog 13 | 14 | CFBundleTypeName 15 | Log File 16 | CFBundleTypeRole 17 | Viewer 18 | LSTypeIsPackage 19 | 20 | NSPersistentStoreTypeKey 21 | Binary 22 | 23 | 24 | CFBundleExecutable 25 | ${EXECUTABLE_NAME} 26 | CFBundleIconFile 27 | Logs 28 | CFBundleIdentifier 29 | com.utr-software.KTLogViewer 30 | CFBundleInfoDictionaryVersion 31 | 6.0 32 | CFBundlePackageType 33 | APPL 34 | CFBundleSignature 35 | ktlV 36 | CFBundleVersion 37 | 1.0 38 | NSMainNibFile 39 | KTLogViewer 40 | NSPrincipalClass 41 | NSApplication 42 | 43 | 44 | -------------------------------------------------------------------------------- /Example/KTLogController.h: -------------------------------------------------------------------------------- 1 | /* KTLogController */ 2 | 3 | #import 4 | 5 | @interface KTLogController : NSObject 6 | { 7 | IBOutlet NSTableView *oTable; 8 | IBOutlet NSWindow *oWindow; 9 | 10 | NSArray *myEntries; 11 | } 12 | @end 13 | -------------------------------------------------------------------------------- /Example/KTLogController.m: -------------------------------------------------------------------------------- 1 | #import "KTLogController.h" 2 | #import "KTLog.h" 3 | 4 | @interface KTLogLevelTransformer : NSValueTransformer 5 | { 6 | 7 | } 8 | @end 9 | 10 | @interface NSStringToAttributedString : NSValueTransformer 11 | { 12 | 13 | } 14 | @end 15 | 16 | @implementation KTLogController 17 | 18 | + (void)initialize 19 | { 20 | [NSValueTransformer setValueTransformer:[[[KTLogLevelTransformer alloc] init] autorelease] 21 | forName:@"KTLogLevelTransformer"]; 22 | [NSValueTransformer setValueTransformer:[[[NSStringToAttributedString alloc] init] autorelease] 23 | forName:@"NSStringToAttributedString"]; 24 | } 25 | 26 | - (void)awakeFromNib 27 | { 28 | NSString *log = [[NSUserDefaults standardUserDefaults] objectForKey:@"LastOpened"]; 29 | if (log && [[NSFileManager defaultManager] fileExistsAtPath:log]) 30 | { 31 | [self willChangeValueForKey:@"entries"]; 32 | myEntries = [[KTLogger entriesWithLogFile:log] retain]; 33 | [self didChangeValueForKey:@"entries"]; 34 | } 35 | 36 | [[[oTable tableColumnWithIdentifier:@"f"] dataCell] setLineBreakMode: NSLineBreakByTruncatingHead]; 37 | } 38 | 39 | - (NSArray *)entries 40 | { 41 | return myEntries; 42 | } 43 | 44 | - (void)open:(id)sender 45 | { 46 | NSOpenPanel *op = [NSOpenPanel openPanel]; 47 | 48 | [op beginSheetForDirectory:nil 49 | file:nil 50 | types:[NSArray arrayWithObject:@"ktlog"] 51 | modalForWindow:oWindow 52 | modalDelegate:self 53 | didEndSelector:@selector(open:rc:ci:) 54 | contextInfo:nil]; 55 | } 56 | 57 | - (void)open:(NSOpenPanel *)op rc:(int)rc ci:(id)ci 58 | { 59 | if (rc == NSOKButton) 60 | { 61 | [myEntries autorelease]; 62 | [self willChangeValueForKey:@"entries"]; 63 | myEntries = [[KTLogger entriesWithLogFile:[op filename]] retain]; 64 | [self didChangeValueForKey:@"entries"]; 65 | 66 | [[NSUserDefaults standardUserDefaults] setObject:[op filename] forKey:@"LastOpened"]; 67 | [[NSUserDefaults standardUserDefaults] synchronize]; 68 | } 69 | } 70 | 71 | @end 72 | 73 | @implementation NSStringToAttributedString 74 | 75 | + (BOOL)allowsReverseTransformation { return NO; } 76 | 77 | - (id)transformedValue:(id)value 78 | { 79 | return [[[NSAttributedString alloc] initWithString:value] autorelease]; 80 | } 81 | 82 | @end 83 | 84 | @implementation KTLogLevelTransformer 85 | 86 | + (BOOL)allowsReverseTransformation { return NO; } 87 | 88 | - (id)transformedValue:(id)value 89 | { 90 | return [[[KTLogger sharedLogger] levelNames] objectAtIndex:[value intValue]]; 91 | } 92 | 93 | @end 94 | -------------------------------------------------------------------------------- /Example/LeopardFolder.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/LeopardFolder.tiff -------------------------------------------------------------------------------- /Example/Logs.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/Logs.icns -------------------------------------------------------------------------------- /Example/ONBSSLIdentity.h: -------------------------------------------------------------------------------- 1 | // This code derives from Aaron Jacobs's OneButton Socket, which was 2 | // at the time of writing normally licensed under the terms of the 3 | // GNU General Public License. You can find the "standard" version 4 | // in the CVS repository of OneButton FTP (www.onebutton.org). 5 | // 6 | // The SPECIFIC INCARNATION of OneButton Socket upon which this 7 | // code is based was specially distributed to Greg Hulands on 2006-01-05 8 | // under the terms of a modified BSD-style license rather than the GPL. 9 | // This does not indicate that any other version of OneButton Socket 10 | // is or will be distributed under any license but the GPL. 11 | 12 | /* 13 | * Copyright (c) 2005, Aaron Jacobs. 14 | * All rights reserved. 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted provided that the following conditions are met: 17 | * 18 | * * Redistributions of source code must retain the above two paragraph 19 | * note about licensing of OneButton Socket, the above copyright notice, 20 | * this list of conditions and the following disclaimer. 21 | * * Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in the 23 | * documentation and/or other materials provided with the distribution. 24 | * * Neither the name of Aaron Jacobs nor the names of OneButton Socket or 25 | * OneButton FTP may be used to endorse or promote products derived from 26 | * this software without specific prior written permission from Aaron Jacobs. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY AARON JACOBS "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 31 | * EVENT SHALL AARON JACOBS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 32 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 33 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 35 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 36 | * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 37 | * DAMAGE. 38 | */ 39 | 40 | #import 41 | #import 42 | 43 | @interface ONBSSLIdentity : NSObject 44 | { 45 | SecIdentityRef ONB_identity; 46 | } 47 | 48 | // Calls defaultSSLIdentityFromKeychain: with an argument of nil. 49 | + (ONBSSLIdentity *)defaultSSLIdentity; 50 | 51 | // Returns the first SSL identity from the given keychain (or the default keychain 52 | // if nil is given). Returns nil if no such identity could be found. You need only 53 | // specify the keychain's filename, e.g. "login.keychain". 54 | + (ONBSSLIdentity *)defaultSSLIdentityInKeychain:(NSString *)keychainName; 55 | 56 | // Designated initializer 57 | - (id)initWithIdentityRef:(SecIdentityRef)identityRef; 58 | 59 | // It is your responsibility to retain this if you need it. 60 | - (SecIdentityRef)identityRef; 61 | 62 | @end -------------------------------------------------------------------------------- /Example/ONBSSLIdentity.m: -------------------------------------------------------------------------------- 1 | // This code derives from Aaron Jacobs's OneButton Socket, which was 2 | // at the time of writing normally licensed under the terms of the 3 | // GNU General Public License. You can find the "standard" version 4 | // in the CVS repository of OneButton FTP (www.onebutton.org). 5 | // 6 | // The SPECIFIC INCARNATION of OneButton Socket upon which this 7 | // code is based was specially distributed to Greg Hulands on 2006-01-05 8 | // under the terms of a modified BSD-style license rather than the GPL. 9 | // This does not indicate that any other version of OneButton Socket 10 | // is or will be distributed under any license but the GPL. 11 | 12 | /* 13 | * Copyright (c) 2005, Aaron Jacobs. 14 | * All rights reserved. 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted provided that the following conditions are met: 17 | * 18 | * * Redistributions of source code must retain the above two paragraph 19 | * note about licensing of OneButton Socket, the above copyright notice, 20 | * this list of conditions and the following disclaimer. 21 | * * Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in the 23 | * documentation and/or other materials provided with the distribution. 24 | * * Neither the name of Aaron Jacobs nor the names of OneButton Socket or 25 | * OneButton FTP may be used to endorse or promote products derived from 26 | * this software without specific prior written permission from Aaron Jacobs. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY AARON JACOBS "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 31 | * EVENT SHALL AARON JACOBS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 32 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 33 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 35 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 36 | * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 37 | * DAMAGE. 38 | */ 39 | 40 | #import "ONBSSLIdentity.h" 41 | 42 | @implementation ONBSSLIdentity 43 | 44 | - (id)init 45 | { 46 | return [self initWithIdentityRef:nil]; 47 | } 48 | 49 | - (id)initWithIdentityRef:(SecIdentityRef)identityRef 50 | { 51 | if (! (self = [super init])) 52 | return nil; 53 | 54 | ONB_identity = identityRef; 55 | CFRetain(ONB_identity); 56 | 57 | return self; 58 | } 59 | 60 | - (void)dealloc 61 | { 62 | CFRelease(ONB_identity); 63 | [super dealloc]; 64 | } 65 | 66 | + (ONBSSLIdentity *)defaultSSLIdentity 67 | { 68 | return [self defaultSSLIdentityInKeychain:nil]; 69 | } 70 | 71 | + (ONBSSLIdentity *)defaultSSLIdentityInKeychain:(NSString *)keychainName 72 | { 73 | SecKeychainRef keychainRef = nil; 74 | 75 | // If no keychain name was specified, use the default keychain. 76 | if (keychainName) 77 | { 78 | NSString *keychainsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Keychains"]; 79 | NSString *fullPath = [keychainsDirectory stringByAppendingPathComponent:keychainName]; 80 | 81 | if (SecKeychainOpen([fullPath UTF8String], &keychainRef)) 82 | { 83 | NSLog(@"Unable to open keychain"); 84 | return nil; 85 | } 86 | } 87 | 88 | else if (SecKeychainCopyDefault(&keychainRef)) 89 | { 90 | NSLog(@"Unable to get default keychain"); 91 | return nil; 92 | } 93 | 94 | SecIdentitySearchRef searchRef = nil; 95 | if (SecIdentitySearchCreate(keychainRef, CSSM_KEYUSE_SIGN, &searchRef)) 96 | { 97 | NSLog(@"Unable to create keychain search"); 98 | CFRelease(keychainRef); 99 | return nil; 100 | } 101 | 102 | SecIdentityRef identityRef = nil; 103 | if (SecIdentitySearchCopyNext(searchRef, &identityRef)) 104 | { 105 | NSLog(@"Unable to get next search result"); 106 | CFRelease(keychainRef); 107 | CFRelease(searchRef); 108 | return nil; 109 | } 110 | 111 | ONBSSLIdentity *sslIdentity = [[[ONBSSLIdentity alloc] initWithIdentityRef:identityRef] autorelease]; 112 | 113 | CFRelease(keychainRef); 114 | CFRelease(searchRef); 115 | CFRelease(identityRef); 116 | 117 | return sslIdentity; 118 | } 119 | 120 | - (SecIdentityRef)identityRef 121 | { 122 | return ONB_identity; 123 | } 124 | 125 | @end -------------------------------------------------------------------------------- /Example/PermissionsController.h: -------------------------------------------------------------------------------- 1 | /* PermissionsController */ 2 | 3 | #import 4 | 5 | @interface PermissionsController : NSObject 6 | { 7 | IBOutlet id ge; 8 | IBOutlet id gr; 9 | IBOutlet id gw; 10 | IBOutlet id ue; 11 | IBOutlet id ur; 12 | IBOutlet id uw; 13 | IBOutlet id we; 14 | IBOutlet id window; 15 | IBOutlet id wr; 16 | IBOutlet id ww; 17 | 18 | BOOL _needsUpdating; 19 | id _con; 20 | } 21 | + (id)sharedPermissions; 22 | 23 | - (void)displayFile:(NSMutableDictionary *)file sheet:(NSWindow *)win connection:(id)con; 24 | 25 | - (IBAction)attribsChanged:(id)sender; 26 | - (IBAction)cancel:(id)sender; 27 | - (IBAction)save:(id)sender; 28 | @end 29 | -------------------------------------------------------------------------------- /Example/PermissionsController.m: -------------------------------------------------------------------------------- 1 | #import "PermissionsController.h" 2 | 3 | static PermissionsController *_shared = nil; 4 | 5 | @implementation PermissionsController 6 | 7 | - (id)init 8 | { 9 | [super init]; 10 | [NSBundle loadNibNamed:@"Permissions" owner:self]; 11 | return self; 12 | } 13 | 14 | + (id)sharedPermissions 15 | { 16 | if (!_shared) 17 | _shared = [[PermissionsController alloc] init]; 18 | return _shared; 19 | } 20 | 21 | - (void)displayFile:(NSMutableDictionary *)file sheet:(NSWindow *)win connection:(id)con 22 | { 23 | _con = con; 24 | 25 | NSNumber *posix = [file objectForKey:NSFilePosixPermissions]; 26 | NSLog(@"%@: %@", NSStringFromSelector(_cmd), posix); 27 | 28 | [NSApp beginSheet:window 29 | modalForWindow:win 30 | modalDelegate:nil 31 | didEndSelector:nil 32 | contextInfo:nil]; 33 | } 34 | 35 | - (IBAction)attribsChanged:(id)sender 36 | { 37 | _needsUpdating = YES; 38 | } 39 | 40 | - (IBAction)cancel:(id)sender 41 | { 42 | [window orderOut:self]; 43 | [NSApp endSheet:window]; 44 | } 45 | 46 | - (IBAction)save:(id)sender 47 | { 48 | if (_needsUpdating) 49 | { 50 | // [_con setPermissions: forFile:]; 51 | } 52 | [self cancel:self]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Example/ProgressCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressCell.h 3 | // FTPConnection 4 | // 5 | // Created by Greg Hulands on 3/12/04. 6 | // Copyright 2004 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface ProgressCell : NSCell 13 | { 14 | } 15 | 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/ProgressCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressCell.m 3 | // FTPConnection 4 | // 5 | // Created by Greg Hulands on 3/12/04. 6 | // Copyright 2004 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "ProgressCell.h" 10 | 11 | 12 | @implementation ProgressCell 13 | 14 | - (id)initTextCell:(NSString *)txt 15 | { 16 | [super initTextCell:txt]; 17 | [self setObjectValue:[NSNumber numberWithInt:-1]]; 18 | return self; 19 | } 20 | 21 | - (void)setObjectValue:(id)obj 22 | { 23 | [super setObjectValue:obj]; 24 | } 25 | 26 | - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView 27 | { 28 | CGFloat percent = [[self objectValue] intValue] / 100.0; 29 | 30 | if (percent < 0 || percent >= 1) 31 | { 32 | if (percent < 0) 33 | { 34 | NSString *str = nil; 35 | if (percent == -1.0) 36 | { 37 | str = [NSString stringWithString:@"Waiting..."]; 38 | } 39 | else 40 | { 41 | str = [NSString stringWithString:@"Cancelled..."]; 42 | } 43 | 44 | NSDictionary *attribs = [NSDictionary dictionaryWithObjectsAndKeys:nil]; 45 | NSSize size = [str sizeWithAttributes:attribs]; 46 | NSRect centered = NSMakeRect(NSMidX(cellFrame) - (size.width/2), 47 | NSMidY(cellFrame) - (size.height / 2), 48 | NSWidth(cellFrame), 49 | size.height); 50 | [str drawInRect:centered withAttributes:attribs]; 51 | } 52 | else 53 | { 54 | NSString *str = [NSString stringWithString:@"Finished"]; 55 | NSDictionary *attribs = [NSDictionary dictionaryWithObjectsAndKeys:nil]; 56 | NSSize size = [str sizeWithAttributes:attribs]; 57 | NSRect centered = NSMakeRect(NSMidX(cellFrame) - (size.width/2), 58 | NSMidY(cellFrame) - (size.height / 2), 59 | NSWidth(cellFrame), 60 | size.height); 61 | [str drawInRect:centered withAttributes:attribs]; 62 | } 63 | } 64 | else 65 | { 66 | [[NSColor colorWithCalibratedRed:164.0/256.0 green:106.0/256.0 blue:255.0/256.0 alpha:1.0] set]; 67 | NSRectFill(NSMakeRect(NSMinX(cellFrame),NSMinY(cellFrame),percent * NSWidth(cellFrame),NSHeight(cellFrame))); 68 | [[NSColor colorWithCalibratedRed:129.0/256.0 green:84.0/256.0 blue:201.0/256.0 alpha:1.0] set]; 69 | NSFrameRect(cellFrame); 70 | } 71 | 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Example/README: -------------------------------------------------------------------------------- 1 | Notes on Using the Connection Framework 2 | 3 | Dependencies: 4 | 5 | 6 | -------------------------------------------------------------------------------- /Example/ReleaseNotes.txt: -------------------------------------------------------------------------------- 1 | Connection Framework version 3 Release Notes 2 | 3 | There have been quite a few changes to the API so take note when moving to this version. This is mainly in the arguments passed back in the upload/download of the delegate methods. 4 | 5 | What's New 6 | 7 | 1. FTP can now connect to hosts that have multiple DNS names. 8 | 2. FTP has been fully tested. 9 | 3. SFTP support has been added. 10 | 4. WebDav and .Mac support has been added. 11 | 5. File Connection. 12 | 6. New class heirachy. AbstractQueueConnection and StreamBasedConnection makes writing a new connection class very easy. If subclassing from StreamBasedConnection all background threading issues are handled for you and all you have to do is create a state machine for the sending and receiving of commands. If your connection is not state based, then it is suggested not to subclass AbstractConnection, but rather implement the protocol. 13 | 7. Sample application has had more of the delegate methods implemented and better upload/download support. 14 | 15 | All feedback is appreciated. ghulands@framedphotographics.com 16 | 17 | -------------------------------------------------------------------------------- /Example/Stop.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/Stop.tiff -------------------------------------------------------------------------------- /Example/UKKQueue_Symbols: -------------------------------------------------------------------------------- 1 | _UKFileWatcherRenameNotification 2 | _UKFileWatcherLinkCountChangeNotification 3 | _UKFileWatcherDeleteNotification 4 | _UKFileWatcherAccessRevocationNotification 5 | _UKFileWatcherWriteNotification 6 | _UKFileWatcherAttributeChangeNotification 7 | _UKFileWatcherSizeIncreaseNotification 8 | .objc_class_name_UKFNSubscribeFileWatcher 9 | _UKFileSubscriptionProc 10 | .objc_class_name_UKKQueue 11 | .objc_category_name_NSObject_UKMainThreadProxy 12 | .objc_class_name_UKMainThreadProxy 13 | -------------------------------------------------------------------------------- /Example/connect.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/connect.tiff -------------------------------------------------------------------------------- /Example/console.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/console.tiff -------------------------------------------------------------------------------- /Example/da.lproj/DropletLauncher.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | CLASS = DropletLauncherDelegate; 5 | LANGUAGE = ObjC; 6 | SUPERCLASS = NSObject; 7 | }, 8 | { 9 | CLASS = FirstResponder; 10 | LANGUAGE = ObjC; 11 | SUPERCLASS = NSObject; 12 | } 13 | ); 14 | IBVersion = 1; 15 | } -------------------------------------------------------------------------------- /Example/da.lproj/DropletLauncher.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 702 98 356 240 0 0 1920 1178 7 | IBEditorPositions 8 | 9 | 29 10 | 116 400 338 44 0 0 1920 1178 11 | 12 | IBFramework Version 13 | 489.0 14 | IBOldestOS 15 | 4 16 | IBSystem Version 17 | 9C7010 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/da.lproj/DropletLauncher.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/da.lproj/DropletLauncher.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Example/da.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Example/de.lproj/DropletLauncher.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | CLASS = DropletLauncherDelegate; 5 | LANGUAGE = ObjC; 6 | SUPERCLASS = NSObject; 7 | }, 8 | { 9 | CLASS = FirstResponder; 10 | LANGUAGE = ObjC; 11 | SUPERCLASS = NSObject; 12 | } 13 | ); 14 | IBVersion = 1; 15 | } -------------------------------------------------------------------------------- /Example/de.lproj/DropletLauncher.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 415 56 356 240 0 0 1280 778 7 | IBEditorPositions 8 | 9 | 29 10 | 69 259 338 44 0 0 1280 778 11 | 12 | IBFramework Version 13 | 489.0 14 | IBSystem Version 15 | 9E17 16 | IBUsesTextArchiving 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/de.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Example/delete.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/delete.tiff -------------------------------------------------------------------------------- /Example/download.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/download.tif -------------------------------------------------------------------------------- /Example/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/edit.png -------------------------------------------------------------------------------- /Example/en.lproj/Droplet.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = { 5 | cancelPassword = id; 6 | cancelUpload = id; 7 | connectPassword = id; 8 | toggleFiles = id; 9 | }; 10 | CLASS = DropletController; 11 | LANGUAGE = ObjC; 12 | OUTLETS = { 13 | oCancel = NSButton; 14 | oFiles = NSOutlineView; 15 | oPassword = NSTextField; 16 | oPasswordPanel = NSPanel; 17 | oPasswordText = NSTextField; 18 | oProgressBar = NSProgressIndicator; 19 | oStatus = NSTextField; 20 | oToggleFiles = NSButton; 21 | oWindow = NSPanel; 22 | }; 23 | SUPERCLASS = NSObject; 24 | }, 25 | { 26 | CLASS = DropletOutlineView; 27 | LANGUAGE = ObjC; 28 | SUPERCLASS = NSOutlineView; 29 | }, 30 | { 31 | CLASS = DropletPanel; 32 | LANGUAGE = ObjC; 33 | SUPERCLASS = NSPanel; 34 | }, 35 | { 36 | CLASS = FirstResponder; 37 | LANGUAGE = ObjC; 38 | SUPERCLASS = NSObject; 39 | } 40 | ); 41 | IBVersion = 1; 42 | } -------------------------------------------------------------------------------- /Example/en.lproj/Droplet.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 325 154 356 240 0 0 1920 1178 7 | IBFramework Version 8 | 489.0 9 | IBOldestOS 10 | 4 11 | IBSystem Version 12 | 9C7010 13 | 14 | 15 | -------------------------------------------------------------------------------- /Example/en.lproj/Droplet.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/en.lproj/Droplet.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Example/en.lproj/DropletLauncher.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | CLASS = DropletLauncherDelegate; 5 | LANGUAGE = ObjC; 6 | SUPERCLASS = NSObject; 7 | }, 8 | { 9 | CLASS = FirstResponder; 10 | LANGUAGE = ObjC; 11 | SUPERCLASS = NSObject; 12 | } 13 | ); 14 | IBVersion = 1; 15 | } -------------------------------------------------------------------------------- /Example/en.lproj/DropletLauncher.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 702 98 356 240 0 0 1920 1178 7 | IBEditorPositions 8 | 9 | 29 10 | 116 400 338 44 0 0 1920 1178 11 | 12 | IBFramework Version 13 | 489.0 14 | IBOldestOS 15 | 4 16 | IBSystem Version 17 | 9C7010 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/en.lproj/DropletLauncher.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/en.lproj/DropletLauncher.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Example/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Example/en.lproj/InputDialog.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | CLASS = FirstResponder; 5 | LANGUAGE = ObjC; 6 | SUPERCLASS = NSObject; 7 | }, 8 | { 9 | ACTIONS = { 10 | cancel = id; 11 | ok = id; 12 | }; 13 | CLASS = InputDialog; 14 | LANGUAGE = ObjC; 15 | OUTLETS = { 16 | input = id; 17 | panel = id; 18 | title = id; 19 | }; 20 | SUPERCLASS = NSObject; 21 | }, 22 | { 23 | CLASS = "java.lang.Object"; 24 | LANGUAGE = Java; 25 | } 26 | ); 27 | IBVersion = 1; 28 | } -------------------------------------------------------------------------------- /Example/en.lproj/InputDialog.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 160 93 356 240 0 0 1920 1178 7 | IBFramework Version 8 | 489.0 9 | IBOldestOS 10 | 4 11 | IBSystem Version 12 | 9C7010 13 | 14 | 15 | -------------------------------------------------------------------------------- /Example/en.lproj/InputDialog.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/en.lproj/InputDialog.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Example/en.lproj/KTLogViewer.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | CLASS = FirstResponder; 5 | LANGUAGE = ObjC; 6 | SUPERCLASS = NSObject; 7 | }, 8 | { 9 | ACTIONS = { 10 | open = id; 11 | }; 12 | CLASS = KTLogController; 13 | LANGUAGE = ObjC; 14 | OUTLETS = { 15 | oTable = NSTableView; 16 | oWindow = NSWindow; 17 | }; 18 | SUPERCLASS = NSObject; 19 | } 20 | ); 21 | IBVersion = 1; 22 | } -------------------------------------------------------------------------------- /Example/en.lproj/KTLogViewer.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 117 25 356 240 0 0 1920 1178 7 | IBEditorPositions 8 | 9 | 29 10 | 115 400 325 44 0 0 1920 1178 11 | 12 | IBFramework Version 13 | 489.0 14 | IBOldestOS 15 | 4 16 | IBSystem Version 17 | 9C7010 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/en.lproj/KTLogViewer.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/en.lproj/KTLogViewer.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Example/en.lproj/MainMenu.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | ACTIONS = { 5 | cancelConnect = id; 6 | checkForFile = id; 7 | connect = id; 8 | connectionTypeChanged = id; 9 | deleteFile = id; 10 | disconnect = id; 11 | editFile = id; 12 | hostnameChanged = id; 13 | initialDirectoryChanged = id; 14 | localFileSelected = id; 15 | localPopupChanged = id; 16 | logConfig = id; 17 | newCategory = id; 18 | newFolder = id; 19 | newHost = id; 20 | passwordChanged = id; 21 | permissions = id; 22 | portChanged = id; 23 | printQueueDescription = id; 24 | refresh = id; 25 | remoteFileSelected = id; 26 | remotePopupChanged = id; 27 | saveHost = id; 28 | savedHostsChanged = id; 29 | searchChanged = id; 30 | showConnect = id; 31 | stopTransfer = id; 32 | transferSelected = id; 33 | urlChanged = id; 34 | usernameChanged = id; 35 | }; 36 | CLASS = Controller; 37 | LANGUAGE = ObjC; 38 | OUTLETS = { 39 | btnBrowseHost = NSButton; 40 | btnConnect = NSButton; 41 | btnDelete = NSButton; 42 | btnDisconnect = NSButton; 43 | btnEdit = NSButton; 44 | btnNewFolder = NSButton; 45 | btnPermissions = NSButton; 46 | btnRefresh = NSButton; 47 | btnStop = NSButton; 48 | cBtnCancel = NSButton; 49 | cBtnConnect = NSButton; 50 | cHost = NSTextField; 51 | cPass = NSTextField; 52 | cPort = NSTextField; 53 | cTypePopup = NSPopUpButton; 54 | cURL = NSTextField; 55 | cUser = NSTextField; 56 | connectWindow = NSPanel; 57 | fileCheckLog = NSTextView; 58 | initialDirectory = NSTextField; 59 | localBrowserBox = NSBox; 60 | localPopup = NSPopUpButton; 61 | localTable = NSTableView; 62 | log = NSTextView; 63 | logDrawer = NSDrawer; 64 | oConMenu = NSPopUpButton; 65 | remoteBrowserBox = NSBox; 66 | remotePopup = NSPopUpButton; 67 | remoteTable = NSTableView; 68 | savedHosts = id; 69 | status = NSTextField; 70 | transferTable = NSTableView; 71 | window = NSWindow; 72 | }; 73 | SUPERCLASS = NSObject; 74 | }, 75 | { 76 | CLASS = FirstResponder; 77 | LANGUAGE = ObjC; 78 | SUPERCLASS = NSObject; 79 | } 80 | ); 81 | IBVersion = 1; 82 | } -------------------------------------------------------------------------------- /Example/en.lproj/MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 95 807 356 240 0 0 1920 1178 7 | IBEditorPositions 8 | 9 | 29 10 | 1333 989 498 44 0 0 2560 1578 11 | 332 12 | 948 972 664 210 0 0 2560 1578 13 | 14 | IBFramework Version 15 | 489.0 16 | IBOldestOS 17 | 4 18 | IBSystem Version 19 | 9C7010 20 | 21 | 22 | -------------------------------------------------------------------------------- /Example/en.lproj/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/en.lproj/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Example/en.lproj/MainMenu.nib/objects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/en.lproj/MainMenu.nib/objects.nib -------------------------------------------------------------------------------- /Example/en.lproj/Permissions.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | CLASS = FirstResponder; 5 | LANGUAGE = ObjC; 6 | SUPERCLASS = NSObject; 7 | }, 8 | { 9 | ACTIONS = { 10 | attribsChanged = id; 11 | cancel = id; 12 | save = id; 13 | }; 14 | CLASS = PermissionsController; 15 | LANGUAGE = ObjC; 16 | OUTLETS = { 17 | ge = id; 18 | gr = id; 19 | gw = id; 20 | ue = id; 21 | ur = id; 22 | uw = id; 23 | we = id; 24 | window = id; 25 | wr = id; 26 | ww = id; 27 | }; 28 | SUPERCLASS = NSObject; 29 | } 30 | ); 31 | IBVersion = 1; 32 | } -------------------------------------------------------------------------------- /Example/en.lproj/Permissions.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 114 29 356 240 0 0 1920 1178 7 | IBFramework Version 8 | 489.0 9 | IBOldestOS 10 | 4 11 | IBSystem Version 12 | 9C7010 13 | 14 | 15 | -------------------------------------------------------------------------------- /Example/en.lproj/Permissions.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/en.lproj/Permissions.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Example/fr.lproj/DropletLauncher.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = DropletLauncherDelegate; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 5 | ); 6 | IBVersion = 1; 7 | } -------------------------------------------------------------------------------- /Example/fr.lproj/DropletLauncher.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 415 79 356 240 0 0 1280 1002 7 | IBEditorPositions 8 | 9 | 29 10 | 69 338 378 44 0 0 1280 1002 11 | 12 | IBFramework Version 13 | 439.0 14 | IBSystem Version 15 | 8S165 16 | IBUsesTextArchiving 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/fr.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Example/home.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/home.tiff -------------------------------------------------------------------------------- /Example/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/icon.icns -------------------------------------------------------------------------------- /Example/it.lproj/DropletLauncher.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = DropletLauncherDelegate; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 5 | ); 6 | IBVersion = 1; 7 | } -------------------------------------------------------------------------------- /Example/it.lproj/DropletLauncher.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 415 56 356 240 0 0 1280 778 7 | IBEditorPositions 8 | 9 | 29 10 | 69 259 338 44 0 0 1280 778 11 | 12 | IBFramework Version 13 | 437.0 14 | IBSystem Version 15 | 8P135 16 | IBUsesTextArchiving 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/it.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Example/ja.lproj/DropletLauncher.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = DropletLauncherDelegate; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 5 | ); 6 | IBVersion = 1; 7 | } -------------------------------------------------------------------------------- /Example/ja.lproj/DropletLauncher.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 415 56 356 240 0 0 1280 778 7 | IBEditorPositions 8 | 9 | 29 10 | 69 259 338 44 0 0 1280 778 11 | 12 | IBFramework Version 13 | 446.1 14 | IBSystem Version 15 | 8P2137 16 | IBUsesTextArchiving 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/ja.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Example/ktlogviewer_main.m: -------------------------------------------------------------------------------- 1 | // 2 | // ktlogviewer_main.m 3 | // Connection 4 | // 5 | // Created by Greg Hulands on 29/09/06. 6 | // Copyright 2006 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **) argv); 14 | } 15 | -------------------------------------------------------------------------------- /Example/libssh2_config.h: -------------------------------------------------------------------------------- 1 | /* include/libssh2_config.h. Generated by configure. */ 2 | /* include/libssh2_config.h.in. Generated from configure.in by autoheader. */ 3 | 4 | /* Define to 1 if you have the header file. */ 5 | #define HAVE_ERRNO_H 1 6 | 7 | /* Define to 1 if you have the header file. */ 8 | #define HAVE_FCNTL_H 1 9 | 10 | /* Define to 1 if you have the `gettimeofday' function. */ 11 | #define HAVE_GETTIMEOFDAY 1 12 | 13 | /* Define to 1 if you have the header file. */ 14 | #define HAVE_INTTYPES_H 1 15 | 16 | /* Define to 1 if you have the header file. */ 17 | #define HAVE_MEMORY_H 1 18 | 19 | /* Define to 1 if you have the `poll' function. */ 20 | #define HAVE_POLL 1 21 | 22 | /* Define to 1 if you have the `select' function. */ 23 | #define HAVE_SELECT 1 24 | 25 | /* Define to 1 if you have the header file. */ 26 | #define HAVE_STDINT_H 1 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #define HAVE_STDIO_H 1 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #define HAVE_STDLIB_H 1 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #define HAVE_STRINGS_H 1 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #define HAVE_STRING_H 1 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #define HAVE_SYS_SELECT_H 1 42 | 43 | /* Define to 1 if you have the header file. */ 44 | #define HAVE_SYS_STAT_H 1 45 | 46 | /* Define to 1 if you have the header file. */ 47 | #define HAVE_SYS_TYPES_H 1 48 | 49 | /* Define to 1 if you have the header file. */ 50 | #define HAVE_SYS_UIO_H 1 51 | 52 | /* Define to 1 if you have the header file. */ 53 | #define HAVE_UNISTD_H 1 54 | 55 | /* Enable "none" cipher -- NOT RECOMMENDED */ 56 | /* #undef LIBSSH2_CRYPT_NONE */ 57 | 58 | /* Output connection layer debugging info to stderr */ 59 | /* #undef LIBSSH2_DEBUG_CONNECTION */ 60 | //#define LIBSSH2_DEBUG_CONNECTION 61 | 62 | /* Output failure events to stderr */ 63 | /* #undef LIBSSH2_DEBUG_ERRORS */ 64 | 65 | /* Output Key Exchange debugging info to stderr */ 66 | /* #undef LIBSSH2_DEBUG_KEX */ 67 | 68 | /* Output publickey subsystem debugging info to stderr */ 69 | /* #undef LIBSSH2_DEBUG_PUBLICKEY */ 70 | 71 | /* Output scp subsystem debugging info to stderr */ 72 | /* #undef LIBSSH2_DEBUG_SCP */ 73 | 74 | /* Output sftp subsystem debugging info to stderr */ 75 | /* #undef LIBSSH2_DEBUG_SFTP */ 76 | 77 | /* Output transport layer debugging info to stderr */ 78 | /* #undef LIBSSH2_DEBUG_TRANSPORT */ 79 | 80 | /* Output userauth layer debugging info to stderr */ 81 | /* #undef LIBSSH2_DEBUG_USERAUTH */ 82 | 83 | /* Enable newer diffie-hellman-group-exchange-sha1 syntax */ 84 | #define LIBSSH2_DH_GEX_NEW 1 85 | 86 | /* Compile in zlib support */ 87 | #define LIBSSH2_HAVE_ZLIB 1 88 | 89 | /* Enable "none" MAC -- NOT RECOMMENDED */ 90 | /* #undef LIBSSH2_MAC_NONE */ 91 | 92 | /* Define to the address where bug reports for this package should be sent. */ 93 | #define PACKAGE_BUGREPORT "sarag@libssh2.org" 94 | 95 | /* Define to the full name of this package. */ 96 | #define PACKAGE_NAME "libssh2" 97 | 98 | /* Define to the full name and version of this package. */ 99 | #define PACKAGE_STRING "libssh2 0.14" 100 | 101 | /* Define to the one symbol short name of this package. */ 102 | #define PACKAGE_TARNAME "libssh2" 103 | 104 | /* Define to the version of this package. */ 105 | #define PACKAGE_VERSION "0.14" 106 | 107 | /* Define to 1 if you have the ANSI C header files. */ 108 | #define STDC_HEADERS 1 109 | 110 | /* Define to 1 if your processor stores words with the most significant byte 111 | first (like Motorola and SPARC, unlike Intel and VAX). */ 112 | #define WORDS_BIGENDIAN 1 113 | 114 | /* Define to empty if `const' does not conform to ANSI C. */ 115 | /* #undef const */ 116 | -------------------------------------------------------------------------------- /Example/libssh2_publickey.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2004-2006, Sara Golemon 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, 5 | * with or without modification, are permitted provided 6 | * that the following conditions are met: 7 | * 8 | * Redistributions of source code must retain the above 9 | * copyright notice, this list of conditions and the 10 | * following disclaimer. 11 | * 12 | * Redistributions in binary form must reproduce the above 13 | * copyright notice, this list of conditions and the following 14 | * disclaimer in the documentation and/or other materials 15 | * provided with the distribution. 16 | * 17 | * Neither the name of the copyright holder nor the names 18 | * of any other contributors may be used to endorse or 19 | * promote products derived from this software without 20 | * specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 24 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 27 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 33 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 34 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 35 | * OF SUCH DAMAGE. 36 | */ 37 | 38 | /* Note: This include file is only needed for using the 39 | * publickey SUBSYSTEM which is not the same as publickey 40 | * authentication. For authentication you only need libssh2.h 41 | * 42 | * For more information on the publickey subsystem, 43 | * refer to IETF draft: secsh-publickey 44 | */ 45 | 46 | #ifndef LIBSSH2_PUBLICKEY_H 47 | #define LIBSSH2_PUBLICKEY_H 1 48 | 49 | typedef struct _LIBSSH2_PUBLICKEY LIBSSH2_PUBLICKEY; 50 | 51 | typedef struct _libssh2_publickey_attribute { 52 | char *name; 53 | unsigned long name_len; 54 | char *value; 55 | unsigned long value_len; 56 | char mandatory; 57 | } libssh2_publickey_attribute; 58 | 59 | typedef struct _libssh2_publickey_list { 60 | unsigned char *packet; /* For freeing */ 61 | 62 | unsigned char *name; 63 | unsigned long name_len; 64 | unsigned char *blob; 65 | unsigned long blob_len; 66 | unsigned long num_attrs; 67 | libssh2_publickey_attribute *attrs; /* free me */ 68 | } libssh2_publickey_list; 69 | 70 | /* Generally use the first macro here, but if both name and value are string literals, you can use _fast() to take advantage of preprocessing */ 71 | #define libssh2_publickey_attribute(name, value, mandatory) { (name), strlen(name), (value), strlen(value), (mandatory) }, 72 | #define libssh2_publickey_attribute_fast(name, value, mandatory) { (name), sizeof(name) - 1, (value), sizeof(value) - 1, (mandatory) }, 73 | 74 | #ifdef __cplusplus 75 | extern "C" { 76 | #endif 77 | 78 | /* Publickey Subsystem */ 79 | LIBSSH2_API LIBSSH2_PUBLICKEY *libssh2_publickey_init(LIBSSH2_SESSION *session); 80 | 81 | LIBSSH2_API int libssh2_publickey_add_ex(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name, unsigned long name_len, 82 | const unsigned char *blob, unsigned long blob_len, char overwrite, 83 | unsigned long num_attrs, libssh2_publickey_attribute attrs[]); 84 | #define libssh2_publickey_add(pkey, name, blob, blob_len, overwrite, num_attrs, attrs) \ 85 | libssh2_publickey_add_ex((pkey), (name), strlen(name), (blob), (blob_len), (overwrite), (num_attrs), (attrs)) 86 | 87 | LIBSSH2_API int libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name, unsigned long name_len, 88 | const unsigned char *blob, unsigned long blob_len); 89 | #define libssh2_publickey_remove(pkey, name, blob, blob_len) \ 90 | libssh2_publickey_remove_ex((pkey), (name), strlen(name), (blob), (blob_len)) 91 | 92 | LIBSSH2_API int libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY *pkey, unsigned long *num_keys, libssh2_publickey_list **pkey_list); 93 | LIBSSH2_API void libssh2_publickey_list_free(LIBSSH2_PUBLICKEY *pkey, libssh2_publickey_list *pkey_list); 94 | 95 | LIBSSH2_API void libssh2_publickey_shutdown(LIBSSH2_PUBLICKEY *pkey); 96 | 97 | #ifdef __cplusplus 98 | } /* extern "C" */ 99 | #endif 100 | 101 | #endif /* ndef: LIBSSH2_PUBLICKEY_H */ 102 | -------------------------------------------------------------------------------- /Example/lock.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/lock.tiff -------------------------------------------------------------------------------- /Example/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FTPConnection 4 | // 5 | // Created by Greg Hulands on 3/12/04. 6 | // Copyright __MyCompanyName__ 2004. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **) argv); 14 | } 15 | -------------------------------------------------------------------------------- /Example/network_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/network_icon.png -------------------------------------------------------------------------------- /Example/redo.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/redo.tif -------------------------------------------------------------------------------- /Example/symlink_file.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/symlink_file.tif -------------------------------------------------------------------------------- /Example/symlink_folder.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/symlink_folder.tif -------------------------------------------------------------------------------- /Example/unit test/09 moustik.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/unit test/09 moustik.mp3 -------------------------------------------------------------------------------- /Example/upload.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Example/upload.tif -------------------------------------------------------------------------------- /Example/version.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildVersion 6 | 92 7 | CFBundleVersion 8 | 1.0 9 | ProductBuildVersion 10 | 7K571 11 | ProjectName 12 | NibPBTemplates 13 | SourceVersion 14 | 1200000 15 | 16 | 17 | -------------------------------------------------------------------------------- /Example/zh_CN.lproj/DropletLauncher.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | {CLASS = DropletLauncherDelegate; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 4 | {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; } 5 | ); 6 | IBVersion = 1; 7 | } -------------------------------------------------------------------------------- /Example/zh_CN.lproj/DropletLauncher.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 415 56 356 240 0 0 1280 778 7 | IBEditorPositions 8 | 9 | 29 10 | 69 259 338 44 0 0 1280 778 11 | 12 | IBFramework Version 13 | 446.1 14 | IBSystem Version 15 | 8S165 16 | IBUsesTextArchiving 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/zh_CN.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Example/zh_TW.lproj/DropletLauncher.nib/classes.nib: -------------------------------------------------------------------------------- 1 | { 2 | IBClasses = ( 3 | { 4 | CLASS = DropletLauncherDelegate; 5 | LANGUAGE = ObjC; 6 | SUPERCLASS = NSObject; 7 | }, 8 | { 9 | CLASS = FirstResponder; 10 | LANGUAGE = ObjC; 11 | SUPERCLASS = NSObject; 12 | } 13 | ); 14 | IBVersion = 1; 15 | } -------------------------------------------------------------------------------- /Example/zh_TW.lproj/DropletLauncher.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBDocumentLocation 6 | 415 56 356 240 0 0 1280 778 7 | IBEditorPositions 8 | 9 | 29 10 | 69 259 338 44 0 0 1280 778 11 | 12 | IBFramework Version 13 | 489.0 14 | IBSystem Version 15 | 9D34 16 | IBUsesTextArchiving 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/zh_TW.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Framework Debug.xcconfig: -------------------------------------------------------------------------------- 1 | COPY_PHASE_STRIP = NO 2 | DYLIB_COMPATIBILITY_VERSION = 1 3 | DYLIB_CURRENT_VERSION = 1 4 | FRAMEWORK_VERSION = A 5 | GCC_DYNAMIC_NO_PIC = NO 6 | GCC_ENABLE_FIX_AND_CONTINUE = YES 7 | GCC_ENABLE_OBJC_EXCEPTIONS = YES 8 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 9 | GCC_MODEL_TUNING = G5 10 | GCC_OPTIMIZATION_LEVEL = 0 11 | GCC_PRECOMPILE_PREFIX_HEADER = YES 12 | GCC_PREFIX_HEADER = $(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h 13 | OTHER_LDFLAGS = -framework Foundation -framework AppKit 14 | PREBINDING = NO 15 | PRODUCT_NAME = iMediaBrowser 16 | SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk 17 | ZERO_LINK = YES 18 | -------------------------------------------------------------------------------- /Framework Release.xcconfig: -------------------------------------------------------------------------------- 1 | ARCHS = ppc i386 2 | COPY_PHASE_STRIP = YES 3 | DYLIB_COMPATIBILITY_VERSION = 1 4 | DYLIB_CURRENT_VERSION = 1 5 | FRAMEWORK_VERSION = A 6 | GCC_ENABLE_FIX_AND_CONTINUE = NO 7 | GCC_ENABLE_OBJC_EXCEPTIONS = YES 8 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 9 | GCC_MODEL_TUNING = G5 10 | GCC_PRECOMPILE_PREFIX_HEADER = YES 11 | GCC_PREFIX_HEADER = $(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h 12 | OTHER_LDFLAGS = -framework Foundation -framework AppKit 13 | PREBINDING = NO 14 | SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk 15 | ZERO_LINK = NO 16 | -------------------------------------------------------------------------------- /ProfilingTester/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ProfilingTester 4 | // 5 | // Created by Sam Deane on 27/03/2013. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ProfilingTester/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ProfilingTester 4 | // 5 | // Created by Sam Deane on 27/03/2013. 6 | // 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import 11 | 12 | @implementation AppDelegate 13 | 14 | - (void)dealloc 15 | { 16 | [super dealloc]; 17 | } 18 | 19 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 20 | { 21 | // Insert code here to initialize your application 22 | 23 | CK2FileManager* fm = [[CK2FileManager alloc] init]; 24 | 25 | for (NSUInteger n = 0; n < 100; ++n) 26 | { 27 | NSURL* url = [NSURL URLWithString:@"ftp://test:test@ftp.secureftp-test.com/"]; 28 | 29 | [fm contentsOfDirectoryAtURL:url includingPropertiesForKeys:@[] options:NSDirectoryEnumerationSkipsHiddenFiles completionHandler:^(NSArray *contents, NSError *error) { 30 | NSLog(@"contents: %@ error: %@", contents, error); 31 | }]; 32 | } 33 | 34 | [fm release]; 35 | 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /ProfilingTester/ProfilingTester-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /ProfilingTester/ProfilingTester-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'ProfilingTester' target in the 'ProfilingTester' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /ProfilingTester/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /ProfilingTester/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /ProfilingTester/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ProfilingTester 4 | // 5 | // Created by Sam Deane on 27/03/2013. 6 | // 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /Resources/Framework-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | FMWK 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /Resources/bookmark.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Resources/bookmark.tif -------------------------------------------------------------------------------- /Resources/da.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Resources/de.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Resources/de.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* authorise */ 2 | "%@\nWhat would you like to do?" = "%@\nWas möchten Sie tun?"; 3 | 4 | /* ConnectionOpenPanel */ 5 | "An unknown error occurred." = "Ein unbekannter Fehler ist aufgetreten. "; 6 | 7 | /* close window */ 8 | "Are you sure you want to stop the upload?" = "Wollen Sie die Übertragung wirklich stoppen?"; 9 | 10 | /* authorise */ 11 | "Authorize" = "Autorisieren"; 12 | 13 | /* authorise */ 14 | "Authorize Connection?" = "Verbindung autorisieren?"; 15 | 16 | /* config */ 17 | "Bad Configuration" = "Falsche Konfiguration"; 18 | 19 | /* error */ 20 | "Bad Droplet" = "Falsches Droplet"; 21 | 22 | /* filesize: bytes */ 23 | "bytes" = "Byte"; 24 | 25 | /* authorise */ 26 | "Cancel" = "Abbrechen"; 27 | 28 | /* connected message */ 29 | "Connected to %@" = "Verbunden mit %@"; 30 | 31 | /* connection string */ 32 | "Connecting to %@" = "Mit %@ verbinden"; 33 | 34 | /* close window */ 35 | "Continue Upload" = "Übertragung fortsetzen"; 36 | 37 | /* config */ 38 | "Couldn't find configuration file specified\n %@" = "Konnte angegebene Konfigurationsdatei nicht finden\n %@"; 39 | 40 | /* status */ 41 | "Disconnected" = "Getrennt"; 42 | 43 | /* filesize: exabytes */ 44 | "EB" = "EB"; 45 | 46 | /* filesize: gigabytes */ 47 | "GB" = "GB"; 48 | 49 | /* filesize: kilobytes */ 50 | "KB" = "KB"; 51 | 52 | /* FTP download error */ 53 | "Local File already exists" = "Lokale Datei existiert bereits"; 54 | 55 | /* filesize: megabytes */ 56 | "MB" = "MB"; 57 | 58 | /* config */ 59 | "No configuration file specified" = "Keine Konfigurationsdatei angegeben"; 60 | 61 | /* failed to find a connection class */ 62 | "No connection available for requested connection type" = "Keine verfügbare Verbindung für gewählte Verbindungsart"; 63 | 64 | /* filesize: petabytes */ 65 | "PB" = "PB"; 66 | 67 | /* ConnectionOpenPanel */ 68 | "Please check your settings." = "Bitte prüfen Sie Ihre Einstellungen."; 69 | 70 | /* config 71 | error */ 72 | 73 | "Quit" = "Beenden"; 74 | 75 | /* close window */ 76 | "Stop Upload" = "Übertragung stoppen"; 77 | 78 | /* close window */ 79 | "Stop Upload?" = "Übertragung stoppen?"; 80 | 81 | /* filesize: terabytes */ 82 | "TB" = "TB"; 83 | 84 | /* error */ 85 | "This droplet is missing the original application that created it. You will need to reinstall the original application." = "Diesem Droplet fehlt das Originalprogramm mit welchem es erstellt wurden. Bitte reinstallieren Sie das Originalprogramm."; 86 | 87 | /* status */ 88 | "Uploading %@" = "Hochladen von %@"; -------------------------------------------------------------------------------- /Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* authorise */ 2 | "%@\nWhat would you like to do?" = "%@\nWhat would you like to do?"; 3 | 4 | /* ConnectionOpenPanel */ 5 | "An unknown error occurred." = "An unknown error occurred."; 6 | 7 | /* close window */ 8 | "Are you sure you want to stop the upload?" = "Are you sure you want to stop the upload?"; 9 | 10 | /* authorise */ 11 | "Authorize" = "Authorize"; 12 | 13 | /* authorise */ 14 | "Authorize Connection?" = "Authorize Connection?"; 15 | 16 | /* config */ 17 | "Bad Configuration" = "Bad Configuration"; 18 | 19 | /* error */ 20 | "Bad Droplet" = "Bad Droplet"; 21 | 22 | /* filesize: bytes */ 23 | "bytes" = "bytes"; 24 | 25 | /* authorise */ 26 | "Cancel" = "Cancel"; 27 | 28 | /* connected message */ 29 | "Connected to %@" = "Connected to %@"; 30 | 31 | /* connection string */ 32 | "Connecting to %@" = "Connecting to %@"; 33 | 34 | /* close window */ 35 | "Continue Upload" = "Continue Upload"; 36 | 37 | /* config */ 38 | "Couldn't find configuration file specified\n %@" = "Couldn't find configuration file specified\n %@"; 39 | 40 | /* status */ 41 | "Disconnected" = "Disconnected"; 42 | 43 | /* filesize: exabytes */ 44 | "EB" = "EB"; 45 | 46 | /* filesize: gigabytes */ 47 | "GB" = "GB"; 48 | 49 | /* filesize: kilobytes */ 50 | "KB" = "KB"; 51 | 52 | /* FTP download error */ 53 | "Local File already exists" = "Local File already exists"; 54 | 55 | /* filesize: megabytes */ 56 | "MB" = "MB"; 57 | 58 | /* config */ 59 | "No configuration file specified" = "No configuration file specified"; 60 | 61 | /* failed to find a connection class */ 62 | "No connection available for requested connection type" = "No connection available for requested connection type"; 63 | 64 | /* filesize: petabytes */ 65 | "PB" = "PB"; 66 | 67 | /* ConnectionOpenPanel */ 68 | "Please check your settings." = "Please check your settings."; 69 | 70 | /* config 71 | error */ 72 | "Quit" = "Quit"; 73 | 74 | /* close window */ 75 | "Stop Upload" = "Stop Upload"; 76 | 77 | /* close window */ 78 | "Stop Upload?" = "Stop Upload?"; 79 | 80 | /* filesize: terabytes */ 81 | "TB" = "TB"; 82 | 83 | /* error */ 84 | "This droplet is missing the original application that created it. You will need to reinstall the original application." = "This droplet is missing the original application that created it. You will need to reinstall the original application."; 85 | 86 | /* status */ 87 | "Uploading %@" = "Uploading %@"; 88 | 89 | -------------------------------------------------------------------------------- /Resources/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Resources/error.png -------------------------------------------------------------------------------- /Resources/es.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* authorise */ 2 | "%@\nWhat would you like to do?" = "%@\n¿Qué desea hacer?"; 3 | 4 | /* ConnectionOpenPanel */ 5 | "An unknown error occurred." = "Se ha producido un error desconocido."; 6 | 7 | /* close window */ 8 | "Are you sure you want to stop the upload?" = "¿Está seguro que desea detener la carga del archivo en el servidor?"; 9 | 10 | /* authorise */ 11 | "Authorize" = "Autorizar"; 12 | 13 | /* authorise */ 14 | "Authorize Connection?" = "¿Autorizar conexión?"; 15 | 16 | /* config */ 17 | "Bad Configuration" = "Error de configuración"; 18 | 19 | /* error */ 20 | "Bad Droplet" = "Gotero dañado"; 21 | 22 | /* filesize: bytes */ 23 | "bytes" = "bytes"; 24 | 25 | /* authorise */ 26 | "Cancel" = "Cancelar"; 27 | 28 | /* connected message */ 29 | "Connected to %@" = "Conectado a %@"; 30 | 31 | /* connection string */ 32 | "Connecting to %@" = "Conectado a %@"; 33 | 34 | /* close window */ 35 | "Continue Upload" = "Continuar la carga del archivo."; 36 | 37 | /* config */ 38 | "Couldn't find configuration file specified\n %@" = "No se pudo encontrar el archivo de configuración especificado\n %@"; 39 | 40 | /* status */ 41 | "Disconnected" = "Desconectado"; 42 | 43 | /* filesize: exabytes */ 44 | "EB" = "EB"; 45 | 46 | /* filesize: gigabytes */ 47 | "GB" = "GB"; 48 | 49 | /* filesize: kilobytes */ 50 | "KB" = "KB"; 51 | 52 | /* FTP download error */ 53 | "Local File already exists" = "El archivo local ya existe"; 54 | 55 | /* filesize: megabytes */ 56 | "MB" = "MB"; 57 | 58 | /* config */ 59 | "No configuration file specified" = "No se especificó un archivo de configuración"; 60 | 61 | /* failed to find a connection class */ 62 | "No connection available for requested connection type" = "No hay una conexión disponible para el tipo requerido"; 63 | 64 | /* filesize: petabytes */ 65 | "PB" = "PB"; 66 | 67 | /* ConnectionOpenPanel */ 68 | "Please check your settings." = "Por favor, revise su configuración."; 69 | 70 | /* config 71 | error */ 72 | 73 | "Quit" = "Salir"; 74 | 75 | /* close window */ 76 | "Stop Upload" = "Detener la carga del archivo"; 77 | 78 | /* close window */ 79 | "Stop Upload?" = "¿Detener la carga?"; 80 | 81 | /* filesize: terabytes */ 82 | "TB" = "TB"; 83 | 84 | /* error */ 85 | "This droplet is missing the original application that created it. You will need to reinstall the original application." = "Este gotero no encuentra la aplicación original con el que fue creado; necesitará reinstalarla."; 86 | 87 | /* status */ 88 | "Uploading %@" = "Cargando %@"; -------------------------------------------------------------------------------- /Resources/finished.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/Resources/finished.png -------------------------------------------------------------------------------- /Resources/fr.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Resources/fr.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* authorise */ 2 | "%@\nWhat would you like to do?" = "%@\nQue désirez-vous faire ?"; 3 | 4 | /* ConnectionOpenPanel */ 5 | "An unknown error occurred." = "Une erreur inconnue s'est produite."; 6 | 7 | /* close window */ 8 | "Are you sure you want to stop the upload?" = "Êtes-vous sûr de vouloir arrêter le chargement ?"; 9 | 10 | /* authorise */ 11 | "Authorize" = "Autoriser"; 12 | 13 | /* authorise */ 14 | "Authorize Connection?" = "Autoriser la connexion ?"; 15 | 16 | /* config */ 17 | "Bad Configuration" = "Mauvaise configuration"; 18 | 19 | /* error */ 20 | "Bad Droplet" = "Mauvaise 'droplet'"; 21 | 22 | /* filesize: bytes */ 23 | "bytes" = "octets"; 24 | 25 | /* authorise */ 26 | "Cancel" = "Annuler"; 27 | 28 | /* connected message */ 29 | "Connected to %@" = "Connecté à %@"; 30 | 31 | /* connection string */ 32 | "Connecting to %@" = "Se connecte à %@"; 33 | 34 | /* close window */ 35 | "Continue Upload" = "Continuer le chargement"; 36 | 37 | /* config */ 38 | "Couldn't find configuration file specified\n %@" = "N'a pu trouver le fichier de configuration indiqué\n %@"; 39 | 40 | /* status */ 41 | "Disconnected" = "Déconnecté"; 42 | 43 | /* filesize: exabytes */ 44 | "EB" = "Eo"; 45 | 46 | /* filesize: gigabytes */ 47 | "GB" = "Go"; 48 | 49 | /* filesize: kilobytes */ 50 | "KB" = "ko"; 51 | 52 | /* FTP download error */ 53 | "Local File already exists" = "Le fichier local existe déjà"; 54 | 55 | /* filesize: megabytes */ 56 | "MB" = "Mo"; 57 | 58 | /* config */ 59 | "No configuration file specified" = "Aucun fichier de configuration indiqué"; 60 | 61 | /* failed to find a connection class */ 62 | "No connection available for requested connection type" = "Aucune connexion disponible pour le type de connexion demandé"; 63 | 64 | /* filesize: petabytes */ 65 | "PB" = "Po"; 66 | 67 | /* ConnectionOpenPanel */ 68 | "Please check your settings." = "Veuillez vérifiez vos réglages."; 69 | 70 | /* config 71 | error */ 72 | 73 | "Quit" = "Quitter"; 74 | 75 | /* close window */ 76 | "Stop Upload" = "Arrêter le chargement"; 77 | 78 | /* close window */ 79 | "Stop Upload?" = "Arrêter le chargement ?"; 80 | 81 | /* filesize: terabytes */ 82 | "TB" = "To"; 83 | 84 | /* error */ 85 | "This droplet is missing the original application that created it. You will need to reinstall the original application." = "Il manque à cette droplet l'application originale qui l'a créée. Vous devrez réinstaller l'application originale."; 86 | 87 | /* status */ 88 | "Uploading %@" = "Chargement de %@"; -------------------------------------------------------------------------------- /Resources/it.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Resources/it.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* authorise */ 2 | "%@\nWhat would you like to do?" = "%@\nChe cosa ti piacerebbe fare?"; 3 | 4 | /* ConnectionOpenPanel */ 5 | "An unknown error occurred." = "Si è verificato un errore sconosciuto."; 6 | 7 | /* close window */ 8 | "Are you sure you want to stop the upload?" = "Sei sicuro di voler interrompere il caricamento?"; 9 | 10 | /* authorise */ 11 | "Authorize" = "Autorizza"; 12 | 13 | /* authorise */ 14 | "Authorize Connection?" = "Autorizza connessione?"; 15 | 16 | /* config */ 17 | "Bad Configuration" = "Configurazione errata"; 18 | 19 | /* error */ 20 | "Bad Droplet" = "Droplet errato"; 21 | 22 | /* filesize: bytes */ 23 | "bytes" = "byte"; 24 | 25 | /* authorise */ 26 | "Cancel" = "Annulla"; 27 | 28 | /* connected message */ 29 | "Connected to %@" = "Connesso a %@"; 30 | 31 | /* connection string */ 32 | "Connecting to %@" = "Connessione a %@"; 33 | 34 | /* close window */ 35 | "Continue Upload" = "Continua caricamento"; 36 | 37 | /* config */ 38 | "Couldn't find configuration file specified\n %@" = "Impossibile trovare il file di configurazione specificato\n %@"; 39 | 40 | /* status */ 41 | "Disconnected" = "Disconnesso"; 42 | 43 | /* filesize: exabytes */ 44 | "EB" = "EB"; 45 | 46 | /* filesize: gigabytes */ 47 | "GB" = "GB"; 48 | 49 | /* filesize: kilobytes */ 50 | "KB" = "KB"; 51 | 52 | /* FTP download error */ 53 | "Local File already exists" = "Il file locale esiste già"; 54 | 55 | /* filesize: megabytes */ 56 | "MB" = "MB"; 57 | 58 | /* config */ 59 | "No configuration file specified" = "Non è stato specificato nessun file di configurazione"; 60 | 61 | /* failed to find a connection class */ 62 | "No connection available for requested connection type" = "Nessuna connessione è disponibile per il tipo di connessione richiesto"; 63 | 64 | /* filesize: petabytes */ 65 | "PB" = "PB"; 66 | 67 | /* ConnectionOpenPanel */ 68 | "Please check your settings." = "Verifica le tue impostazioni."; 69 | 70 | /* config 71 | error */ 72 | 73 | "Quit" = "Esci"; 74 | 75 | /* close window */ 76 | "Stop Upload" = "Interrompi caricamento"; 77 | 78 | /* close window */ 79 | "Stop Upload?" = "Interrompere caricamento?"; 80 | 81 | /* filesize: terabytes */ 82 | "TB" = "TB"; 83 | 84 | /* error */ 85 | "This droplet is missing the original application that created it. You will need to reinstall the original application." = "Il droplet ha perduto la connessione con l'applicazione che l'ha creato. Dovrai reinstallare l'applicazione originale."; 86 | 87 | /* status */ 88 | "Uploading %@" = "Sto caricando %@"; -------------------------------------------------------------------------------- /Resources/ja.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Resources/ja.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* authorise */ 2 | "%@\nWhat would you like to do?" = "%@\nどうしますか?"; 3 | 4 | /* ConnectionOpenPanel */ 5 | "An unknown error occurred." = "不明なエラーが発生しました。"; 6 | 7 | /* close window */ 8 | "Are you sure you want to stop the upload?" = "アップロードを中断してもよろしいですか?"; 9 | 10 | /* authorise */ 11 | "Authorize" = "認証"; 12 | 13 | /* authorise */ 14 | "Authorize Connection?" = "接続を承認しますか?"; 15 | 16 | /* config */ 17 | "Bad Configuration" = "設定が悪い"; 18 | 19 | /* error */ 20 | "Bad Droplet" = "ドロップレットが悪い"; 21 | 22 | /* filesize: bytes */ 23 | "bytes" = "バイト"; 24 | 25 | /* authorise */ 26 | "Cancel" = "キャンセル"; 27 | 28 | /* connected message */ 29 | "Connected to %@" = "%@ に接続"; 30 | 31 | /* connection string */ 32 | "Connecting to %@" = "%@ に接続中"; 33 | 34 | /* close window */ 35 | "Continue Upload" = "アップロードを継続"; 36 | 37 | /* config */ 38 | "Couldn't find configuration file specified\n %@" = "指定した設定ファイルが見つかりませんでした\n %@"; 39 | 40 | /* status */ 41 | "Disconnected" = "切断"; 42 | 43 | /* filesize: exabytes */ 44 | "EB" = "EB"; 45 | 46 | /* filesize: gigabytes */ 47 | "GB" = "GB"; 48 | 49 | /* filesize: kilobytes */ 50 | "KB" = "KB"; 51 | 52 | /* FTP download error */ 53 | "Local File already exists" = "このローカルファイルはすでに存在します"; 54 | 55 | /* filesize: megabytes */ 56 | "MB" = "MB"; 57 | 58 | /* config */ 59 | "No configuration file specified" = "設定ファイルが指定されていません"; 60 | 61 | /* failed to find a connection class */ 62 | "No connection available for requested connection type" = "この接続タイプは有効ではありません"; 63 | 64 | /* filesize: petabytes */ 65 | "PB" = "PB"; 66 | 67 | /* ConnectionOpenPanel */ 68 | "Please check your settings." = "設定を確認して下さい。"; 69 | 70 | /* config 71 | error */ 72 | 73 | "Quit" = "終了"; 74 | 75 | /* close window */ 76 | "Stop Upload" = "アップロードを停止"; 77 | 78 | /* close window */ 79 | "Stop Upload?" = "アップロードを停止しますか?"; 80 | 81 | /* filesize: terabytes */ 82 | "TB" = "TB"; 83 | 84 | /* error */ 85 | "This droplet is missing the original application that created it. You will need to reinstall the original application." = "ドロップレットを作成したときのアプリケーションがありません。そのアプリケーションを再インストールする必要があります。"; 86 | 87 | /* status */ 88 | "Uploading %@" = "%@ をアップロード中"; -------------------------------------------------------------------------------- /Resources/pt_BR.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* authorise */ 2 | "%@\nWhat would you like to do?" = "%@\nO que você gostaria de fazer?"; 3 | 4 | /* ConnectionOpenPanel */ 5 | "An unknown error occurred." = "Ocorreu um erro desconhecido."; 6 | 7 | /* close window */ 8 | "Are you sure you want to stop the upload?" = "Você deseja realmente suspender o envio?"; 9 | 10 | /* authorise */ 11 | "Authorize" = "Autorizar"; 12 | 13 | /* authorise */ 14 | "Authorize Connection?" = "Autorizar Conexão?"; 15 | 16 | /* config */ 17 | "Bad Configuration" = "Configuração Errada"; 18 | 19 | /* error */ 20 | "Bad Droplet" = "Droplet Danificado"; 21 | 22 | /* filesize: bytes */ 23 | "bytes" = "bytes"; 24 | 25 | /* authorise */ 26 | "Cancel" = "Cancelar"; 27 | 28 | /* connected message */ 29 | "Connected to %@" = "Conectado a %@"; 30 | 31 | /* connection string */ 32 | "Connecting to %@" = "Conectando a %@"; 33 | 34 | /* close window */ 35 | "Continue Upload" = "Continuar Enviando"; 36 | 37 | /* config */ 38 | "Couldn't find configuration file specified\n %@" = "Não foi possível encontrar a configuração do arquivo especificado\n %@"; 39 | 40 | /* status */ 41 | "Disconnected" = "Desconectado"; 42 | 43 | /* filesize: exabytes */ 44 | "EB" = "EB"; 45 | 46 | /* filesize: gigabytes */ 47 | "GB" = "GB"; 48 | 49 | /* filesize: kilobytes */ 50 | "KB" = "KB"; 51 | 52 | /* FTP download error */ 53 | "Local File already exists" = "O Arquivo Local já existe"; 54 | 55 | /* filesize: megabytes */ 56 | "MB" = "MB"; 57 | 58 | /* config */ 59 | "No configuration file specified" = "Nenhum arquivo de configuração especificado"; 60 | 61 | /* failed to find a connection class */ 62 | "No connection available for requested connection type" = "Nenhuma conexão disponível para o tipo de conexão exigida"; 63 | 64 | /* filesize: petabytes */ 65 | "PB" = "PB"; 66 | 67 | /* ConnectionOpenPanel */ 68 | "Please check your settings." = "Por favor, verifique suas configurações."; 69 | 70 | /* config 71 | error */ 72 | 73 | "Quit" = "Encerrar"; 74 | 75 | /* close window */ 76 | "Stop Upload" = "Suspender o Envio"; 77 | 78 | /* close window */ 79 | "Stop Upload?" = "Suspender o Envio?"; 80 | 81 | /* filesize: terabytes */ 82 | "TB" = "TB"; 83 | 84 | /* error */ 85 | "This droplet is missing the original application that created it. You will need to reinstall the original application." = "Este droplet está faltando ao aplicativo original no qual foi criado. Você precisa reinstalar o aplicativo original."; 86 | 87 | /* status */ 88 | "Uploading %@" = "Enviando %@"; -------------------------------------------------------------------------------- /Resources/zh_CN.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /Resources/zh_CN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* authorise */ 2 | "%@\nWhat would you like to do?" = "%@\n您想要怎么做?"; 3 | 4 | /* ConnectionOpenPanel */ 5 | "An unknown error occurred." = "发生了未知错误。"; 6 | 7 | /* close window */ 8 | "Are you sure you want to stop the upload?" = "你确定要停止上传吗?"; 9 | 10 | /* authorise */ 11 | "Authorize" = "批准"; 12 | 13 | /* authorise */ 14 | "Authorize Connection?" = "批准连接?"; 15 | 16 | /* config */ 17 | "Bad Configuration" = "不良配置"; 18 | 19 | /* error */ 20 | "Bad Droplet" = "不良 Droplet"; 21 | 22 | /* filesize: bytes */ 23 | "bytes" = "字节"; 24 | 25 | /* authorise */ 26 | "Cancel" = "取消"; 27 | 28 | /* connected message */ 29 | "Connected to %@" = "已连接到 %@"; 30 | 31 | /* connection string */ 32 | "Connecting to %@" = "正在连接到 %@"; 33 | 34 | /* close window */ 35 | "Continue Upload" = "继续上传"; 36 | 37 | /* config */ 38 | "Couldn't find configuration file specified\n %@" = "无法找到指定的配置文件\n %@"; 39 | 40 | /* status */ 41 | "Disconnected" = "已断开"; 42 | 43 | /* filesize: exabytes */ 44 | "EB" = "EB"; 45 | 46 | /* filesize: gigabytes */ 47 | "GB" = "GB"; 48 | 49 | /* filesize: kilobytes */ 50 | "KB" = "KB"; 51 | 52 | /* FTP download error */ 53 | "Local File already exists" = "本机文件已存在"; 54 | 55 | /* filesize: megabytes */ 56 | "MB" = "MB"; 57 | 58 | /* config */ 59 | "No configuration file specified" = "没有指定的配置文件"; 60 | 61 | /* failed to find a connection class */ 62 | "No connection available for requested connection type" = "请求的连接类型没有可用的连接"; 63 | 64 | /* filesize: petabytes */ 65 | "PB" = "PB"; 66 | 67 | /* ConnectionOpenPanel */ 68 | "Please check your settings." = "请检查你的设置。"; 69 | 70 | /* config 71 | error */ 72 | 73 | "Quit" = "退出"; 74 | 75 | /* close window */ 76 | "Stop Upload" = "停止上传"; 77 | 78 | /* close window */ 79 | "Stop Upload?" = "停止上传?"; 80 | 81 | /* filesize: terabytes */ 82 | "TB" = "TB"; 83 | 84 | /* error */ 85 | "This droplet is missing the original application that created it. You will need to reinstall the original application." = "该 Droplet 丢失了创建它的原应用程序。你需要重新安装该应用程序。"; 86 | 87 | /* status */ 88 | "Uploading %@" = "正在上传 %@"; -------------------------------------------------------------------------------- /Resources/zh_TW.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "FTPConnection"; 4 | NSHumanReadableCopyright = "© __MyCompanyName__, 2004"; -------------------------------------------------------------------------------- /UKQueue/UKKQueue_Symbols: -------------------------------------------------------------------------------- 1 | _UKFileWatcherRenameNotification 2 | _UKFileWatcherLinkCountChangeNotification 3 | _UKFileWatcherDeleteNotification 4 | _UKFileWatcherAccessRevocationNotification 5 | _UKFileWatcherWriteNotification 6 | _UKFileWatcherAttributeChangeNotification 7 | _UKFileWatcherSizeIncreaseNotification 8 | .objc_class_name_UKFNSubscribeFileWatcher 9 | _UKFileSubscriptionProc 10 | .objc_class_name_UKKQueue 11 | .objc_category_name_NSObject_UKMainThreadProxy 12 | .objc_class_name_UKMainThreadProxy 13 | -------------------------------------------------------------------------------- /UnitTests/09 moustik.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/karelia/ConnectionKit/2d7235aa7e1372818b9547c5d252fbf2c3a87259/UnitTests/09 moustik.mp3 -------------------------------------------------------------------------------- /UnitTests/BaseCKProtocolTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Sam Deane on 06/11/2012. 3 | // Copyright 2012 Karelia Software. All rights reserved. 4 | // 5 | 6 | #import "BaseCKTests.h" 7 | 8 | @interface BaseCKProtocolTests : BaseCKTests 9 | 10 | 11 | @end 12 | 13 | -------------------------------------------------------------------------------- /UnitTests/BaseCKTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Sam Deane on 06/11/2012. 3 | // Copyright 2012 Karelia Software. All rights reserved. 4 | // 5 | 6 | #import "KMSTestCase.h" 7 | #import "KMSState.h" 8 | #import "CK2FileManager.h" 9 | 10 | @interface BaseCKTests : KMSTestCase 11 | 12 | @property (strong, nonatomic) CK2FileManager* manager; 13 | @property (assign, atomic) KMSState state; 14 | @property (strong, nonatomic) NSMutableString* transcript; 15 | @property (readonly, nonatomic) NSString* protocol; 16 | @property (assign, nonatomic) BOOL useMockServer; 17 | @property (strong, nonatomic) NSString* originalUser; 18 | @property (strong, nonatomic) NSString* originalPassword; 19 | 20 | 21 | - (BOOL)setupTest; 22 | - (BOOL)isSetup; 23 | - (BOOL)protocolUsesAuthentication; 24 | - (NSURL*)temporaryFolder; 25 | 26 | - (BOOL)usingProtocol:(NSString*)type; 27 | - (BOOL)usingMockServerWithProtocol:(NSString*)type; 28 | - (void)useBadLogin; 29 | - (NSData*)mockServerDirectoryListingData; 30 | 31 | #pragma mark - Test File Support 32 | 33 | - (NSURL*)URLForTestFolder; 34 | - (NSURL*)URLForTestFile1; 35 | - (NSURL*)URLForTestFile2; 36 | - (void)makeTestDirectoryWithFiles:(BOOL)withFiles; 37 | - (void)removeTestDirectory; 38 | 39 | #pragma mark - Checking 40 | 41 | - (void)checkURL:(NSURL*)url isNamed:(NSString*)name; 42 | - (void)checkURLs:(NSMutableArray*)urls containItemNamed:(NSString*)name; 43 | - (BOOL)checkIsAuthenticationError:(NSError*)error; 44 | - (BOOL)checkIsCreationError:(NSError*)error nilAllowed:(BOOL)nilAllowed; 45 | - (BOOL)checkIsRemovalError:(NSError*)error nilAllowed:(BOOL)nilAllowed; 46 | - (BOOL)checkIsUpdateError:(NSError*)error nilAllowed:(BOOL)nilAllowed; 47 | - (BOOL)checkIsMissingError:(NSError*)error nilAllowed:(BOOL)nilAllowed; 48 | @end 49 | -------------------------------------------------------------------------------- /UnitTests/ErrorTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CK2FileManagerErrorTests.m 3 | // Connection 4 | // 5 | // Created by Sam Deane on 10/04/2013. 6 | // Copyright (c) 2012 Karelia Software. All rights reserved. 7 | // 8 | 9 | #import "CK2FileManager.h" 10 | 11 | #import 12 | 13 | @interface CK2FileManagerErrorTests : XCTestCase 14 | 15 | @end 16 | 17 | @implementation CK2FileManagerErrorTests 18 | 19 | #pragma mark FTP 20 | 21 | - (void)testUnsupportedScheme 22 | { 23 | CK2FileManager* fm = [[CK2FileManager alloc] init]; 24 | 25 | NSURL* url = [NSURL URLWithString:@"bogus://example.com"]; 26 | 27 | [fm contentsOfDirectoryAtURL:url includingPropertiesForKeys:@[] options:NSDirectoryEnumerationSkipsHiddenFiles completionHandler:^(NSArray *contents, NSError *error) { 28 | XCTAssertNotNil(error, @"expecting an error"); 29 | }]; 30 | 31 | [fm removeItemAtURL:url completionHandler:^(NSError *error) { 32 | XCTAssertNotNil(error, @"expecting an error"); 33 | }]; 34 | 35 | [fm enumerateContentsOfURL:url includingPropertiesForKeys:@[] options:NSDirectoryEnumerationSkipsHiddenFiles usingBlock:^(NSURL *url) { 36 | } completionHandler:^(NSError *error) { 37 | XCTAssertNotNil(error, @"expecting an error"); 38 | }]; 39 | 40 | [fm createDirectoryAtURL:url withIntermediateDirectories:YES openingAttributes:@{} completionHandler:^(NSError *error) { 41 | XCTAssertNotNil(error, @"expecting an error"); 42 | }]; 43 | 44 | [fm createFileAtURL:url contents:[NSData data] withIntermediateDirectories:YES openingAttributes:@{} progressBlock:^(int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToSend) { 45 | } completionHandler:^(NSError *error) { 46 | XCTAssertNotNil(error, @"expecting an error"); 47 | }]; 48 | 49 | [fm createFileAtURL:url withContentsOfURL:url withIntermediateDirectories:YES openingAttributes:@{} progressBlock:^(int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToSend) { 50 | } completionHandler:^(NSError *error) { 51 | XCTAssertNotNil(error, @"expecting an error"); 52 | }]; 53 | 54 | [fm release]; 55 | } 56 | 57 | @end -------------------------------------------------------------------------------- /UnitTests/FTPAuthenticationTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Sam Deane on 06/11/2012. 3 | // Copyright 2012 Karelia Software. All rights reserved. 4 | // 5 | 6 | #import "BaseCKTests.h" 7 | 8 | #import "CK2FileManager.h" 9 | 10 | #import 11 | 12 | @interface FTPAuthenticationTests : BaseCKTests 13 | 14 | @end 15 | 16 | @implementation FTPAuthenticationTests 17 | 18 | - (void)fileManager:(CK2FileManager *)manager operation:(CK2FileOperation *)operation didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(CK2AuthChallengeDisposition, NSURLCredential *))completionHandler; 19 | { 20 | NSString* user; 21 | NSString* password; 22 | 23 | if (challenge.previousFailureCount > 0) 24 | { 25 | user = self.originalUser; 26 | password = self.originalPassword; 27 | 28 | [self useResponseSet:@"default"]; 29 | } 30 | else 31 | { 32 | user = @"bad"; 33 | password = @"bad"; 34 | } 35 | 36 | NSLog(@"authenticating as %@ %@", self.user, self.password); 37 | NSURLCredential* credential = [NSURLCredential credentialWithUser:user password:password persistence:NSURLCredentialPersistenceNone]; 38 | completionHandler(CK2AuthChallengeUseCredential, credential); 39 | } 40 | 41 | - (NSString*)protocol 42 | { 43 | return @"FTP"; 44 | } 45 | 46 | #pragma mark - Tests 47 | 48 | - (void)testBadLoginThenGoodLogin 49 | { 50 | // the server starts by rejecting the password 51 | // after the first challenge though, we switch to the "normal" responses so that it accepts it 52 | if ([self setupTest]) 53 | { 54 | [self removeTestDirectory]; 55 | [self useResponseSet:@"bad login"]; 56 | 57 | NSURL* url = [self URLForTestFolder]; 58 | [self.manager createDirectoryAtURL:url withIntermediateDirectories:YES openingAttributes:nil completionHandler:^(NSError *error) { 59 | XCTAssertNil(error, @"got unexpected error %@", error); 60 | 61 | [self pause]; 62 | }]; 63 | } 64 | 65 | [self runUntilPaused]; 66 | } 67 | 68 | @end -------------------------------------------------------------------------------- /UnitTests/FTPTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Sam Deane on 06/11/2012. 3 | // Copyright 2012 Karelia Software. All rights reserved. 4 | // 5 | 6 | #import "BaseCKProtocolTests.h" 7 | 8 | @interface FTPTests : BaseCKProtocolTests 9 | 10 | @end 11 | 12 | @implementation FTPTests 13 | 14 | - (NSString*)protocol 15 | { 16 | return @"FTP"; 17 | } 18 | 19 | - (BOOL)protocolUsesAuthentication 20 | { 21 | return YES; 22 | } 23 | 24 | - (NSData*)mockServerDirectoryListingData 25 | { 26 | NSString* listing = [NSString stringWithFormat: 27 | @"total 1\r\n-rw------- 1 user staff 3 Mar 6 2012 %@\r\n-rw------- 1 user staff 3 Mar 6 2012 %@\r\n\r\n", 28 | [[self URLForTestFile1] lastPathComponent], 29 | [[self URLForTestFile2] lastPathComponent] 30 | ]; 31 | 32 | return [listing dataUsingEncoding:NSUTF8StringEncoding]; 33 | } 34 | 35 | @end -------------------------------------------------------------------------------- /UnitTests/README.md: -------------------------------------------------------------------------------- 1 | A quick overview of the unit tests, since some of them are fairly involved. 2 | 3 | # Server Configuration 4 | 5 | Since some of the tests talk to servers, the tests can be configured using the defaults command: 6 | 7 | defaults write otest 8 | 9 | with a key of CKWebDAVTest, CKFTPTest, or CKSFTPTest. 10 | 11 | Setting the value to the url of a server will use that server for the tests. 12 | 13 | Setting the value to "MockServer" will use MockServer (where possible). 14 | 15 | Setting the value to "Off" will disable those tests. 16 | 17 | 18 | # Tests 19 | 20 | ## CK2FileManagerPathTests 21 | 22 | These test that [CK2FileManager pathOfURL] works correctly. 23 | 24 | 25 | 26 | ## CK2FileManagerFileTests 27 | 28 | These test the file manager's support for file operations on the local machine (ie using file:// urls). 29 | 30 | 31 | 32 | ## CK2FileManagerFTPTests 33 | 34 | These test the file manager's support for FTP and SFTP. 35 | 36 | When the test suite is constructed, it actually makes two test suites containing the same tests, one using ftp and one sftp. 37 | 38 | The underpinning inherited from CK2FileManagerBaseTests is used to ensure that the correct server value is read from the defaults, and the correct MockServer responses file is loaded if appropriate. 39 | 40 | 41 | ## CK2FileManagerFTPAuthenticationTests 42 | 43 | This tests FTP support, in the specific situation where the first authentication attempt is bad, but the second one is good. 44 | 45 | 46 | 47 | ## CK2FileManagerURLTests 48 | 49 | These test the CK2FileManager routines for creating URLs: 50 | 51 | - [CK2FileManager URLWithPath:relativeToURL:] 52 | - [CK2FileManager URLWithPath:hostURL:] 53 | 54 | 55 | ## CK2CURLProtocolURLManipulationTests 56 | 57 | These perform various URL manipulation tests. 58 | 59 | - Some tests check that NSURL is behaving as expected. 60 | - Some check that CFURLHasDirectoryPath() hasn't changed behaviour. 61 | - Some check that [CK2FTPProtocol newRequestWithRequest:isDirectory:] is working. 62 | 63 | 64 | ## CK2FileManagerBaseTests 65 | 66 | This is a base class used by the other tests. 67 | 68 | -------------------------------------------------------------------------------- /UnitTests/SFTPTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Sam Deane on 06/11/2012. 3 | // Copyright 2012 Karelia Software. All rights reserved. 4 | // 5 | 6 | #import "BaseCKProtocolTests.h" 7 | 8 | @interface SFTPTests : BaseCKProtocolTests 9 | 10 | @end 11 | 12 | @implementation SFTPTests 13 | 14 | - (NSString*)protocol 15 | { 16 | return @"SFTP"; 17 | } 18 | 19 | - (BOOL)protocolUsesAuthentication 20 | { 21 | return YES; 22 | } 23 | 24 | @end -------------------------------------------------------------------------------- /UnitTests/URLAppendingTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // URLAppendingTests.m 3 | // Connection 4 | // 5 | // Created by Mike on 31/01/2013. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface URLAppendingTests : XCTestCase 12 | 13 | @end 14 | 15 | 16 | @implementation URLAppendingTests 17 | 18 | - (void)testFTPAppendToRoot; 19 | { 20 | XCTAssertEqualObjects([[NSURL URLWithString:@"ftp://example.com/%2F"] URLByAppendingPathComponent:@"test1.txt"], 21 | [NSURL URLWithString:@"ftp://example.com/%2F/test1.txt"]); 22 | 23 | XCTAssertEqualObjects([[NSURL URLWithString:@"ftp://example.com//"] URLByAppendingPathComponent:@"test1.txt"], 24 | [NSURL URLWithString:@"ftp://example.com//test1.txt"]); 25 | } 26 | 27 | - (void)testFTPAppendToAbsoluteDirectory; 28 | { 29 | XCTAssertEqualObjects([[NSURL URLWithString:@"ftp://example.com/%2Ftest/"] URLByAppendingPathComponent:@"test1.txt"], 30 | [NSURL URLWithString:@"ftp://example.com/%2Ftest/test1.txt"]); 31 | 32 | XCTAssertEqualObjects([[NSURL URLWithString:@"ftp://example.com//test/"] URLByAppendingPathComponent:@"test1.txt"], 33 | [NSURL URLWithString:@"ftp://example.com//test/test1.txt"]); 34 | } 35 | 36 | - (void)testFTPAppendToHome; 37 | { 38 | XCTAssertEqualObjects([[NSURL URLWithString:@"ftp://example.com/"] URLByAppendingPathComponent:@"test1.txt"], 39 | [NSURL URLWithString:@"ftp://example.com/test1.txt"]); 40 | } 41 | 42 | - (void)testFTPAppendToHomeSubdirectory; 43 | { 44 | XCTAssertEqualObjects([[NSURL URLWithString:@"ftp://example.com/test/"] URLByAppendingPathComponent:@"test1.txt"], 45 | [NSURL URLWithString:@"ftp://example.com/test/test1.txt"]); 46 | } 47 | 48 | - (void)testSFTPAppendToRoot; 49 | { 50 | XCTAssertEqualObjects([[NSURL URLWithString:@"sftp://example.com/"] URLByAppendingPathComponent:@"test1.txt"], 51 | [NSURL URLWithString:@"sftp://example.com/test1.txt"]); 52 | } 53 | 54 | - (void)testSFTPAppendToAbsoluteDirectory; 55 | { 56 | XCTAssertEqualObjects([[NSURL URLWithString:@"sftp://example.com/test/"] URLByAppendingPathComponent:@"test1.txt"], 57 | [NSURL URLWithString:@"sftp://example.com/test/test1.txt"]); 58 | } 59 | 60 | - (void)testSFTPAppendToHome; 61 | { 62 | XCTAssertEqualObjects([[NSURL URLWithString:@"sftp://example.com/~/"] URLByAppendingPathComponent:@"test1.txt"], 63 | [NSURL URLWithString:@"sftp://example.com/~/test1.txt"]); 64 | } 65 | 66 | - (void)testSFTPAppendToHomeSubdirectory; 67 | { 68 | XCTAssertEqualObjects([[NSURL URLWithString:@"sftp://example.com/~/test/"] URLByAppendingPathComponent:@"test1.txt"], 69 | [NSURL URLWithString:@"sftp://example.com/~/test/test1.txt"]); 70 | } 71 | 72 | - (void)testFTPRootIsDirectory; 73 | { 74 | BOOL isDirectory = CFURLHasDirectoryPath((CFURLRef)[NSURL URLWithString:@"ftp://example.com/%2F"]); 75 | XCTAssertFalse(isDirectory); 76 | } 77 | 78 | - (void)testFTPRootWithTrailingSlashIsDirectory; 79 | { 80 | BOOL isDirectory = CFURLHasDirectoryPath((CFURLRef)[NSURL URLWithString:@"ftp://example.com/%2F/"]); 81 | XCTAssertTrue(isDirectory); 82 | } 83 | 84 | - (void)testFTPHomeIsDirectory; 85 | { 86 | BOOL isDirectory = CFURLHasDirectoryPath((CFURLRef)[NSURL URLWithString:@"ftp://example.com/"]); 87 | XCTAssertTrue(isDirectory); 88 | } 89 | 90 | - (void)testFTPHomeWithoutTrailingSlashIsDirectory; 91 | { 92 | BOOL isDirectory = CFURLHasDirectoryPath((CFURLRef)[NSURL URLWithString:@"ftp://example.com"]); 93 | XCTAssertFalse(isDirectory); 94 | } 95 | 96 | - (void)testFTPAbsoluteFileIsDirectory; 97 | { 98 | BOOL isDirectory = CFURLHasDirectoryPath((CFURLRef)[NSURL URLWithString:@"ftp://example.com/%2F/test.txt"]); 99 | XCTAssertFalse(isDirectory); 100 | } 101 | 102 | - (void)testFTPRelativeFileIsDirectory; 103 | { 104 | BOOL isDirectory = CFURLHasDirectoryPath((CFURLRef)[NSURL URLWithString:@"ftp://example.com/test.txt"]); 105 | XCTAssertFalse(isDirectory); 106 | } 107 | 108 | @end 109 | 110 | -------------------------------------------------------------------------------- /UnitTests/URLCanonicalizationTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // URLAppendingTests.m 3 | // Connection 4 | // 5 | // Created by Mike on 31/01/2013. 6 | // 7 | // 8 | 9 | #import 10 | 11 | #import "CK2CURLBasedProtocol.h" 12 | 13 | @interface URLCanonicalizationTests : XCTestCase 14 | @end 15 | 16 | 17 | @implementation URLCanonicalizationTests 18 | 19 | - (void)testIncludingUser; 20 | { 21 | // Test first with no user set. e.g. anonymous login 22 | NSURL *url = [CK2CURLBasedProtocol URLByReplacingUserInfoInURL:[NSURL URLWithString:@"ftp://example.com/image.png"] withUser:nil]; 23 | XCTAssertEqualObjects(url.absoluteString, @"ftp://example.com/image.png"); 24 | 25 | // Adding user into the URL 26 | url = [CK2CURLBasedProtocol URLByReplacingUserInfoInURL:[NSURL URLWithString:@"ftp://example.com/image.png"] withUser:@"user"]; 27 | XCTAssertEqualObjects(url.absoluteString, @"ftp://user@example.com/image.png"); 28 | 29 | // Replacing existing user 30 | url = [CK2CURLBasedProtocol URLByReplacingUserInfoInURL:[NSURL URLWithString:@"ftp://test@example.com/image.png"] withUser:@"user"]; 31 | XCTAssertEqualObjects(url.absoluteString, @"ftp://user@example.com/image.png"); 32 | 33 | // Replacing existing user + password 34 | url = [CK2CURLBasedProtocol URLByReplacingUserInfoInURL:[NSURL URLWithString:@"ftp://test:sekret@example.com/image.png"] withUser:@"user"]; 35 | XCTAssertEqualObjects(url.absoluteString, @"ftp://user@example.com/image.png"); 36 | 37 | // Escaping of unusual characters 38 | url = [CK2CURLBasedProtocol URLByReplacingUserInfoInURL:[NSURL URLWithString:@"ftp://example.com/image.png"] withUser:@"user/:1@example.com"]; 39 | XCTAssertEqualObjects(url.absoluteString, @"ftp://user%2F%3A1%40example.com@example.com/image.png"); 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /UnitTests/UnitTest-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /UnitTests/UnitTests_Prefix.pch: -------------------------------------------------------------------------------- 1 | 2 | //#define MockServerLogDetail(...) 3 | -------------------------------------------------------------------------------- /UnitTests/WebDAVTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Sam Deane on 06/11/2012. 3 | // Copyright 2012 Karelia Software. All rights reserved. 4 | // 5 | 6 | #import "BaseCKProtocolTests.h" 7 | 8 | @interface WebDAVTests : BaseCKProtocolTests 9 | 10 | @end 11 | 12 | @implementation WebDAVTests 13 | 14 | - (NSString*)protocol 15 | { 16 | return @"WebDAV"; 17 | } 18 | 19 | - (BOOL)protocolUsesAuthentication 20 | { 21 | return YES; 22 | } 23 | 24 | - (NSData*)mockServerDirectoryListingData 25 | { 26 | NSString* xml = [NSString stringWithFormat: 27 | @"" 28 | 29 | "" 30 | "%@" 31 | "" 32 | "" 33 | "" 34 | "" 35 | "HTTP/1.1 200 OK" 36 | "" 37 | "" 38 | 39 | "" 40 | "%@" 41 | "" 42 | "" 43 | "" 44 | "" 45 | "HTTP/1.1 200 OK" 46 | "" 47 | "" 48 | 49 | "" 50 | "%@" 51 | "" 52 | "" 53 | "" 54 | "" 55 | "HTTP/1.1 200 OK" 56 | "" 57 | "" 58 | 59 | "\r\n", [self URLForTestFolder], [self URLForTestFile1], [self URLForTestFile2]]; 60 | 61 | NSData* data = [xml dataUsingEncoding:NSUTF8StringEncoding]; 62 | 63 | return data; 64 | } 65 | 66 | @end -------------------------------------------------------------------------------- /UnitTests/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script builds and runs the unit tests and produces output in a format that is compatible with Jenkins. 4 | 5 | base=`dirname $0` 6 | echo "$base" 7 | pushd "$base/.." > /dev/null 8 | build="$PWD/test-build" 9 | ocunit2junit="$base/../CurlHandle/CURLHandleSource/Tests/MockServer/UnitTests/OCUnit2JUnit/bin/ocunit2junit" 10 | popd > /dev/null 11 | 12 | sym="$build/sym" 13 | obj="$build/obj" 14 | 15 | testout="$build/output.log" 16 | testerr="$build/error.log" 17 | 18 | rm -rf "$build" 19 | mkdir -p "$build" 20 | 21 | echo Building 32-bit 22 | 23 | xcodebuild -workspace "ConnectionKit.xcworkspace" -scheme "ConnectionKit" -sdk "macosx" -config "Debug" -arch i386 build OBJROOT="$obj" SYMROOT="$sym" > "$testout" 2> "$testerr" 24 | if [ $? != 0 ]; then 25 | echo "32-bit build failed" 26 | cat "$testerr" 27 | fi 28 | 29 | 30 | echo Building and Testing 64-bit 31 | 32 | xcodebuild -workspace "ConnectionKit.xcworkspace" -scheme "ConnectionKit" -sdk "macosx" -config "Debug" -arch x86_64 test OBJROOT="$obj" SYMROOT="$sym" > "$testout" 2> "$testerr" 33 | if [ $? != 0 ]; then 34 | echo "64-bit build failed" 35 | cat "$testerr" 36 | else 37 | cd "$build" 38 | "../$ocunit2junit" < "$testout" 39 | fi 40 | 41 | 42 | -------------------------------------------------------------------------------- /UnitTests/use-ftp-server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | defaults write otest CKFTPTestURL $1 4 | -------------------------------------------------------------------------------- /UnitTests/use-mockserver.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | defaults write otest CKFTPTestURL MockServer 4 | defaults write otest CKWebDAVTestURL MockServer 5 | defaults write otest CKSFTPTestURL MockServer 6 | -------------------------------------------------------------------------------- /UnitTests/use-sftp-server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | defaults write otest CKSFTPTestURL $1 4 | -------------------------------------------------------------------------------- /UnitTests/use-webdav-server.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | defaults write otest CKWebDAVTestURL $1 4 | -------------------------------------------------------------------------------- /version.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildVersion 6 | 92 7 | CFBundleVersion 8 | 1.0 9 | ProductBuildVersion 10 | 7K571 11 | ProjectName 12 | NibPBTemplates 13 | SourceVersion 14 | 1200000 15 | 16 | 17 | --------------------------------------------------------------------------------