Skip to content

Commit

Permalink
fix: change condition to enable the Connect button (#106)
Browse files Browse the repository at this point in the history
The Connect button is now enabled if only the hostname field is
populated.
The Save button remains enabled only when both DSN nmae and hostname are
available.
  • Loading branch information
bpintea authored Feb 1, 2019
1 parent 6da03f0 commit 36c04bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions driver/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -2372,6 +2372,9 @@ SQLRETURN EsSQLDriverConnectW
assert(0 < res);
}
assert(attrs.driver.cnt || attrs.dsn.cnt);
/* Note: SAVEFILE and FILEDSN are markers for the DM, not the driver. The
* DM is supposed to read from / write into the file pointed to by these
* attributes. */

if (attrs.dsn.cnt) {
/* "The driver uses any information it retrieves from the system
Expand Down
11 changes: 9 additions & 2 deletions dsneditor/EsOdbcDsnEditor/DSNEditorForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,15 @@ private bool ValidateCertificateFile(string file)

private void EnableDisableActionButtons()
{
saveButton.Enabled = string.IsNullOrEmpty(textName.Text) == false
&& string.IsNullOrEmpty(textHostname.Text) == false;
if (isConnecting) {
// If connecting, enable the button if we have a hostname.
// This can be triggered by app connecting or FileDSN verifying the connection.
saveButton.Enabled = string.IsNullOrEmpty(textHostname.Text) == false;
} else {
// If editing a (User/System) DSN, enable the buton if both DSN name and hostname are available.
saveButton.Enabled = string.IsNullOrEmpty(textName.Text) == false
&& string.IsNullOrEmpty(textHostname.Text) == false;
}
testButton.Enabled = string.IsNullOrEmpty(textHostname.Text) == false;
}

Expand Down

0 comments on commit 36c04bf

Please sign in to comment.