diff options
author | Max <dmoagx@users.noreply.github.com> | 2018-04-12 02:42:34 +0200 |
---|---|---|
committer | Max <dmoagx@users.noreply.github.com> | 2018-04-12 02:42:34 +0200 |
commit | d5056ebd70b6eb85eb4e8160fcccf2e5424ad9f6 (patch) | |
tree | 8b30c065994649a5191349b82d59f1ce6ceb4883 /Source/SPConnectionController.m | |
parent | 8ceb5be8c231395cdc72b0646dd494c0c5b4e233 (diff) | |
download | sequelpro-d5056ebd70b6eb85eb4e8160fcccf2e5424ad9f6.tar.gz sequelpro-d5056ebd70b6eb85eb4e8160fcccf2e5424ad9f6.tar.bz2 sequelpro-d5056ebd70b6eb85eb4e8160fcccf2e5424ad9f6.zip |
Source formatting changes
Diffstat (limited to 'Source/SPConnectionController.m')
-rw-r--r-- | Source/SPConnectionController.m | 383 |
1 files changed, 190 insertions, 193 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 407c22e1..bb22a927 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -741,14 +741,14 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, - (void)reverseSortFavorites:(NSMenuItem *)sender { #ifndef SP_CODA - reverseFavoritesSort = (![sender state]); + reverseFavoritesSort = (![sender state]); [prefs setBool:reverseFavoritesSort forKey:SPFavoritesSortedInReverse]; // Perform re-sorting [self _sortFavorites]; - [(NSMenuItem *)sender setState:reverseFavoritesSort]; + [sender setState:reverseFavoritesSort]; #endif } @@ -928,50 +928,50 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, NSNumber *favoriteID = [self _createNewFavoriteID]; NSArray *objects = @[ - NSLocalizedString(@"New Favorite", @"new favorite name"), - @0, - @"", - @"", - @"", - @(-1), - @"", - @(NSOffState), - @(NSOffState), - @(NSOffState), - @(NSOffState), - @"", - @"", - @"", - @(NSOffState), - @"", - @"", - favoriteID - ]; + NSLocalizedString(@"New Favorite", @"new favorite name"), + @0, + @"", + @"", + @"", + @(-1), + @"", + @(NSOffState), + @(NSOffState), + @(NSOffState), + @(NSOffState), + @"", + @"", + @"", + @(NSOffState), + @"", + @"", + favoriteID + ]; NSArray *keys = @[ - SPFavoriteNameKey, - SPFavoriteTypeKey, - SPFavoriteHostKey, - SPFavoriteSocketKey, - SPFavoriteUserKey, - SPFavoriteColorIndexKey, - SPFavoritePortKey, - SPFavoriteUseSSLKey, - SPFavoriteSSLKeyFileLocationEnabledKey, - SPFavoriteSSLCertificateFileLocationEnabledKey, - SPFavoriteSSLCACertFileLocationEnabledKey, - SPFavoriteDatabaseKey, - SPFavoriteSSHHostKey, - SPFavoriteSSHUserKey, - SPFavoriteSSHKeyLocationEnabledKey, - SPFavoriteSSHKeyLocationKey, - SPFavoriteSSHPortKey, - SPFavoriteIDKey - ]; - - // Create default favorite - NSMutableDictionary *favorite = [NSMutableDictionary dictionaryWithObjects:objects forKeys:keys]; - + SPFavoriteNameKey, + SPFavoriteTypeKey, + SPFavoriteHostKey, + SPFavoriteSocketKey, + SPFavoriteUserKey, + SPFavoriteColorIndexKey, + SPFavoritePortKey, + SPFavoriteUseSSLKey, + SPFavoriteSSLKeyFileLocationEnabledKey, + SPFavoriteSSLCertificateFileLocationEnabledKey, + SPFavoriteSSLCACertFileLocationEnabledKey, + SPFavoriteDatabaseKey, + SPFavoriteSSHHostKey, + SPFavoriteSSHUserKey, + SPFavoriteSSHKeyLocationEnabledKey, + SPFavoriteSSHKeyLocationKey, + SPFavoriteSSHPortKey, + SPFavoriteIDKey + ]; + + // Create default favorite + NSMutableDictionary *favorite = [NSMutableDictionary dictionaryWithObjects:objects forKeys:keys]; + SPTreeNode *selectedNode = [self selectedFavoriteNode]; SPTreeNode *parent = ([selectedNode isGroup] && selectedNode != quickConnectItem) ? selectedNode : (SPTreeNode *)[selectedNode parentNode]; @@ -982,12 +982,12 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [favoritesOutlineView expandItem:parent]; [self _sortFavorites]; - [self _selectNode:node]; - - [[[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; + [self _selectNode:node]; + + [[[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; favoriteNameFieldWasAutogenerated = YES; - + [favoritesOutlineView editColumn:0 row:[favoritesOutlineView selectedRow] withEvent:nil select:YES]; } @@ -1029,7 +1029,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, BOOL suppressWarning = NO; SPTreeNode *node = [self selectedFavoriteNode]; - + NSString *message = @""; NSString *informativeMessage = @""; @@ -1047,10 +1047,10 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, if (!suppressWarning) { NSAlert *alert = [NSAlert alertWithMessageText:message - defaultButton:NSLocalizedString(@"Delete", @"delete button") - alternateButton:NSLocalizedString(@"Cancel", @"cancel button") - otherButton:nil - informativeTextWithFormat:@"%@", informativeMessage]; + defaultButton:NSLocalizedString(@"Delete", @"delete button") + alternateButton:NSLocalizedString(@"Cancel", @"cancel button") + otherButton:nil + informativeTextWithFormat:@"%@", informativeMessage]; NSArray *buttons = [alert buttons]; @@ -1061,12 +1061,12 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [alert setAlertStyle:NSCriticalAlertStyle]; - [alert beginSheetModalForWindow:[dbDocument parentWindow] - modalDelegate:self - didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) - contextInfo:SPRemoveNode]; + [alert beginSheetModalForWindow:[dbDocument parentWindow] + modalDelegate:self + didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) + contextInfo:SPRemoveNode]; } - else{ + else { [self _removeNode:node]; } } @@ -1127,7 +1127,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [self _reloadFavoritesViewData]; [self _selectNode:node]; - [[(SPPreferenceController *)[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; + [[[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; } } @@ -1155,7 +1155,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, { return [self _selectNode:quickConnectItem]; } - + #pragma mark - #pragma mark Import/export favorites @@ -1193,9 +1193,8 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, // suggest the name of the favorite or a default name for multiple selection NSString *fileName = ([[self selectedFavoriteNodes] count] == 1)? [[(id<SPNamedNode>)[[self selectedFavoriteNode] representedObject] nodeName] stringByAppendingPathExtension:@"plist"] : nil; // This if() is so we can also catch nil due to favorite corruption (NSSavePanel will @throw if nil is passed in) - if(!fileName) - fileName = SPExportFavoritesFilename; - + if(!fileName) fileName = SPExportFavoritesFilename; + [savePanel setAccessoryView:exportPanelAccessoryView]; [savePanel setNameFieldStringValue:fileName]; @@ -1231,7 +1230,6 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { } - #pragma mark - #pragma mark Sheet methods @@ -1246,7 +1244,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, if (returnCode == NSAlertDefaultReturn) { [self _removeNode:[self selectedFavoriteNode]]; } - } + } } #endif @@ -1255,7 +1253,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, * Alert sheet callback method - invoked when the error sheet is closed. */ - (void)localhostErrorSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo -{ +{ if (returnCode == NSAlertAlternateReturn) { [self setType:SPSocketConnection]; [self setHost:@""]; @@ -1282,7 +1280,6 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [[connectionView window] endEditingFor:[[connectionView window] firstResponder]]; } - // Ensure that host is not empty if this is a TCP/IP or SSH connection if (validateDetails && ([self type] == SPTCPIPConnection || [self type] == SPSSHTunnelConnection) && ![[self host] length]) { SPOnewayAlertSheet( @@ -1363,7 +1360,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, _setOrRemoveKey(SPFavoriteSSHKeyLocationKey, [self sshKeyLocation]); - /** + /* * Password handling for the SQL connection */ NSString *oldKeychainName, *oldKeychainAccount, *newKeychainName, *newKeychainAccount;; @@ -1380,8 +1377,8 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, // If creating a new favourite, always add the password to the keychain if it's set if (createNewFavorite && [sqlPassword length]) { [keychain addPassword:sqlPassword - forName:[keychain nameForFavoriteName:[theFavorite objectForKey:SPFavoriteNameKey] id:[theFavorite objectForKey:SPFavoriteIDKey]] - account:[keychain accountForUser:[self user] host:newHostnameForPassword database:[self database]]]; + forName:[keychain nameForFavoriteName:[theFavorite objectForKey:SPFavoriteNameKey] id:[theFavorite objectForKey:SPFavoriteIDKey]] + account:[keychain accountForUser:[self user] host:newHostnameForPassword database:[self database]]]; } // If not creating a new favourite... @@ -1407,9 +1404,8 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, } } sqlPassword = nil; - - - /** + + /* * Password handling for the SSH connection */ NSString *theSSHPassword = [self sshPassword]; @@ -1420,8 +1416,8 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, // If creating a new favourite, always add the password if it's set if (createNewFavorite && [theSSHPassword length]) { [keychain addPassword:theSSHPassword - forName:[keychain nameForSSHForFavoriteName:[theFavorite objectForKey:SPFavoriteNameKey] id:[theFavorite objectForKey:SPFavoriteIDKey]] - account:[keychain accountForSSHUser:[self sshUser] sshHost:[self sshHost]]]; + forName:[keychain nameForSSHForFavoriteName:[theFavorite objectForKey:SPFavoriteNameKey] id:[theFavorite objectForKey:SPFavoriteIDKey]] + account:[keychain accountForSSHUser:[self sshUser] sshHost:[self sshHost]]]; } // If not creating a new favourite... @@ -1448,8 +1444,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, } theSSHPassword = nil; - - /** + /* * Saving the connection */ @@ -1509,15 +1504,17 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, - (BOOL)_checkHost { if ([self type] != SPSocketConnection && [[self host] isEqualToString:@"localhost"]) { - SPBeginAlertSheet(NSLocalizedString(@"You have entered 'localhost' for a non-socket connection", @"title of error when using 'localhost' for a network connection"), - NSLocalizedString(@"Use 127.0.0.1", @"Use 127.0.0.1 button"), // Main button - NSLocalizedString(@"Connect via socket", @"Connect via socket button"), // Alternate button - nil, // Other button - [dbDocument parentWindow], // Window to attach to - self, // Modal delegate - @selector(localhostErrorSheetDidEnd:returnCode:contextInfo:), // Did end selector - NULL, // Contextual info for selectors - NSLocalizedString(@"To MySQL, 'localhost' is a special host and means that a socket connection should be used.\n\nDid you mean to use a socket connection, or to connect to the local machine via a port? If you meant to connect via a port, '127.0.0.1' should be used instead of 'localhost'.", @"message of error when using 'localhost' for a network connection")); + SPBeginAlertSheet( + NSLocalizedString(@"You have entered 'localhost' for a non-socket connection", @"title of error when using 'localhost' for a network connection"), + NSLocalizedString(@"Use 127.0.0.1", @"Use 127.0.0.1 button"), // Main button + NSLocalizedString(@"Connect via socket", @"Connect via socket button"), // Alternate button + nil, // Other button + [dbDocument parentWindow], // Window to attach to + self, // Modal delegate + @selector(localhostErrorSheetDidEnd:returnCode:contextInfo:), // Did end selector + NULL, // Contextual info for selectors + NSLocalizedString(@"To MySQL, 'localhost' is a special host and means that a socket connection should be used.\n\nDid you mean to use a socket connection, or to connect to the local machine via a port? If you meant to connect via a port, '127.0.0.1' should be used instead of 'localhost'.", @"message of error when using 'localhost' for a network connection") + ); return NO; } @@ -1531,7 +1528,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, #ifndef SP_CODA - (void)_sortFavorites { - NSString *sortKey = SPFavoriteNameKey; + NSString *sortKey = SPFavoriteNameKey; switch (currentSortItem) { @@ -1555,7 +1552,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, NSArray *preSortSelection = [self selectedFavoriteNodes]; [self _sortTreeNode:[[favoritesRoot childNodes] objectAtIndex:0] usingKey:sortKey]; - + [favoritesController saveFavorites]; [self _reloadFavoritesViewData]; @@ -1692,7 +1689,6 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, */ - (void)_updateFavoriteFirstResponder { - // Skip auto-selection changes if there is no user set if (![[self user] length]) return; @@ -1757,7 +1753,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, // Re-enable favorites table view [favoritesOutlineView setEnabled:YES]; - [(NSView *)favoritesOutlineView display]; + [favoritesOutlineView display]; // Revert the connect button back to its original selector [connectButton setAction:@selector(initiateConnection:)]; @@ -1804,7 +1800,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [connectionResizeContainer setHidden:NO]; [connectionInstructionsTextField setStringValue:NSLocalizedString(@"Enter connection details below, or choose a favorite", @"enter connection details label")]; - [[(SPPreferenceController *)[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; + [[[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; } /** @@ -1838,13 +1834,13 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, // Remove passwords from the Keychain [keychain deletePasswordForName:[keychain nameForFavoriteName:favoriteName id:favoriteID] - account:[keychain accountForUser:favoriteUser host:((type == SPSocketConnection) ? @"localhost" : favoriteHost) database:favoriteDatabase]]; + account:[keychain accountForUser:favoriteUser host:((type == SPSocketConnection) ? @"localhost" : favoriteHost) database:favoriteDatabase]]; [keychain deletePasswordForName:[keychain nameForSSHForFavoriteName:favoriteName id:favoriteID] - account:[keychain accountForSSHUser:favoriteSSHUser sshHost:favoriteSSHHost]]; + account:[keychain accountForSSHUser:favoriteSSHUser sshHost:favoriteSSHHost]]; // Reset last used favorite if ([[favorite objectForKey:SPFavoriteIDKey] integerValue] == [prefs integerForKey:SPLastFavoriteID]) { - [prefs setInteger:0 forKey:SPLastFavoriteID]; + [prefs setInteger:0 forKey:SPLastFavoriteID]; } // If required, reset the default favorite @@ -1871,9 +1867,9 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, if (!favoritesRoot) return favoriteNode; if (!favoriteID) return quickConnectItem; - + for (SPTreeNode *node in [favoritesRoot allChildLeafs]) - { + { if ([[[[node representedObject] nodeFavorite] objectForKey:SPFavoriteIDKey] integerValue] == favoriteID) { favoriteNode = node; } @@ -1912,7 +1908,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, if ([[self database] length]) { aName = [NSString stringWithFormat:@"%@/%@", aName, [self database]]; - } + } return aName; } @@ -1924,7 +1920,6 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, */ - (void)_startEditingConnection { - // If not connecting, hide the connection status text to reflect changes if (!isConnecting) { [progressIndicatorText setHidden:YES]; @@ -1958,7 +1953,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [editButtonsView setHidden:YES]; [progressIndicatorText setHidden:YES]; - [(NSView *)favoritesOutlineView display]; + [favoritesOutlineView display]; } #endif @@ -1972,7 +1967,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [NSThread detachNewThreadWithName:SPCtxt(@"SPConnectionController close background disconnect", dbDocument) target:mySQLConnection selector:@selector(disconnect) object:nil]; [mySQLConnection autorelease]; mySQLConnection = nil; - } + } if (sshTunnel) [sshTunnel setConnectionStateChangeSelector:nil delegate:nil], SPClear(sshTunnel); } @@ -2082,8 +2077,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, } } - if(![self useCompression]) - [mySQLConnection removeClientFlags:SPMySQLClientFlagCompression]; + if(![self useCompression]) [mySQLConnection removeClientFlags:SPMySQLClientFlagCompression]; // Connection delegate must be set before actual connection attempt is made [mySQLConnection setDelegate:dbDocument]; @@ -2124,7 +2118,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, if (![mySQLConnection isConnected]) { if (!cancellingConnection) { - NSString *errorMessage = @""; + NSString *errorMessage; if (sshTunnel && [sshTunnel state] == SPMySQLProxyForwardingFailed) { errorMessage = [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to host %@ because the port connection via SSH was refused.\n\nPlease ensure that your MySQL host is set up to allow TCP/IP connections (no --skip-networking) and is configured to allow connections from the host you are tunnelling via.\n\nYou may also want to check the port is correct and that you have the necessary privileges.\n\nChecking the error detail will show the SSH debug log which may provide more details.\n\nMySQL said: %@", @"message of panel when SSH port forwarding failed"), [self host], [mySQLConnection lastErrorMessage]]; [[self onMainThread] failConnectionWithTitle:NSLocalizedString(@"SSH port forwarding failed", @"title when ssh tunnel port forwarding failed") errorMessage:errorMessage detail:[sshTunnel debugMessages] rawErrorText:[mySQLConnection lastErrorMessage]]; @@ -2279,10 +2273,10 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, if (useSSL && ([self type] == SPTCPIPConnection || [self type] == SPSocketConnection)) { if (![mySQLConnection isConnectedViaSSL]) { SPOnewayAlertSheet( - NSLocalizedString(@"SSL connection not established", @"SSL requested but not used title"), - [dbDocument parentWindow], - NSLocalizedString(@"You requested that the connection should be established using SSL, but MySQL made the connection without SSL.\n\nThis may be because the server does not support SSL connections, or has SSL disabled; or insufficient details were supplied to establish an SSL connection.\n\nThis connection is not encrypted.", @"SSL connection requested but not established error detail") - ); + NSLocalizedString(@"SSL connection not established", @"SSL requested but not used title"), + [dbDocument parentWindow], + NSLocalizedString(@"You requested that the connection should be established using SSL, but MySQL made the connection without SSL.\n\nThis may be because the server does not support SSL connections, or has SSL disabled; or insufficient details were supplied to establish an SSL connection.\n\nThis connection is not encrypted.", @"SSL connection requested but not established error detail") + ); } else { #ifndef SP_CODA @@ -2294,7 +2288,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, #ifndef SP_CODA // Re-enable favorites table view [favoritesOutlineView setEnabled:YES]; - [(NSView *)favoritesOutlineView display]; + [favoritesOutlineView display]; #endif // Release the tunnel if set - will now be retained by the connection @@ -2328,7 +2322,10 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [dbDocument setTitlebarStatus:NSLocalizedString(@"SSH Disconnected", @"SSH disconnected titlebar marker")]; #endif - [[self onMainThread] failConnectionWithTitle:NSLocalizedString(@"SSH connection failed!", @"SSH connection failed title") errorMessage:[theTunnel lastError] detail:[sshTunnel debugMessages] rawErrorText:[theTunnel lastError]]; + [[self onMainThread] failConnectionWithTitle:NSLocalizedString(@"SSH connection failed!", @"SSH connection failed title") + errorMessage:[theTunnel lastError] + detail:[sshTunnel debugMessages] + rawErrorText:[theTunnel lastError]]; } else if (newState == SPMySQLProxyConnected) { #ifndef SP_CODA @@ -3102,15 +3099,15 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, { if (error) { NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Favorites import error", @"favorites import error message") - defaultButton:NSLocalizedString(@"OK", @"OK") - alternateButton:nil - otherButton:nil - informativeTextWithFormat:NSLocalizedString(@"The following error occurred during the import process:\n\n%@", @"favorites import error informative message"), [error localizedDescription]]; + defaultButton:NSLocalizedString(@"OK", @"OK") + alternateButton:nil + otherButton:nil + informativeTextWithFormat:NSLocalizedString(@"The following error occurred during the import process:\n\n%@", @"favorites import error informative message"), [error localizedDescription]]; [alert beginSheetModalForWindow:[dbDocument parentWindow] - modalDelegate:self - didEndSelector:NULL - contextInfo:NULL]; + modalDelegate:nil + didEndSelector:NULL + contextInfo:NULL]; } } @@ -3263,120 +3260,120 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, - (void)registerForNotifications { [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(_documentWillClose:) - name:SPDocumentWillCloseNotification - object:dbDocument]; + selector:@selector(_documentWillClose:) + name:SPDocumentWillCloseNotification + object:dbDocument]; #ifndef SP_CODA [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(scrollViewFrameChanged:) - name:NSViewFrameDidChangeNotification - object:nil]; + selector:@selector(scrollViewFrameChanged:) + name:NSViewFrameDidChangeNotification + object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(_processFavoritesDataChange:) - name:SPConnectionFavoritesChangedNotification - object:nil]; + selector:@selector(_processFavoritesDataChange:) + name:SPConnectionFavoritesChangedNotification + object:nil]; // Registered to be notified of changes to connection information [self addObserver:self - forKeyPath:SPFavoriteTypeKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteTypeKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteNameKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteNameKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteHostKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteHostKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteUserKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteUserKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteColorIndexKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteColorIndexKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteDatabaseKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteDatabaseKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSocketKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSocketKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoritePortKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoritePortKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteUseSSLKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteUseSSLKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSHHostKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSHHostKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSHUserKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSHUserKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSHPortKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSHPortKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSHKeyLocationEnabledKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSHKeyLocationEnabledKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSHKeyLocationKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSHKeyLocationKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSLKeyFileLocationEnabledKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSLKeyFileLocationEnabledKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSLKeyFileLocationKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSLKeyFileLocationKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSLCertificateFileLocationEnabledKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSLCertificateFileLocationEnabledKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSLCertificateFileLocationKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSLCertificateFileLocationKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSLCACertFileLocationEnabledKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSLCACertFileLocationEnabledKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; [self addObserver:self - forKeyPath:SPFavoriteSSLCACertFileLocationKey - options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) - context:NULL]; + forKeyPath:SPFavoriteSSLCACertFileLocationKey + options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) + context:NULL]; #endif } @@ -3629,15 +3626,15 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, { if (error) { NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Favorites export error", @"favorites export error message") - defaultButton:NSLocalizedString(@"OK", @"OK") - alternateButton:nil - otherButton:nil - informativeTextWithFormat:NSLocalizedString(@"The following error occurred during the export process:\n\n%@", @"favorites export error informative message"), [error localizedDescription]]; - + defaultButton:NSLocalizedString(@"OK", @"OK") + alternateButton:nil + otherButton:nil + informativeTextWithFormat:NSLocalizedString(@"The following error occurred during the export process:\n\n%@", @"favorites export error informative message"), [error localizedDescription]]; + [alert beginSheetModalForWindow:[dbDocument parentWindow] - modalDelegate:self - didEndSelector:NULL - contextInfo:NULL]; + modalDelegate:self + didEndSelector:NULL + contextInfo:NULL]; } } #endif |