From 3cfe628ecc4b51ff2e1013f2260ef5f056db8b97 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Fri, 14 Dec 2012 23:05:55 +0000 Subject: - Fix favourite editing on the connection interface being unable to delete some properties --- Source/SPConnectionController.m | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'Source') diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index d1d7ba2f..1da6b46f 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -1150,50 +1150,72 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [theFavorite setObject:[NSNumber numberWithInteger:[self type]] forKey:SPFavoriteTypeKey]; if ([self host]) { [theFavorite setObject:[self host] forKey:SPFavoriteHostKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteHostKey]; } if ([self socket]) { [theFavorite setObject:[self socket] forKey:SPFavoriteSocketKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteSocketKey]; } if ([self user]) { [theFavorite setObject:[self user] forKey:SPFavoriteUserKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteUserKey]; } if ([self port]) { [theFavorite setObject:[self port] forKey:SPFavoritePortKey]; + } else { + [theFavorite removeObjectForKey:SPFavoritePortKey]; } if ([self database]) { [theFavorite setObject:[self database] forKey:SPFavoriteDatabaseKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteDatabaseKey]; } // SSL details - if ([self useSSL]) { - [theFavorite setObject:[NSNumber numberWithInteger:[self useSSL]] forKey:SPFavoriteUseSSLKey]; - } + [theFavorite setObject:[NSNumber numberWithInteger:[self useSSL]] forKey:SPFavoriteUseSSLKey]; [theFavorite setObject:[NSNumber numberWithInteger:[self sslKeyFileLocationEnabled]] forKey:SPFavoriteSSLKeyFileLocationEnabledKey]; if ([self sslKeyFileLocation]) { [theFavorite setObject:[self sslKeyFileLocation] forKey:SPFavoriteSSLKeyFileLocationKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteSSLKeyFileLocationKey]; } [theFavorite setObject:[NSNumber numberWithInteger:[self sslCertificateFileLocationEnabled]] forKey:SPFavoriteSSLCertificateFileLocationEnabledKey]; if ([self sslCertificateFileLocation]) { [theFavorite setObject:[self sslCertificateFileLocation] forKey:SPFavoriteSSLCertificateFileLocationKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteSSLCertificateFileLocationKey]; } [theFavorite setObject:[NSNumber numberWithInteger:[self sslCACertFileLocationEnabled]] forKey:SPFavoriteSSLCACertFileLocationEnabledKey]; if ([self sslCACertFileLocation]) { [theFavorite setObject:[self sslCACertFileLocation] forKey:SPFavoriteSSLCACertFileLocationKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteSSLCACertFileLocationKey]; } // SSH details if ([self sshHost]) { [theFavorite setObject:[self sshHost] forKey:SPFavoriteSSHHostKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteSSHHostKey]; } if ([self sshUser]) { [theFavorite setObject:[self sshUser] forKey:SPFavoriteSSHUserKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteSSHUserKey]; } if ([self sshPort]) { [theFavorite setObject:[self sshPort] forKey:SPFavoriteSSHPortKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteSSHPortKey]; } [theFavorite setObject:[NSNumber numberWithInteger:[self sshKeyLocationEnabled]] forKey:SPFavoriteSSHKeyLocationEnabledKey]; if ([self sshKeyLocation]) { [theFavorite setObject:[self sshKeyLocation] forKey:SPFavoriteSSHKeyLocationKey]; + } else { + [theFavorite removeObjectForKey:SPFavoriteSSHKeyLocationKey]; } -- cgit v1.2.3