diff options
-rw-r--r-- | Source/SPConnectionController.h | 2 | ||||
-rw-r--r-- | Source/SPConnectionController.m | 19 | ||||
-rw-r--r-- | Source/SPConnectionControllerDataSource.m | 3 | ||||
-rw-r--r-- | Source/SPConnectionControllerDelegate.h | 4 | ||||
-rw-r--r-- | Source/SPConnectionControllerDelegate.m | 3 | ||||
-rw-r--r-- | Source/SPConnectionControllerInitializer.m | 113 |
6 files changed, 113 insertions, 31 deletions
diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h index 5a80ebc4..306342c2 100644 --- a/Source/SPConnectionController.h +++ b/Source/SPConnectionController.h @@ -24,7 +24,7 @@ // More info at <http://code.google.com/p/sequel-pro/> #import <MCPKit/MCPKit.h> -#import "SPFavoritesExportProtocol.h" + #import "SPConnectionControllerDelegateProtocol.h" #ifndef SP_REFACTOR /* headers */ diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 7f67edcc..62767fe8 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -312,33 +312,40 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, } permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"", nil]; + [keySelectionPanel setAccessoryView:sshKeyLocationHelp]; - + } // SSL key file location: - } else if (sender == standardSSLKeyFileButton || sender == socketSSLKeyFileButton) { + else if (sender == standardSSLKeyFileButton || sender == socketSSLKeyFileButton) { if ([sender state] == NSOffState) { [self setSslKeyFileLocation:nil]; return; } + permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"key", @"", nil]; - [keySelectionPanel setAccessoryView:sslKeyFileLocationHelp]; + [keySelectionPanel setAccessoryView:sslKeyFileLocationHelp]; + } // SSL certificate file location: - } else if (sender == standardSSLCertificateButton || sender == socketSSLCertificateButton) { + else if (sender == standardSSLCertificateButton || sender == socketSSLCertificateButton) { if ([sender state] == NSOffState) { [self setSslCertificateFileLocation:nil]; return; } + permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"cert", @"crt", @"", nil]; - [keySelectionPanel setAccessoryView:sslCertificateLocationHelp]; + [keySelectionPanel setAccessoryView:sslCertificateLocationHelp]; + } // SSL CA certificate file location: - } else if (sender == standardSSLCACertButton || sender == socketSSLCACertButton) { + else if (sender == standardSSLCACertButton || sender == socketSSLCACertButton) { if ([sender state] == NSOffState) { [self setSslCACertFileLocation:nil]; return; } + permittedFileTypes = [NSArray arrayWithObjects:@"pem", @"cert", @"crt", @"", nil]; + [keySelectionPanel setAccessoryView:sslCACertLocationHelp]; } diff --git a/Source/SPConnectionControllerDataSource.m b/Source/SPConnectionControllerDataSource.m index dd919980..cb9c71bf 100644 --- a/Source/SPConnectionControllerDataSource.m +++ b/Source/SPConnectionControllerDataSource.m @@ -29,7 +29,7 @@ #import "SPGroupNode.h" #import "SPTreeNode.h" -@interface SPConnectionController (PrivateAPI) +@interface SPConnectionController () - (void)_reloadFavoritesViewData; - (void)_updateFavoritePasswordsFromField:(NSControl *)control; @@ -66,7 +66,6 @@ - (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { - // Trim whitespace NSString *newName = [object stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; if ([newName length]) { diff --git a/Source/SPConnectionControllerDelegate.h b/Source/SPConnectionControllerDelegate.h index 25d0a02d..23d29b9b 100644 --- a/Source/SPConnectionControllerDelegate.h +++ b/Source/SPConnectionControllerDelegate.h @@ -24,6 +24,8 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPConnectionController.h" +#import "SPFavoritesExportProtocol.h" +#import "SPFavoritesImportProtocol.h" /** * @category SPConnectionControllerDelegate SPConnectionControllerDelegate.h @@ -32,6 +34,6 @@ * * Connection controller delegate category. */ -@interface SPConnectionController (SPConnectionControllerDelegate) <SPFavoritesExportProtocol> +@interface SPConnectionController (SPConnectionControllerDelegate) <SPFavoritesImportProtocol, SPFavoritesExportProtocol> @end diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m index 26101071..11d092f4 100644 --- a/Source/SPConnectionControllerDelegate.m +++ b/Source/SPConnectionControllerDelegate.m @@ -503,7 +503,6 @@ static NSString *SPDatabaseImage = @"database-small"; - (void)favoritesExportCompletedWithError:(NSError *)error { if (error) { - NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Favorites export error", @"favorites export error message") defaultButton:NSLocalizedString(@"OK", @"OK") alternateButton:nil @@ -522,7 +521,7 @@ static NSString *SPDatabaseImage = @"database-small"; */ - (void)favoritesImportData:(NSDictionary *)data { - + // TODO: do something with the data } /** diff --git a/Source/SPConnectionControllerInitializer.m b/Source/SPConnectionControllerInitializer.m index 5c11f301..34f9ca40 100644 --- a/Source/SPConnectionControllerInitializer.m +++ b/Source/SPConnectionControllerInitializer.m @@ -35,6 +35,7 @@ static NSString *SPConnectionViewNibName = @"ConnectionView"; - (void)_reloadFavoritesViewData; - (void)_selectNode:(SPTreeNode *)node; + - (SPTreeNode *)_favoriteNodeForFavoriteID:(NSInteger)favoriteID; @end @@ -128,27 +129,101 @@ static NSString *SPConnectionViewNibName = @"ConnectionView"; */ - (void)registerForNotifications { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scrollViewFrameChanged:) name:NSViewFrameDidChangeNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(scrollViewFrameChanged:) + name:NSViewFrameDidChangeNotification + object:nil]; // Registered to be notified of changes to connection information - [self addObserver:self forKeyPath:SPFavoriteNameKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteHostKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteUserKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteDatabaseKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSocketKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoritePortKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteUseSSLKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSHHostKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSHUserKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSHPortKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSHKeyLocationEnabledKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSHKeyLocationKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSLKeyFileLocationEnabledKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSLKeyFileLocationKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSLCertificateFileLocationEnabledKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSLCertificateFileLocationKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSLCACertFileLocationEnabledKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; - [self addObserver:self forKeyPath:SPFavoriteSSLCACertFileLocationKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; + [self addObserver:self + forKeyPath:SPFavoriteNameKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteHostKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteUserKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteDatabaseKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSocketKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoritePortKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteUseSSLKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSHHostKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSHUserKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSHPortKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSHKeyLocationEnabledKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSHKeyLocationKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSLKeyFileLocationEnabledKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSLKeyFileLocationKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSLCertificateFileLocationEnabledKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSLCertificateFileLocationKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSLCACertFileLocationEnabledKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; + + [self addObserver:self + forKeyPath:SPFavoriteSSLCACertFileLocationKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; } /** |