From 20d2415bac3ccfabe525c184bd249fb38c3d731d Mon Sep 17 00:00:00 2001 From: dpage Date: Wed, 27 May 2009 13:36:54 +0000 Subject: [PATCH] Prevent the OK button being activated by even when it's disabled. Seems to be a wxWidgets issue. [Ashesh Vashi] git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@7885 a7884b65-44f6-0310-8a51-81a127f17b15 --- pgadmin/dlg/dlgAddFavourite.cpp | 4 ++++ pgadmin/dlg/dlgClasses.cpp | 8 ++++++++ pgadmin/dlg/dlgDatabase.cpp | 4 ++++ pgadmin/dlg/dlgEditGridOptions.cpp | 4 ++++ pgadmin/dlg/dlgHbaConfig.cpp | 4 ++++ pgadmin/dlg/dlgMainConfig.cpp | 4 ++++ pgadmin/dlg/dlgPgpassConfig.cpp | 6 +++++- pgadmin/dlg/dlgProperty.cpp | 8 ++++++++ pgadmin/dlg/dlgSelectConnection.cpp | 4 ++++ pgadmin/dlg/dlgServer.cpp | 4 ++++ pgadmin/dlg/dlgTable.cpp | 4 ++++ pgadmin/slony/dlgRepCluster.cpp | 4 ++++ 12 files changed, 57 insertions(+), 1 deletion(-) diff --git a/pgadmin/dlg/dlgAddFavourite.cpp b/pgadmin/dlg/dlgAddFavourite.cpp index 9a1aa9a1f..50f43c299 100644 --- a/pgadmin/dlg/dlgAddFavourite.cpp +++ b/pgadmin/dlg/dlgAddFavourite.cpp @@ -88,6 +88,10 @@ dlgAddFavourite::~dlgAddFavourite() void dlgAddFavourite::OnOK(wxCommandEvent& ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif EndModal(wxID_OK); } diff --git a/pgadmin/dlg/dlgClasses.cpp b/pgadmin/dlg/dlgClasses.cpp index c3cadd8e3..d2e620084 100644 --- a/pgadmin/dlg/dlgClasses.cpp +++ b/pgadmin/dlg/dlgClasses.cpp @@ -474,6 +474,10 @@ void ExecutionDialog::Abort() void ExecutionDialog::OnOK(wxCommandEvent& ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif if (!thread) { wxString sql=GetSql(); @@ -581,6 +585,10 @@ ExternProcessDialog::~ExternProcessDialog() void ExternProcessDialog::OnOK(wxCommandEvent& ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif if (!done) Execute(0); else diff --git a/pgadmin/dlg/dlgDatabase.cpp b/pgadmin/dlg/dlgDatabase.cpp index 147f517dc..34195754f 100644 --- a/pgadmin/dlg/dlgDatabase.cpp +++ b/pgadmin/dlg/dlgDatabase.cpp @@ -330,6 +330,10 @@ void dlgDatabase::OnChangeRestr(wxCommandEvent &ev) void dlgDatabase::OnOK(wxCommandEvent &ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif if (database) { database->iSetSchemaRestriction(txtSchemaRestr->GetValue().Trim()); diff --git a/pgadmin/dlg/dlgEditGridOptions.cpp b/pgadmin/dlg/dlgEditGridOptions.cpp index 95d3e1565..44fad85c9 100644 --- a/pgadmin/dlg/dlgEditGridOptions.cpp +++ b/pgadmin/dlg/dlgEditGridOptions.cpp @@ -272,6 +272,10 @@ void dlgEditGridOptions::OnClose(wxCloseEvent &ev) void dlgEditGridOptions::OnOK(wxCommandEvent &ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif // Check the filter syntax if (!Validate()) return; diff --git a/pgadmin/dlg/dlgHbaConfig.cpp b/pgadmin/dlg/dlgHbaConfig.cpp index 09c4b7c2a..d123c2f03 100644 --- a/pgadmin/dlg/dlgHbaConfig.cpp +++ b/pgadmin/dlg/dlgHbaConfig.cpp @@ -366,6 +366,10 @@ void dlgHbaConfig::OnChange(wxCommandEvent& ev) void dlgHbaConfig::OnOK(wxCommandEvent& ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif line->isComment = !chkEnabled->GetValue(); line->connectType = (pgHbaConfigLine::pgHbaConnectType)cbType->GetCurrentSelection(); line->database = database; diff --git a/pgadmin/dlg/dlgMainConfig.cpp b/pgadmin/dlg/dlgMainConfig.cpp index 78d0d932e..e564449c3 100644 --- a/pgadmin/dlg/dlgMainConfig.cpp +++ b/pgadmin/dlg/dlgMainConfig.cpp @@ -156,6 +156,10 @@ void dlgMainConfig::OnChange(wxCommandEvent& ev) void dlgMainConfig::OnOK(wxCommandEvent& ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif item->newLine->value = GetValue(); item->newLine->comment = txtComment->GetValue(); item->newLine->isComment = !chkEnabled->GetValue(); diff --git a/pgadmin/dlg/dlgPgpassConfig.cpp b/pgadmin/dlg/dlgPgpassConfig.cpp index 78a6d8f55..628e47e05 100644 --- a/pgadmin/dlg/dlgPgpassConfig.cpp +++ b/pgadmin/dlg/dlgPgpassConfig.cpp @@ -91,13 +91,17 @@ void dlgPgpassConfig::OnChange(wxCommandEvent& ev) if (passwd.IsEmpty()||(passwd.Length() >1)) { if (!passwd.compare(repasswd)) - btnOK->Enable(); + btnOK->Enable(); } } void dlgPgpassConfig::OnOK(wxCommandEvent& ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif line->isComment = !chkEnabled->GetValue(); line->hostname = txtHostname->GetValue(); line->port = txtPort->GetValue(); diff --git a/pgadmin/dlg/dlgProperty.cpp b/pgadmin/dlg/dlgProperty.cpp index b92c7e524..51a3e5a16 100644 --- a/pgadmin/dlg/dlgProperty.cpp +++ b/pgadmin/dlg/dlgProperty.cpp @@ -884,6 +884,10 @@ void dlgProperty::OnApply(wxCommandEvent &ev) void dlgProperty::OnOK(wxCommandEvent &ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif if (!IsUpToDate()) { if (wxMessageBox(wxT("The object has been changed by another user. Do you wish to continue to to try to update it?"), wxT("Overwrite changes?"), wxYES_NO) == wxNO) @@ -1786,6 +1790,10 @@ bool dlgAgentProperty::executeSql() void dlgAgentProperty::OnOK(wxCommandEvent &ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif if (!IsUpToDate()) { if (wxMessageBox(wxT("The object has been changed by another user. Do you wish to continue to to try to update it?"), wxT("Overwrite changes?"), wxYES_NO) == wxNO) diff --git a/pgadmin/dlg/dlgSelectConnection.cpp b/pgadmin/dlg/dlgSelectConnection.cpp index 58e6ef180..37d0633ed 100644 --- a/pgadmin/dlg/dlgSelectConnection.cpp +++ b/pgadmin/dlg/dlgSelectConnection.cpp @@ -167,6 +167,10 @@ void dlgSelectConnection::OnTextChange(wxCommandEvent& ev) void dlgSelectConnection::OnOK(wxCommandEvent& ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif if (cbDatabase->GetCurrentSelection() == wxNOT_FOUND || cbServer->GetCurrentSelection() == wxNOT_FOUND) remoteServer = NULL; diff --git a/pgadmin/dlg/dlgServer.cpp b/pgadmin/dlg/dlgServer.cpp index a7a3905aa..3d4212dae 100644 --- a/pgadmin/dlg/dlgServer.cpp +++ b/pgadmin/dlg/dlgServer.cpp @@ -118,6 +118,10 @@ pgObject *dlgServer::GetObject() void dlgServer::OnOK(wxCommandEvent &ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif // Display the 'save password' hint if required if(chkStorePwd->GetValue()) { diff --git a/pgadmin/dlg/dlgTable.cpp b/pgadmin/dlg/dlgTable.cpp index 3c726577e..85ed49b0d 100644 --- a/pgadmin/dlg/dlgTable.cpp +++ b/pgadmin/dlg/dlgTable.cpp @@ -1598,6 +1598,10 @@ void dlgTable::OnChangeTable(wxCommandEvent &ev) void dlgTable::OnOK(wxCommandEvent &ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif if (lstColumns->GetItemCount() > 0 && !hasPK && frmHint::ShowHint(this, HINT_PRIMARYKEY) == wxID_CANCEL) return; diff --git a/pgadmin/slony/dlgRepCluster.cpp b/pgadmin/slony/dlgRepCluster.cpp index 678f13f9a..265fb8082 100644 --- a/pgadmin/slony/dlgRepCluster.cpp +++ b/pgadmin/slony/dlgRepCluster.cpp @@ -492,6 +492,10 @@ bool dlgRepCluster::CopyTable(pgConn *from, pgConn *to, const wxString &table) void dlgRepCluster::OnOK(wxCommandEvent &ev) { +#ifdef __WXGTK__ + if (!btnOK->IsEnabled()) + return; +#endif EnableOK(false); bool done=true; -- 2.39.5