//------------------------------------------------------------------------------ // Warn about items that will be orphaned. //------------------------------------------------------------------------------ void CaptureForm::acceptForm(bool) { if (!validateForm()) { return; } CryptoMediator cm; if (cm.gpgEnabled() && m_encryptCheckBox->isChecked() && !cm.encrypt(*m_item)) { QMessageBox::StandardButton reply = QMessageBox::critical( this, "Recap", tr("The encryption operation failed (%1).\n\n" "You can opt to save the item unencrypted anyway, discard the " "item or cancel to go back and re-edit it.").arg(cm.lastError()), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel ); switch (reply) { case QMessageBox::Save: break; case QMessageBox::Discard: reject(); return; case QMessageBox::Cancel: default: return; } } emit requestWrite(*m_item); accept(); }
void catEditWidget::onOk() { resetColorForm(); if(validateForm()) { Categorie item; if(State_ == Modification) item.m_id = enModification->m_id; item.m_nom=ui->nomLineEdit->text(); item.m_confiance=ui->confLineEdit->text().toInt(); if(State_ == Modification) { model_->addCategorie(item,true); State_ = Insertion; } else model_->addCategorie(item); clearForm(); } }
void FLFormRecordDB::previousRecord() { if ( cursor_ && cursor_->isValid() ) { if ( cursor_->at() == 0 ) { lastRecord(); return ; } if ( !validateForm() ) return ; if ( cursor_->checkIntegrity() ) { acceptedForm(); cursor_->setActivatedCheckIntegrity( false ); if ( cursor_->commitBuffer() ) { cursor_->setActivatedCheckIntegrity( true ); cursor_->commit(); cursor_->setModeAccess( initialModeAccess ); accepted = false; QString caption = cursor_->metadata() ->alias() + " [ " + static_cast<FLApplication *>( qApp ) ->lastTextCaption() + " ]"; cursor_->transaction(); cursor_->prev(); initScript(); } } #ifdef FL_TEST static_cast<FLApplication *>( qApp ) ->continueTesting( FLTester::FORM_RECORD_READY, this->name() ); #endif } }
void FLFormRecordDB::accept() { if ( accepting ) { return ; } else accepting = true; if ( !cursor_ ) { close(); return ; } if ( !validateForm() ) { accepting = false; return ; } if ( cursor_->checkIntegrity() ) { acceptedForm(); cursor_->setActivatedCheckIntegrity( false ); if ( cursor_->commitBuffer() ) { cursor_->setActivatedCheckIntegrity( true ); } else { accepting = false; return ; } } else { accepting = false; return ; } afterCommitBuffer(); accepted = true; close(); }
// Program change slot. void patchesDialog::progChanged (QTreeWidgetItem * _curr, QTreeWidgetItem * _prev) { if (m_pSynth == NULL || _curr == NULL) return; // Which preview state... if( validateForm() ) { // Set current selection. int iBank = (m_bankListView->currentItem())->text(0).toInt(); int iProg = _curr->text(0).toInt(); // And set it right away... setBankProg(iBank, iProg); // Now we're dirty nuff. m_dirty++; } // Stabilize the form. stabilizeForm(); }
/** validate() */ bool Kontrahenci::validate() { QString missing; if (!validateForm(missing)) { QMessageBox::critical( 0, "QFaktury", trUtf8("Kontrahent nie moze zostać zapisany pownieważ brakuje wymaganych danych w polu: ") + missing); return false; } if (allNames.indexOf(QRegExp(nameEdit->text(), Qt::CaseSensitive, QRegExp::FixedString)) != -1) { QMessageBox::critical( 0, "QFaktury", trUtf8("Kontrahent nie moze zostać dodany ponieważ istnieje już kontrahent o tej nazwie.")); return false; } return true; }
void FLFormRecordDB::acceptContinue() { if ( accepting ) return ; else accepting = true; if ( !cursor_ ) { close(); return ; } if ( !validateForm() ) { accepting = false; return ; } if ( cursor_->checkIntegrity() ) { acceptedForm(); cursor_->setActivatedCheckIntegrity( false ); if ( cursor_->commitBuffer() ) { cursor_->setActivatedCheckIntegrity( true ); cursor_->commit(); cursor_->setModeAccess( FLSqlCursor::INSERT ); accepted = false; QString caption = cursor_->metadata() ->alias() + " [ " + static_cast<FLApplication *>( qApp ) ->lastTextCaption() + " ]"; cursor_->transaction(); setCaption( tr( "Insertar " ) + caption ); if ( initFocusWidget_ ) initFocusWidget_->setFocus(); cursor_->refreshBuffer(); initScript(); } } accepting = false; #ifdef FL_TEST static_cast<FLApplication *>( qApp ) ->continueTesting( FLTester::FORM_RECORD_READY, this->name() ); #endif }
// Validate form fields and accept it valid. void patchesDialog::accept() { if (validateForm()) { // Unload from current selected dialog items. int iBank = (m_bankListView->currentItem())->text(0).toInt(); int iProg = (m_progListView->currentItem())->text(0).toInt(); // And set it right away... setBankProg(iBank, iProg); if (m_dirty > 0) { m_bankModel->setValue( iBank ); m_progModel->setValue( iProg ); m_patchLabel->setText( m_progListView-> currentItem()->text( 1 ) ); } // Do remember preview state... // if (m_pOptions) // m_pOptions->bPresetPreview = m_ui.PreviewCheckBox->isChecked(); // We got it. QDialog::accept(); } }
void CreateAccount::enableSubmit() { ui->btnSubmit->setEnabled(validateForm()); }
// Stabilize current state form. void patchesDialog::stabilizeForm() { m_okButton->setEnabled(validateForm()); }
void ui_edit_articulo::on_btn_aceptar_clicked() { if(validateForm()) { object_e_articulo obj; obj.mf_load(ui->l_codigoop->text()); obj.mf_set_descripcion(ui->le_nombre_2->text()); obj.mf_set_precio_lista(ui->le_precio_2->text()); obj.mf_set_stock(ui->le_stock_2->text()); //int grupo_index = ui->cb_grupo->currentIndex(); //qDebug()<<"grupo index"<<grupo_index; int marca_index = ui->cb_marca->currentIndex(); int medida_index = ui->cb_medida->currentIndex(); int proveedor_index = ui->cb_proveedor->currentIndex(); //Menor o igual a 0 indica que no existe /* if(grupo_index<=0) { obj.mf_set_fk_grupo(""); } else { obj.mf_set_fk_grupo(QString::number(grupo_index)); }*/ if(marca_index<=0) { obj.mf_set_fk_marca(""); } else { obj.mf_set_fk_marca(QString::number(marca_index)); } if(medida_index<=0) { obj.mf_set_fk_medida(""); } else { obj.mf_set_fk_medida(QString::number(medida_index)); } if(proveedor_index<=0) { //Quitamos el proveedor del articulo SYSTEM->deleteProveedor_Articulo(this->pk_proveedor,ui->l_codigoop->text()); } else { //Le modificamos el proveedor _QSTR nuevo_pk_prov = SYSTEM->getProveedorPK(ui->cb_proveedor->currentText()); //Si no tenia proveedor if(this->pk_proveedor=="") { //Insertamos object_r_proveedor_articulo p_articulo ; p_articulo.mf_set_pk_articulo(ui->l_codigoop->text()); p_articulo.mf_set_pk_proveedor(nuevo_pk_prov); p_articulo.mf_add(); } else { //Si tenia, lo modificamos SYSTEM->updateProveedor_Articulo(this->pk_proveedor,ui->l_codigoop->text(),nuevo_pk_prov); } } obj.mf_set_habilitado(C_HABILITADO); //Actualizamos los nuevos datos if(obj.mf_update()) { QMessageBox::information(this,"Registro correcto",C_CORRECTO_REGISTRO_ARTICULO) ; close(); } else { QMessageBox::information(this,"Error en el registro",C_ERROR_REGISTRO_ARTICULO) ; } } }