void dlgExtTable::CheckChange() { wxString name = GetName(); if(!name.IsEmpty()) { if (extTable) EnableOK(txtComment->GetValue() != extTable->GetComment() || txtSqlBox->GetText() != oldDefinition || cbOwner->GetValue() != extTable->GetOwner() || name != extTable->GetName()); else EnableOK(!txtComment->GetValue().IsEmpty() || !txtSqlBox->GetText().IsEmpty() || !cbOwner->GetValue().IsEmpty()); } else { bool enable = true; CheckValid(enable, !name.IsEmpty(), _("Please specify name.")); CheckValid(enable, txtSqlBox->GetText().Length() > 0 , _("Please enter external table definition.")); EnableOK(enable); } }
int dlgRepSubscription::Go(bool modal) { txtOrigin->SetValue(NumToStr(set->GetOriginId())); if (subscription) { // edit mode chkForward->SetValue(subscription->GetForward()); txtReceiver->SetValue(IdAndName(subscription->GetReceiverId(), subscription->GetReceiverNode())); } else { // create mode txtReceiver->SetValue(IdAndName(cluster->GetLocalNodeID(), cluster->GetLocalNodeName())); if (cluster->ClusterMinimumVersion(1, 1)) { // This is very ugly: starting with Slony-I 1.1, this must be called on the provider, // not on the receiver. stProvider->SetLabel(_("Receiver")); stReceiver->SetLabel(_("Provider")); } } if (set->GetOriginId() == cluster->GetLocalNodeID() && subscription) { chkForward->SetValue(subscription->GetForward()); cbProvider->Append(IdAndName(subscription->GetProviderId(), subscription->GetProviderNode())); cbProvider->SetSelection(0); cbProvider->Disable(); chkForward->Disable(); EnableOK(false); } else { pgSet *sets = connection->ExecuteSet( wxT("SELECT no_id, no_comment\n") wxT(" FROM ") + cluster->GetSchemaPrefix() + wxT("sl_node\n") wxT(" WHERE no_active AND no_id <> ") + NumToStr(cluster->GetLocalNodeID())); if (sets) { while (!sets->Eof()) { cbProvider->Append(IdAndName(sets->GetLong(wxT("no_id")), sets->GetVal(wxT("no_comment"))), (void*)sets->GetLong(wxT("no_id"))); if (subscription && sets->GetLong(wxT("no_id")) == subscription->GetProviderId()) cbProvider->SetSelection(cbProvider->GetCount()-1); sets->MoveNext(); } delete sets; } } if (!subscription && cbProvider->GetCount()) { cbProvider->SetSelection(0); EnableOK(true); } return dlgProperty::Go(modal); }
void dlgEventTrigger::CheckChange() { bool enable = true; wxString function = cbFunction->GetValue(); wxString name = GetName(); wxString owner = cbOwner->GetValue(); (chkEnable->GetValue()) ? rdbEnableStatus->Enable() : rdbEnableStatus->Disable(); CheckValid(enable, !name.IsEmpty(), _("Please specify event trigger name.")); CheckValid(enable, !owner.IsEmpty(), _("Please specify owner of event trigger.")); CheckValid(enable, !function.IsEmpty(), _("Please specify event trigger function.")); if (eventTrigger) { EnableOK(enable && (txtComment->GetValue() != eventTrigger->GetComment() || txtName->GetValue() != eventTrigger->GetName() || txtWhen->GetValue() != eventTrigger->GetWhen() || chkEnable->GetValue() != eventTrigger->GetEnabled() || rdbEvents->GetStringSelection().Lower() != eventTrigger->GetEventName().Lower() || rdbEnableStatus->GetStringSelection().Lower() != eventTrigger->GetEnableStatus().Lower() || !function.IsEmpty() || !owner.IsEmpty() ) ); } else { EnableOK(enable); } }
void dlgRepTable::CheckChange() { if (table) { bool tgChanged = false; unsigned int i; int cnt = 0; for (i = 0 ; !tgChanged && i < chkTrigger->GetCount() ; i++) { if (chkTrigger->IsChecked(i)) { cnt++; if (table->GetTriggers().Index(chkTrigger->GetString(i)) < 0) tgChanged = true; } } EnableOK(tgChanged || (int)table->GetTriggers().GetCount() != cnt || txtComment->GetValue() != table->GetComment()); } else { bool enable = true; CheckValid(enable, cbTable->GetGuessedSelection() >= 0, _("Please select table to replicate.")); CheckValid(enable, cbIndex->GetCurrentSelection() >= 0, _("Please select index.")); EnableOK(enable); } }
void dlgFunction::CheckChange() { wxString name = GetName(); bool isC = cbLanguage->GetValue().IsSameAs(wxT("C"), false); bool enable = true, didChange = true; CheckValid(enable, !name.IsEmpty(), _("Please specify name.")); if (!isProcedure) CheckValid(enable, cbReturntype->GetValue().Trim() != wxEmptyString, _("Please select return type.")); if (!(isProcedure && connection->GetIsEdb())) CheckValid(enable, cbLanguage->GetGuessedSelection() >= 0, _("Please select language.")); if (isC) { wxString objfile = txtObjectFile->GetValue(); CheckValid(enable, !objfile.IsEmpty() && objfile != TXTOBJ_LIB, _("Please specify object library.")); } else { CheckValid(enable, !txtSqlBox->GetText().IsEmpty(), _("Please enter function source code.")); } if (function && enable) { if (seclabelPage && connection->BackendMinimumVersion(9, 1)) enable = enable || !(seclabelPage->GetSqlForSecLabels().IsEmpty()); EnableOK(enable && !GetSql().IsEmpty()); } else { EnableOK(enable && didChange); } }
void dlgRole::CheckChange() { bool timEn=datValidUntil->GetValue().IsValid(); timValidUntil->Enable(timEn); if (!timEn) timValidUntil->SetTime(wxDefaultDateTime); if (!readOnly) chkUpdateCat->Enable(chkSuperuser->GetValue()); // Check the passwords match if (txtPasswd->GetValue() != txtRePasswd->GetValue()) { bool enable=true; CheckValid(enable, false, _("The passwords entered do not match!")); EnableOK(enable); return; } if (!role) { wxString name=GetName(); bool enable=true; CheckValid(enable, !name.IsEmpty(), _("Please specify name.")); EnableOK(enable); } else { EnableOK(!GetSql().IsEmpty()); } }
void dlgRepCluster::CheckChange() { if (cluster) { int sel = cbAdminNode->GetCurrentSelection(); bool changed = (sel >= 0 && (long)cbAdminNode->wxEvtHandler::GetClientData() != cluster->GetAdminNodeID()); EnableOK(changed || txtComment->GetValue() != cluster->GetComment()); } else { size_t i; bool enable = true; CheckValid(enable, chkJoinCluster->GetValue() || (!createScript.IsEmpty()), _("Slony-I creation scripts not available; only joining possible.")); if (chkJoinCluster->GetValue()) CheckValid(enable, !cbClusterName->GetValue().IsEmpty(), _("Please select a cluster name.")); else CheckValid(enable, !txtClusterName->GetValue().IsEmpty(), _("Please specify name.")); long nodeId = StrToLong(txtNodeID->GetValue()); CheckValid(enable, nodeId > 0, _("Please specify local node ID.")); for (i = 0 ; i < usedNodes.GetCount() && enable; i++) CheckValid(enable, nodeId != usedNodes[i], _("Node ID is already in use.")); CheckValid(enable, !txtNodeName->GetValue().IsEmpty(), _("Please specify local node name.")); txtAdminNodeName->Enable(nodeId != StrToLong(txtAdminNodeID->GetValue())); EnableOK(enable); } }
void dlgColumn::CheckChange() { bool enable = true; long varlen = StrToLong(txtLength->GetValue()), varprec = StrToLong(txtPrecision->GetValue()); if (column) { txtPrecision->Enable(column->GetTable()->GetMetaType() != PGM_VIEW && isVarPrec && varlen > 0); CheckValid(enable, cbDatatype->GetGuessedSelection() >= 0, _("Please select a datatype.")); if (!connection->BackendMinimumVersion(7, 5)) { CheckValid(enable, !isVarLen || !txtLength->GetValue().IsEmpty() || varlen >= column->GetLength(), _("New length must not be less than old length.")); CheckValid(enable, !txtPrecision->IsEnabled() || varprec >= column->GetPrecision(), _("New precision must not be less than old precision.")); CheckValid(enable, !txtPrecision->IsEnabled() || varlen - varprec >= column->GetLength() - column->GetPrecision(), _("New total digits must not be less than old total digits.")); } if (enable) enable = GetName() != column->GetName() || txtDefault->GetValue() != column->GetDefault() || txtComment->GetValue() != column->GetComment() || chkNotNull->GetValue() != column->GetNotNull() || (cbDatatype->GetCount() > 1 && cbDatatype->GetGuessedStringSelection() != column->GetRawTypename() && !column->GetIsArray()) || (cbDatatype->GetCount() > 1 && cbDatatype->GetGuessedStringSelection() != column->GetRawTypename() + wxT("[]") && column->GetIsArray()) || (!cbCollation->GetValue().IsEmpty() && cbCollation->GetValue() != column->GetCollation()) || (isVarLen && varlen != column->GetLength()) || (isVarPrec && varprec != column->GetPrecision()) || txtAttstattarget->GetValue() != NumToStr(column->GetAttstattarget()) || cbStorage->GetValue() != column->GetStorage() || dirtyVars; if (seclabelPage && connection->BackendMinimumVersion(9, 1)) enable = enable || !(seclabelPage->GetSqlForSecLabels().IsEmpty()); EnableOK(enable || securityChanged); } else { txtPrecision->Enable(isVarPrec && varlen > 0); wxString name = GetName(); CheckValid(enable, !name.IsEmpty(), _("Please specify name.")); CheckValid(enable, cbDatatype->GetGuessedSelection() >= 0, _("Please select a datatype.")); CheckValid(enable, !isVarLen || txtLength->GetValue().IsEmpty() || (varlen >= minVarLen && varlen <= maxVarLen && NumToStr(varlen) == txtLength->GetValue()), _("Please specify valid length.")); CheckValid(enable, !txtPrecision->IsEnabled() || (varprec >= 0 && varprec <= varlen && NumToStr(varprec) == txtPrecision->GetValue()), _("Please specify valid numeric precision (0..") + NumToStr(varlen) + wxT(").")); EnableOK(enable); } }
void frmGrantWizard::OnChange(wxCommandEvent &event) { sqlPane->SetReadOnly(false); sqlPane->SetText(GetSql()); sqlPane->SetReadOnly(true); if (sqlPane->GetText().IsEmpty()) EnableOK(false); else EnableOK(true); }
void dlgRepNode::CheckChange() { if (node) { EnableOK(txtComment->GetValue() != node->GetComment()); } else { bool enable = true; EnableOK(enable); } }
void dlgRepSet::CheckChange() { if (set) { EnableOK(txtComment->GetValue() != set->GetComment()); } else { bool enable = (!txtComment->IsEmpty()); EnableOK(enable); } }
void dlgRepSequence::CheckChange() { if (sequence) { EnableOK(txtComment->GetValue() != sequence->GetComment()); } else { bool enable = true; CheckValid(enable, cbSequence->GetGuessedSelection() >= 0, _("Please select sequence to replicate.")); EnableOK(enable); } }
void GenerateDlg::OnStart(wxCommandEvent& evt) { prjFrame->GenerateStarted(); EnableOK(0, 0); ed->AppendText("---------- Start ----------\r\n"); canceled = 0; paused = 0; int sel = rateWnd->GetCurrentSelection(); if (sel != wxNOT_FOUND) updateRate = (long) rateWnd->GetClientData(sel); if (!genAuto) { playFrom = GetTimeValue("IDC_PLAY_FROM"); playTo = GetTimeValue("IDC_PLAY_TO"); } if (playSome) { theProject->StartTime(playFrom); theProject->EndTime(playTo); startTime = playFrom; } else { theProject->StartTime(0); theProject->EndTime(0); startTime = 0; } lastTime = 0; theProject->PlayMode(playLive); lastMsg = ""; FormatTime("IDC_TIME", startTime); tml->Reset(); lpkMtr->Reset(); rpkMtr->Reset(); lftPeak = 0; rgtPeak = 0; lftMax = 0; rgtMax = 0; FormatPeak(); prjGenerate = static_cast<GenerateWindow*>(this); theProject->CallbackRate((float)updateRate / 10.0f); if (theProject->Start() == 0) EnableOK(0, 1); else EnableOK(1, 0); }
void dlgIndexBase::CheckChange() { if (index) { EnableOK(txtComment->GetValue() != index->GetComment() || cbTablespace->GetOIDKey() != index->GetTablespaceOid()); } else { bool enable=true; txtComment->Enable(!GetName().IsEmpty()); CheckValid(enable, lstColumns->GetItemCount() > 0, _("Please specify columns.")); EnableOK(enable); } }
BOOL CExportDlg::OnInitDialog() { CDialog::OnInitDialog(); VERIFY(m_taskSel.Create(IDC_FRAME, this)); // set initial control states GetDlgItem(IDC_TASKLISTOPTIONS)->EnableWindow(!m_bSingleTaskList); GetDlgItem(IDC_EXPORTONEFILE)->EnableWindow(!m_bSingleTaskList && m_nExportOption == ALLTASKLISTS); m_eExportPath.SetFilter(m_mgrImportExport.GetExporterFileFilter(s_nFormatOption)); m_eExportPath.EnableStyle(FES_FOLDERS, (m_nExportOption == ALLTASKLISTS && !m_bExportOneFile)); // build the format comboxbox for (int nExp = 0; nExp < m_mgrImportExport.GetNumExporters(); nExp++) { m_cbFormat.AddString(m_mgrImportExport.GetExporterMenuText(nExp)); } m_cbFormat.SetCurSel(s_nFormatOption); m_eExportPath.EnableWindow(m_mgrImportExport.ExporterHasFileExtension(s_nFormatOption)); EnableOK(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CTDLImportDialog::OnSelchangeFormatoptions() { BOOL bHadFilter = m_mgrImportExport.ImporterHasFileExtension(m_nFormatOption); UpdateData(TRUE); // change the filter on the CFileEdit and clear the filepath // and clear/restore clipboard text depending BOOL bHasFilter = CurImporterHasFilter(); m_eFilePath.SetFilter(GetCurImporterFilter()); m_eFilePath.EnableWindow(bHasFilter); GetDlgItem(IDC_FROMFILE)->EnableWindow(bHasFilter); GetDlgItem(IDC_FROMFILEPATH)->EnableWindow(!m_bFromClipboard && bHasFilter); GetDlgItem(IDC_FROMCLIPBOARD)->EnableWindow(bHasFilter); GetDlgItem(IDC_FROMCLIPBOARDTEXT)->EnableWindow(m_bFromClipboard && bHasFilter); GetDlgItem(IDC_REFRESHCLIPBOARD)->EnableWindow(m_bFromClipboard && bHasFilter); if (bHadFilter && !bHasFilter) { GetDlgItem(IDC_FROMCLIPBOARDTEXT)->GetWindowText(m_sClipboardText); // update GetDlgItem(IDC_FROMCLIPBOARDTEXT)->SetWindowText(_T("")); // clear field } else if (!bHadFilter && bHasFilter) { GetDlgItem(IDC_FROMCLIPBOARDTEXT)->SetWindowText(m_sClipboardText); // restore field } m_sFromFilePath.Empty(); UpdateData(FALSE); EnableOK(); }
void dlgGroup::CheckChange() { if (group) { EnableOK(!GetSql().IsEmpty()); } else { wxString name = GetName(); bool enable = true; CheckValid(enable, !name.IsEmpty(), _("Please specify name.")); EnableOK(enable); } }
void dlgDatabase::OnOK(wxCommandEvent &ev) { #ifdef __WXGTK__ if (!btnOK->IsEnabled()) return; #endif if (database) { database->iSetSchemaRestriction(txtSchemaRestr->GetValue().Trim()); settings->Write(wxString::Format(wxT("Servers/%d/Databases/%s/SchemaRestriction"), database->GetServer()->GetServerIndex(), database->GetName().c_str()), txtSchemaRestr->GetValue().Trim()); /* * The connection from the database will get disconnected before execution of any * sql statements for the database. * * Hence, we need to hack the execution of the default privileges statements(sqls) * before getting disconnected from this database. So that, these statements will * run against the current database connection, and not against the server connection. */ // defaultSecurityChanged will be true only for PostgreSQL 9.0 or later if (defaultSecurityChanged) { wxString strDefPrivs = GetDefaultPrivileges(); if (!executeDDLSql(strDefPrivs)) { EnableOK(true); return; } defaultSecurityChanged = false; } } dlgDefaultSecurityProperty::OnOK(ev); }
void dlgRepSubscription::CheckChange() { if (subscription) { int sel = cbProvider->GetCurrentSelection(); EnableOK(sel >= 0 && (chkForward->GetValue() != subscription->GetForward() || (long)cbProvider->wxItemContainer::GetClientData(sel) != subscription->GetProviderId())); } else { bool enable = true; EnableOK(enable); } }
void dlgDomain::CheckChange() { bool enable = true; if (domain) { enable = false; if (connection->BackendMinimumVersion(7, 4) || lstColumns->GetItemCount() > 0) { enable = !GetSql().IsEmpty(); } if (seclabelPage && connection->BackendMinimumVersion(9, 1)) enable = enable || !(seclabelPage->GetSqlForSecLabels().IsEmpty()); } else { wxString name = GetName(); long varlen = StrToLong(txtLength->GetValue()), varprec = StrToLong(txtPrecision->GetValue()); txtPrecision->Enable(isVarPrec && varlen > 0); CheckValid(enable, !name.IsEmpty(), _("Please specify name.")); CheckValid(enable, cbDatatype->GetGuessedSelection() >= 0, _("Please select a datatype.")); CheckValid(enable, !isVarLen || txtLength->GetValue().IsEmpty() || (varlen >= minVarLen && varlen <= maxVarLen && NumToStr(varlen) == txtLength->GetValue()), _("Please specify valid length.")); CheckValid(enable, !txtPrecision->IsEnabled() || (varprec >= 0 && varprec <= varlen && NumToStr(varprec) == txtPrecision->GetValue()), _("Please specify valid numeric precision (0..") + NumToStr(varlen) + wxT(").")); } EnableOK(enable); }
void dlgIndexConstraint::CheckChange() { if (cbIndex->GetCurrentSelection() > 0) EnableOK(true); else dlgIndexBase::CheckChange(); }
void dlgUserMapping::CheckChange() { bool didChange = true; if (usermapping) { didChange = GetOptionsSql().Length() > 0; EnableOK(didChange); } else { bool enable = true; CheckValid(enable, !cbUser->GetValue().IsEmpty(), _("Please specify user.")); EnableOK(enable); } }
void dlgTrigger::CheckChange() { bool enable = true; wxString function = cbFunction->GetValue(); wxString name = GetName(); // We can only have per-statement TRUNCATE triggers if (trigger || connection->BackendMinimumVersion(8, 4)) { if (chkRow->GetValue()) { chkTruncate->Disable(); chkTruncate->SetValue(false); } else if (connection->EdbMinimumVersion(8, 0)) chkTruncate->Enable(); } CheckValid(enable, !name.IsEmpty(), _("Please specify name.")); CheckValid(enable, !function.IsEmpty(), _("Please specify trigger function.")); CheckValid(enable, chkInsert->GetValue() || chkUpdate->GetValue() || chkDelete->GetValue() || chkTruncate->GetValue(), _("Please specify at least one action.")); if (cbFunction->GetValue() == wxString::Format(wxT("<%s>"), _("Inline EDB-SPL"))) CheckValid(enable, !txtBody->GetText().IsEmpty(), _("Please specify trigger body.")); if (trigger) { EnableOK(enable && (txtComment->GetValue() != trigger->GetComment() || txtName->GetValue() != trigger->GetName() || (txtBody->GetText() != trigger->GetSource() && cbFunction->GetValue() == wxString::Format(wxT("<%s>"), _("Inline EDB-SPL"))) || txtWhen->GetValue() != trigger->GetWhen() || chkRow->GetValue() != (trigger->GetTriggerType() & TRIGGER_TYPE_ROW ? true : false) || chkInsert->GetValue() != (trigger->GetTriggerType() & TRIGGER_TYPE_INSERT ? true : false) || chkUpdate->GetValue() != (trigger->GetTriggerType() & TRIGGER_TYPE_UPDATE ? true : false) || chkDelete->GetValue() != (trigger->GetTriggerType() & TRIGGER_TYPE_DELETE ? true : false) || chkTruncate->GetValue() != (trigger->GetTriggerType() & TRIGGER_TYPE_TRUNCATE ? true : false) || rdbFires->GetSelection() != (trigger->GetTriggerType() & TRIGGER_TYPE_BEFORE ? 0 : (trigger->GetTriggerType() & TRIGGER_TYPE_INSTEAD ? 2 : 1)))); } else { EnableOK(enable); } }
void dlgRepSetMove::CheckChange() { bool enable = true; CheckValid(enable, cbTargetNode->GetCount() > 0 , _("No node available to move this set to.")); CheckValid(enable, cbTargetNode->GetCurrentSelection() >= 0, _("Please select node to move this replication set to.")); EnableOK(enable); }
void dlgRepSetMerge::CheckChange() { bool enable = true; CheckValid(enable, cbTargetID->GetCount() > 0 , _("No set available to merge to.")); CheckValid(enable, cbTargetID->GetCurrentSelection() >= 0, _("Please select replication set to merged to.")); EnableOK(enable); }
void dlgCheck::CheckChange() { bool enable = true; if (check) { enable = txtName->GetValue() != check->GetName() || txtComment->GetValue() != check->GetComment(); if (connection->BackendMinimumVersion(9, 2) && !check->GetValid() && !chkDontValidate->GetValue()) enable = true; EnableOK(enable); } else { txtComment->Enable(!GetName().IsEmpty()); CheckValid(enable, !txtWhere->GetValue().IsEmpty(), _("Please specify condition.")); EnableOK(enable); } }
void dlgSchema::CheckChange() { wxString name=GetName(); if (schema) { EnableOK(name != schema->GetName() || txtComment->GetValue() != schema->GetComment() || cbOwner->GetValue() != schema->GetOwner()); } else { bool enable=true; CheckValid(enable, !name.IsEmpty(), _("Please specify name.")); EnableOK(enable); } }
void dlgOperator::CheckChange() { if (oper) { EnableOK(txtComment->GetValue() != oper->GetComment() || cbOwner->GetValue() != oper->GetOwner()); } else { wxString name = GetName(); bool enable = true; CheckValid(enable, !name.IsEmpty(), _("Please specify name.")); CheckValid(enable, cbLeftType->GetGuessedSelection() > 0 || cbRightType->GetGuessedSelection() > 0 , _("Please select left or right datatype.")); CheckValid(enable, cbProcedure->GetGuessedSelection() >= 0, _("Please specify a procedure.")); EnableOK(enable); } }
void dlgTextSearchTemplate::CheckChange() { if (tmpl) { EnableOK(txtName->GetValue() != tmpl->GetName() || cbSchema->GetValue() != tmpl->GetSchema()->GetName() || txtComment->GetValue() != tmpl->GetComment()); } else { wxString name = GetName(); bool enable = true; CheckValid(enable, !name.IsEmpty(), _("Please specify name.")); CheckValid(enable, cbLexize->GetGuessedSelection() > 0 , _("Please select a lexize function.")); EnableOK(enable); } }
void dlgTablespace::CheckChange() { if (tablespace) { EnableOK(txtComment->GetValue() != tablespace->GetComment() || GetName() != tablespace->GetName() || cbOwner->GetValue() != tablespace->GetOwner() || dirtyVars); } else { wxString name=GetName(); bool enable=true; CheckValid(enable, !GetName().IsEmpty(), _("Please specify name.")); CheckValid(enable, !txtLocation->GetValue().IsEmpty(), _("Please specify location.")); EnableOK(enable); } }