aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-02-21 00:28:09 +0000
committerrowanbeentje <rowan@beent.je>2009-02-21 00:28:09 +0000
commitbb8dfb0ad769b551ad2fd6944315c5292246ad7e (patch)
tree47090a471fcaa0af89ef02a719f2a4ba18538f3d /Source
parent966867d3544e70e8fde0d2dbec8ef32d674925b1 (diff)
downloadsequelpro-bb8dfb0ad769b551ad2fd6944315c5292246ad7e.tar.gz
sequelpro-bb8dfb0ad769b551ad2fd6944315c5292246ad7e.tar.bz2
sequelpro-bb8dfb0ad769b551ad2fd6944315c5292246ad7e.zip
Deselect favorites when any detail other than the password is edited. This improves clarity, but also fixes an issue: if a connection with amended details failed, the default favourite details are reloaded in the sheet if a favorite is selected. This change allows a connection to fail and the actual used details to be reshown in the sheet.
Diffstat (limited to 'Source')
-rw-r--r--Source/TableDocument.h3
-rw-r--r--Source/TableDocument.m16
2 files changed, 19 insertions, 0 deletions
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 52429c7b..61b770c3 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -203,6 +203,9 @@
- (void)willQueryString:(NSString *)query;
- (void)queryGaveError:(NSString *)error;
+// Connection sheet delegate methods
+- (void) controlTextDidChange:(NSNotification *)aNotification;
+
//splitView delegate methods
- (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview;
- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 10ef7dca..6fae3a0b 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1515,6 +1515,22 @@ invoked when query gave an error
[self showErrorInConsole:[NSString stringWithFormat:@"/* ERROR %@ */ %@;\n", currentTime, error]];
}
+#pragma mark Connection sheet delegate methods
+
+/**
+ * When a favorite is selected, and the connection details are edited, deselect the favorite;
+ * this is clearer and also prevents a failed connection from being repopulated with the
+ * favorite's details instead of the last used details.
+ * This method allows the password to be changed without altering the selection.
+ */
+- (void) controlTextDidChange:(NSNotification *)aNotification
+{
+ if ([aNotification object] == hostField || [aNotification object] == userField || [aNotification object] == databaseField
+ || [aNotification object] == socketField || [aNotification object] == portField) {
+ [favoritesController setSelectionIndexes:[NSIndexSet indexSet]];
+ }
+}
+
#pragma mark SplitView delegate methods
/**